remove hasProp/getProp/setProp
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/d9ebd922 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/d9ebd922 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/d9ebd922 Branch: refs/heads/develop Commit: d9ebd92209a50b362c7937accf23fe1c039a6b9b Parents: 6940d95 Author: Alex Harui <aha...@apache.org> Authored: Fri Apr 3 09:36:53 2015 -0700 Committer: Alex Harui <aha...@apache.org> Committed: Fri Apr 3 09:36:53 2015 -0700 ---------------------------------------------------------------------- .../FlexJSStore/src/ProductJSONItemConverter.as | 2 +- .../apache/flex/core/ApplicationDataBinding.as | 8 ++-- .../apache/flex/core/ContainerDataBinding.as | 14 +++---- .../flex/core/MXMLBeadViewBaseDataBinding.as | 8 ++-- .../flex/core/StatesWithTransitionsImpl.as | 20 +++++----- .../src/org/apache/flex/effects/Fade.as | 2 +- .../src/org/apache/flex/effects/Move.as | 6 +-- .../src/org/apache/flex/effects/Resize.as | 2 +- .../src/org/apache/flex/effects/Wipe.as | 2 +- .../src/org/apache/flex/core/DataBindingBase.as | 41 -------------------- .../org/apache/flex/events/EventDispatcher.as | 30 -------------- 11 files changed, 32 insertions(+), 103 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d9ebd922/examples/FlexJSStore/src/ProductJSONItemConverter.as ---------------------------------------------------------------------- diff --git a/examples/FlexJSStore/src/ProductJSONItemConverter.as b/examples/FlexJSStore/src/ProductJSONItemConverter.as index 6114b57..4d44ecf 100755 --- a/examples/FlexJSStore/src/ProductJSONItemConverter.as +++ b/examples/FlexJSStore/src/ProductJSONItemConverter.as @@ -34,7 +34,7 @@ package var obj:Object = super.convertItem(data); var product:Product = new Product(); for (var p:String in obj) - setProperty(product, p, obj[p]); + product[p] = obj[p]; return product; } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d9ebd922/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/ApplicationDataBinding.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/ApplicationDataBinding.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/ApplicationDataBinding.as index 27aef17..beeffd2 100644 --- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/ApplicationDataBinding.as +++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/ApplicationDataBinding.as @@ -97,7 +97,7 @@ package org.apache.flex.core binding = bindings[i]; if (binding.source is Array) { - if (hasProperty(_strand, binding.source[0])) + if (binding.source[0] in _strand) { if (binding.source.length == 2 && binding.destination.length == 2) { @@ -115,7 +115,7 @@ package org.apache.flex.core sb.sourceID = binding.source[0]; sb.sourcePropertyName = binding.source[1]; sb.setDocument(_strand); - destObject = getProperty(_strand, binding.destination[0]); + destObject = _strand[binding.destination[0]]; destination = destObject as IStrand; if (destination) destination.addBead(sb); @@ -140,7 +140,7 @@ package org.apache.flex.core cb.sourceID = binding.source[0]; cb.sourcePropertyName = binding.source[1]; cb.setDocument(_strand); - destObject = getProperty(_strand, binding.destination[0]); + destObject = _strand[binding.destination[0]]; destination = destObject as IStrand; if (destination) destination.addBead(cb); @@ -171,7 +171,7 @@ package org.apache.flex.core sb.eventName = fieldWatcher.eventNames as String; sb.sourcePropertyName = binding.source; sb.setDocument(_strand); - destObject = getProperty(_strand, binding.destination[0]); + destObject = _strand[binding.destination[0]]; destination = destObject as IStrand; if (destination) destination.addBead(sb); http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d9ebd922/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/ContainerDataBinding.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/ContainerDataBinding.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/ContainerDataBinding.as index 12c46d9..72161a6 100644 --- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/ContainerDataBinding.as +++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/ContainerDataBinding.as @@ -99,7 +99,7 @@ package org.apache.flex.core binding = bindings[i]; if (binding.source is Array) { - if (hasProperty(_strand, binding.source[0])) + if (binding.source[0] in _strand) { var destObject:Object; var destination:IStrand; @@ -118,7 +118,7 @@ package org.apache.flex.core sb.sourceID = binding.source[0]; sb.sourcePropertyName = binding.source[1]; sb.setDocument(_strand); - destObject = getProperty(_strand, binding.destination[0]); + destObject = _strand[binding.destination[0]]; destination = destObject as IStrand; if (destination) destination.addBead(sb); @@ -143,7 +143,7 @@ package org.apache.flex.core cb.sourceID = binding.source[0]; cb.sourcePropertyName = binding.source[1]; cb.setDocument(_strand); - destObject = getProperty(_strand, binding.destination[0]); + destObject = _strand[binding.destination[0]]; destination = destObject as IStrand; if (destination) destination.addBead(cb); @@ -183,7 +183,7 @@ package org.apache.flex.core cb.destinationPropertyName = binding.destination[1]; cb.sourcePropertyName = binding.source; cb.setDocument(_strand); - destObject = getProperty(_strand, binding.destination[0]); + destObject = _strand[binding.destination[0]]; destination = destObject as IStrand; if (destination) destination.addBead(cb); @@ -208,7 +208,7 @@ package org.apache.flex.core sb.eventName = fieldWatcher.eventNames as String; sb.sourcePropertyName = binding.source; sb.setDocument(_strand); - destObject = getProperty(_strand, binding.destination[0]); + destObject = _strand[binding.destination[0]]; destination = destObject as IStrand; if (destination) destination.addBead(sb); @@ -365,9 +365,9 @@ package org.apache.flex.core { for (var p:String in deferredBindings) { - if (getProperty(_strand, p) != null) + if (_strand[p] != null) { - var destination:IStrand = getProperty(_strand, p) as IStrand; + var destination:IStrand = _strand[p] as IStrand; destination.addBead(deferredBindings[p]); delete deferredBindings[p]; } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d9ebd922/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/MXMLBeadViewBaseDataBinding.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/MXMLBeadViewBaseDataBinding.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/MXMLBeadViewBaseDataBinding.as index 741b7a9..bc3762f 100644 --- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/MXMLBeadViewBaseDataBinding.as +++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/MXMLBeadViewBaseDataBinding.as @@ -97,7 +97,7 @@ package org.apache.flex.core binding = bindings[i]; if (binding.source is Array) { - if (hasProperty(_strand, binding.source[0])) + if (binding.source[0] in _strand) { if (binding.source.length == 2 && binding.destination.length == 2) { @@ -114,7 +114,7 @@ package org.apache.flex.core sb.sourceID = binding.source[0]; sb.sourcePropertyName = binding.source[1]; sb.setDocument(_strand); - destObject = getProperty(_strand, binding.destination[0]); + destObject = _strand[binding.destination[0]]; destination = destObject as IStrand; if (destination) destination.addBead(sb); @@ -139,7 +139,7 @@ package org.apache.flex.core cb.sourceID = binding.source[0]; cb.sourcePropertyName = binding.source[1]; cb.setDocument(_strand); - destObject = getProperty(_strand, binding.destination[0]); + destObject = _strand[binding.destination[0]]; destination = destObject as IStrand; if (destination) destination.addBead(cb); @@ -170,7 +170,7 @@ package org.apache.flex.core sb.eventName = fieldWatcher.eventNames as String; sb.sourcePropertyName = binding.source; sb.setDocument(_strand); - destObject = getProperty(_strand, binding.destination[0]); + destObject = _strand[binding.destination[0]]; destination = destObject as IStrand; if (destination) destination.addBead(sb); http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d9ebd922/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/StatesWithTransitionsImpl.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/StatesWithTransitionsImpl.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/StatesWithTransitionsImpl.as index 7f23785..d0e9059 100644 --- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/StatesWithTransitionsImpl.as +++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/StatesWithTransitionsImpl.as @@ -206,16 +206,16 @@ package org.apache.flex.core { var sp:SetProperty = SetProperty(o); if (sp.target != null) - setProperty(getProperty(sp.document, sp.target), sp.name, sp.previousValue); + sp.document[sp.target][sp.name] = sp.previousValue; else - setProperty(sp.document, sp.name, sp.previousValue); + sp.document[sp.name] = sp.previousValue; } else if (o is SetEventHandler) { var seh:SetEventHandler = SetEventHandler(o); if (seh.target != null) { - getProperty(seh.document, seh.target).removeEventListener(seh.name, seh.handlerFunction); + seh.document[seh.target].removeEventListener(seh.name, seh.handlerFunction); } else { @@ -248,10 +248,10 @@ package org.apache.flex.core { var parent:IParent = ai.document as IParent; if (ai.destination) - parent = getProperty(parent, ai.destination) as IParent; + parent = parent[ai.destination] as IParent; if (ai.relativeTo != null) { - var child:Object = getProperty(ai.document, ai.relativeTo); + var child:Object = ai.document[ai.relativeTo]; if (ai.destination) parent = IChild(child).parent as IParent; var index:int = parent.getElementIndex(child); @@ -272,13 +272,13 @@ package org.apache.flex.core var sp:SetProperty = SetProperty(o); if (sp.target != null) { - sp.previousValue = getProperty(getProperty(sp.document, sp.target), sp.name); - setProperty(getProperty(sp.document, sp.target), sp.name, sp.value); + sp.previousValue = sp.document[sp.target][sp.name]; + sp.document[sp.target][sp.name] = sp.value; } else { - sp.previousValue = getProperty(sp.document, sp.name); - setProperty(sp.document, sp.name, sp.value); + sp.previousValue = sp.document[sp.name]; + sp.document[sp.name] = sp.value; } } else if (o is SetEventHandler) @@ -286,7 +286,7 @@ package org.apache.flex.core var seh:SetEventHandler = SetEventHandler(o); if (seh.target != null) { - getProperty(seh.document, seh.target).addEventListener(seh.name, seh.handlerFunction); + seh.document[seh.target].addEventListener(seh.name, seh.handlerFunction); } else { http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d9ebd922/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Fade.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Fade.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Fade.as index 90658ff..28f0d16 100644 --- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Fade.as +++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Fade.as @@ -134,7 +134,7 @@ public class Fade extends Tween implements IDocument override public function play():void { if (target != null) - actualTarget = getProperty(document, target); + actualTarget = document[target]; if (isNaN(alphaFrom)) start = actualTarget.alpha; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d9ebd922/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Move.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Move.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Move.as index 68a9bcd..2a42b19 100644 --- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Move.as +++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Move.as @@ -165,7 +165,7 @@ public class Move extends Tween implements IDocument override public function play():void { if (target != null) - actualTarget = getProperty(document, target); + actualTarget = document[target]; if (isNaN(xFrom)) xStart = actualTarget.x; @@ -220,7 +220,7 @@ public class Move extends Tween implements IDocument { if (target != null) { - actualTarget = getProperty(document, target); + actualTarget = document[target]; xFrom = actualTarget.x; yFrom = actualTarget.y; } @@ -230,7 +230,7 @@ public class Move extends Tween implements IDocument { if (target != null) { - actualTarget = getProperty(document, target); + actualTarget = document[target]; xTo = actualTarget.x; yTo = actualTarget.y; } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d9ebd922/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Resize.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Resize.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Resize.as index eff8d6b..2ee1e15 100644 --- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Resize.as +++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Resize.as @@ -153,7 +153,7 @@ public class Resize extends Tween implements IDocument override public function play():void { if (target != null) - actualTarget = getProperty(document, target); + actualTarget = document[target]; if (isNaN(widthFrom)) widthStart = actualTarget.width; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d9ebd922/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Wipe.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Wipe.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Wipe.as index 4877215..fe83935 100644 --- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Wipe.as +++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Wipe.as @@ -117,7 +117,7 @@ public class Wipe extends Tween implements IDocument override public function play():void { if (target != null) - actualTarget = getProperty(document, target); + actualTarget = document[target]; wiper.target = actualTarget; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d9ebd922/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/DataBindingBase.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/DataBindingBase.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/DataBindingBase.as index ff4ae9a..9d108e5 100644 --- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/DataBindingBase.as +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/DataBindingBase.as @@ -41,46 +41,5 @@ package org.apache.flex.core { } - /** - * True if property is defined on object. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - protected function hasProperty(obj:Object, propName:String):Boolean - { - return (propName in obj); - } - - /** - * Get a property from an object. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - protected function getProperty(obj:Object, propName:String):* - { - if (propName === 'this') - return obj; - - return obj[propName]; - } - - /** - * Set a property on an object. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - protected function setProperty(obj:Object, propName:String, value:*):void - { - obj[propName] = value; - } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d9ebd922/frameworks/as/projects/FlexJSUI/src/org/apache/flex/events/EventDispatcher.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/events/EventDispatcher.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/events/EventDispatcher.as index b5dbe2e..d0b268a 100644 --- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/events/EventDispatcher.as +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/events/EventDispatcher.as @@ -43,35 +43,5 @@ package org.apache.flex.events { super(); } - - /** - * Get a property from an object. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - protected function getProperty(obj:Object, propName:String):* - { - if (propName === 'this') - return obj; - - return obj[propName]; - } - - /** - * Set a property on an object. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - protected function setProperty(obj:Object, propName:String, value:*):void - { - obj[propName] = value; - } - } } \ No newline at end of file