You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ha...@apache.org on 2016/05/12 11:36:41 UTC
git commit: [flex-asjs] [refs/heads/develop] - Add XML.plus()
Repository: flex-asjs
Updated Branches:
refs/heads/develop 31188469f -> 55732623f
Add XML.plus()
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/55732623
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/55732623
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/55732623
Branch: refs/heads/develop
Commit: 55732623fcad6b19ffedb59d0bd556fc31760738
Parents: 3118846
Author: Harbs <ha...@in-tools.com>
Authored: Thu May 12 14:36:34 2016 +0300
Committer: Harbs <ha...@in-tools.com>
Committed: Thu May 12 14:36:34 2016 +0300
----------------------------------------------------------------------
frameworks/projects/XML/src/main/flex/XML.as | 8 ++++
.../projects/XML/src/main/flex/XMLList.as | 45 ++++++++++++++++++++
manualtests/XMLTest/build.xml | 4 +-
3 files changed, 55 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/55732623/frameworks/projects/XML/src/main/flex/XML.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/XML/src/main/flex/XML.as b/frameworks/projects/XML/src/main/flex/XML.as
index 8f721f8..9c45b5c 100644
--- a/frameworks/projects/XML/src/main/flex/XML.as
+++ b/frameworks/projects/XML/src/main/flex/XML.as
@@ -1381,6 +1381,14 @@ package
return _parent;
}
+ COMPILE::JS
+ public function plus(rightHand:*):*
+ {
+ var list:XMLList = new XMLList();
+ list.appendChild(this);
+ return list.plus(rightHand);
+ }
+
/**
* Inserts the provided child object into the XML element before any existing XML properties for that element.
* @param value
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/55732623/frameworks/projects/XML/src/main/flex/XMLList.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/XML/src/main/flex/XMLList.as b/frameworks/projects/XML/src/main/flex/XMLList.as
index f71ec67..7518b95 100644
--- a/frameworks/projects/XML/src/main/flex/XMLList.as
+++ b/frameworks/projects/XML/src/main/flex/XMLList.as
@@ -540,6 +540,51 @@ package
}
return retVal;
}
+
+ COMPILE::JS
+ public function plus(rightHand:*):*
+ {
+ /*
+ Semantics
+ The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression is evaluated as follows:
+
+ 1. Let a be the result of evalutating AdditiveExpression
+ 2. Let left = GetValue(a)
+ 3. Let m be the result of evaluating MultiplicativeExpression
+ 4. Let right = GetValue(m)
+ 5. If (Type(left) \u2208 {XML, XMLList}) and (Type(right) \u2208 {XML, XMLList})
+ a. Let list be a new XMLList
+ b. Call the [[Append]] method of list with argument x
+ c. Call the [[Append]] method of list with argument y
+ d. Return list
+ 6. Let pLeft = ToPrimitive(left)
+ 7. Let pRight = ToPrimitive(right)
+ 8. If Type(pLeft) is String or Type(pRight) is String
+ a. Return the result of concatenating ToString(pLeft) and ToString(pRight)
+ 9. Else
+ a. Apply the addition operation to ToNumber(pLeft) and ToNumber(pRight) and return the result. See ECMAScript Edition 3, section 11.6.3 for details.
+ */
+ if(rightHand is XML || rightHand is XMLList)
+ {
+ var list:XMLList = new XMLList();
+ list.concat(this);
+ list.concat(rightHand);
+ if(rightHand is XML)
+ list.targetObject = rightHand;
+ else{
+ list.targetObject = rightHand.targetObject;
+ list.targetProperty = rightHand.targetProperty;
+ }
+ return list;
+ }
+ if(rightHand is String)
+ return this.toString() + rightHand;
+ if(rightHand === NaN)
+ return NaN;
+ if(isNaN(Number( this.toString() )) || isNaN(Number( rightHand.toString() )))
+ return this.toString() + rightHand.toString();
+ return Number(this.toString()) + rightHand;
+ }
/**
* If a name parameter is provided, lists all the children of the XMLList object that contain processing instructions with that name.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/55732623/manualtests/XMLTest/build.xml
----------------------------------------------------------------------
diff --git a/manualtests/XMLTest/build.xml b/manualtests/XMLTest/build.xml
index 5f352b6..41b9792 100644
--- a/manualtests/XMLTest/build.xml
+++ b/manualtests/XMLTest/build.xml
@@ -43,10 +43,10 @@
property="FALCONJX_HOME"
value="${env.FALCONJX_HOME}"/>
- <available file="${FLEXJS_HOME}/../flex-falcon/compiler.jx/lib/jsc.jar"
+ <available file="${FLEXJS_HOME}/../flex-falcon/compiler-jx/lib/jsc.jar"
type="file"
property="FALCONJX_HOME"
- value="${FLEXJS_HOME}/../flex-falcon/compiler.jx"/>
+ value="${FLEXJS_HOME}/../flex-falcon/compiler-jx"/>
<available file="${env.GOOG_HOME}/closure/goog/base.js"
type="file"