You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/04/09 01:05:07 UTC
[01/18] git commit: [flex-falcon] [refs/heads/develop] - rough cut at
switching FlexJS to defineProperty. Probably very broken so wait for future
commits before trying
Repository: flex-falcon
Updated Branches:
refs/heads/develop c899a8da7 -> 8596224ed
rough cut at switching FlexJS to defineProperty. Probably very broken so wait for future commits before trying
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/4faba4a5
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/4faba4a5
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/4faba4a5
Branch: refs/heads/develop
Commit: 4faba4a5d3bfcdd3e4013063fc9bac85abf15abc
Parents: 743fe15
Author: Alex Harui <ah...@apache.org>
Authored: Fri Jan 30 10:52:07 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Jan 30 10:52:07 2015 -0800
----------------------------------------------------------------------
.../codegen/js/flexjs/JSFlexJSEmitter.java | 296 +++++++------------
.../internal/codegen/js/goog/JSGoogEmitter.java | 19 +-
2 files changed, 128 insertions(+), 187 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4faba4a5/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index 9d92c4a..37c8045 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -236,6 +236,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
docEmitter.classIgnoreList = ignoreList;
}
+ /*
@Override
public void emitInterface(IInterfaceNode node)
{
@@ -291,7 +292,8 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
write(ASEmitterTokens.SEMICOLON);
}
}
-
+ */
+
@Override
public void emitField(IVariableNode node)
{
@@ -394,6 +396,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
}
}
+ /*
@Override
protected void emitAccessors(IAccessorNode node)
{
@@ -406,7 +409,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
emitSetAccessor((ISetterNode) node);
}
}
-
+
@Override
public void emitMethod(IFunctionNode node)
{
@@ -471,6 +474,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
write(ASEmitterTokens.PAREN_CLOSE);
}
}
+ */
@Override
public void emitFunctionCall(IFunctionCallNode node)
@@ -754,101 +758,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
IDefinition parentDef = (nodeDef != null) ? nodeDef.getParent() : null;
boolean isNative = (parentDef != null)
&& NativeUtils.isNative(parentDef.getBaseName());
- if ((identifierIsAccessorFunction && !isNative)
- || (nodeDef instanceof VariableDefinition && ((VariableDefinition) nodeDef)
- .isBindable()))
- {
- IASNode anode = node
- .getAncestorOfType(BinaryOperatorAssignmentNode.class);
-
- boolean isAssignment = false;
- if (anode != null)
- {
- IASNode leftNode = anode.getChild(0);
- if (anode == parentNode)
- {
- if (node == leftNode)
- isAssignment = true;
- }
- else
- {
- IASNode pnode = parentNode;
- IASNode thisNode = node;
- while (anode != pnode)
- {
- if (pnode instanceof IMemberAccessExpressionNode)
- {
- if (thisNode != pnode.getChild(1))
- {
- // can't be an assignment because
- // we're on the left side of a memberaccessexpression
- break;
- }
- }
- if (pnode instanceof IDynamicAccessNode)
- {
- if (thisNode != pnode.getChild(1))
- {
- // can't be an assignment because
- // we're on the left side of a DynamicAccessNode
- break;
- }
- }
- if (pnode == leftNode)
- {
- isAssignment = true;
- }
- thisNode = pnode;
- pnode = pnode.getParent();
- }
- }
- String op = ((IBinaryOperatorNode) anode).getOperator()
- .getOperatorText();
- if (op.contains("==") || !op.contains("="))
- isAssignment = false;
- }
-
- if (parentNode.getNodeID() == ASTNodeID.MemberAccessExpressionID
- && parentNode.getChild(0).getNodeID() == ASTNodeID.SuperID)
- {
- IClassNode cnode = (IClassNode) node
- .getAncestorOfType(IClassNode.class);
-
- // ToDo (erikdebruin): add VF2JS conditional -> only use check during full SDK compilation
- if (cnode == null)
- return;
-
- write(formatQualifiedName(cnode.getQualifiedName()));
- write(ASEmitterTokens.MEMBER_ACCESS);
- write(JSGoogEmitterTokens.GOOG_BASE);
- write(ASEmitterTokens.PAREN_OPEN);
- write(ASEmitterTokens.THIS);
- writeToken(ASEmitterTokens.COMMA);
- write(ASEmitterTokens.SINGLE_QUOTE);
- writeGetSetPrefix(!isAssignment);
- write(nodeDef.getQualifiedName());
- write(ASEmitterTokens.SINGLE_QUOTE);
- if (isAssignment)
- {
- writeToken(ASEmitterTokens.COMMA);
- }
- }
- else
- {
- writeGetSetPrefix(!isAssignment);
- write(node.getName());
- write(ASEmitterTokens.PAREN_OPEN);
- }
-
- if (anode != null && isAssignment)
- {
- getWalker().walk(((BinaryOperatorAssignmentNode) anode)
- .getRightOperandNode());
- }
-
- write(ASEmitterTokens.PAREN_CLOSE);
- }
- else if (emitName)
+ if (emitName)
{
if (nodeDef != null)
write(formatQualifiedName(nodeDef.getQualifiedName()));
@@ -858,7 +768,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
}
//--------------------------------------------------------------------------
-
+ /*
@Override
protected void emitSuperCall(IASNode node, String type)
{
@@ -970,7 +880,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
write(ASEmitterTokens.SEMICOLON);
}
}
-
+
@Override
protected void emitDefaultParameterCodeBlock(IFunctionNode node)
{
@@ -1001,7 +911,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
{
code.setLength(0);
- /* x = typeof y !== 'undefined' ? y : z;\n */
+ // x = typeof y !== 'undefined' ? y : z;\n
code.append(pnode.getName());
code.append(ASEmitterTokens.SPACE.getToken());
code.append(ASEmitterTokens.EQUAL.getToken());
@@ -1035,18 +945,20 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
}
}
}
+ */
@Override
public void emitBinaryOperator(IBinaryOperatorNode node)
{
ASTNodeID id = node.getNodeID();
+ /*
if (id == ASTNodeID.Op_InID
|| id == ASTNodeID.Op_LogicalAndAssignID
|| id == ASTNodeID.Op_LogicalOrAssignID)
{
super.emitBinaryOperator(node);
}
- else if (id == ASTNodeID.Op_IsID || id == ASTNodeID.Op_AsID)
+ else */ if (id == ASTNodeID.Op_IsID || id == ASTNodeID.Op_AsID)
{
emitIsAs(node.getLeftOperandNode(), node.getRightOperandNode(), id, false);
}
@@ -1065,6 +977,8 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
}
else
{
+ super.emitBinaryOperator(node);
+ /*
IExpressionNode leftSide = node.getLeftOperandNode();
IExpressionNode property = null;
@@ -1126,6 +1040,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
if (ASNodeUtils.hasParenClose(node))
write(ASEmitterTokens.PAREN_CLOSE);
}
+ */
}
}
@@ -1260,6 +1175,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
getWalker().walk(node.getRightOperandNode());
}
+ /*
private static ITypeDefinition getTypeDefinition(IDefinitionNode node)
{
ITypeNode tnode = (ITypeNode) node.getAncestorOfType(ITypeNode.class);
@@ -1274,7 +1190,8 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
IClassDefinition superClass = parent.resolveBaseClass(project);
return superClass;
}
-
+ */
+
@Override
protected void emitObjectDefineProperty(IAccessorNode node)
{
@@ -1302,95 +1219,103 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
break;
}
}
- if (isBindableSetter)
+ }
+ if (isBindableSetter)
+ {
+ getDoc().emitMethodDoc(fn, project);
+ write(formatQualifiedName(type.getQualifiedName()));
+ if (!node.hasModifier(ASModifier.STATIC))
+ {
+ write(ASEmitterTokens.MEMBER_ACCESS);
+ write(JSEmitterTokens.PROTOTYPE);
+ }
+
+ write(ASEmitterTokens.MEMBER_ACCESS);
+ write("__bindingWrappedSetter__");
+ writeToken(node.getName());
+ writeToken(ASEmitterTokens.EQUAL);
+ write(ASEmitterTokens.FUNCTION);
+ emitParameters(node.getParameterNodes());
+ //writeNewline();
+ emitMethodScope(node.getScopedNode());
+ }
+ super.emitObjectDefineProperty(node);
+ }
+
+ @Override
+ protected void emitDefinePropertyFunction(IAccessorNode node)
+ {
+ boolean isBindableSetter = false;
+ if (node instanceof SetterNode)
+ {
+ IMetaInfo[] metaInfos = null;
+ metaInfos = node.getMetaInfos();
+ for (IMetaInfo metaInfo : metaInfos)
{
- getDoc().emitMethodDoc(fn, project);
- write(formatQualifiedName(type.getQualifiedName()));
- if (!node.hasModifier(ASModifier.STATIC))
+ String name = metaInfo.getTagName();
+ if (name.equals("Bindable") && metaInfo.getAllAttributes().length == 0)
{
- write(ASEmitterTokens.MEMBER_ACCESS);
- write(JSEmitterTokens.PROTOTYPE);
+ isBindableSetter = true;
+ break;
}
-
- write(ASEmitterTokens.MEMBER_ACCESS);
- writeGetSetPrefix(false);
- writeToken(node.getName());
- writeToken(ASEmitterTokens.EQUAL);
- write(ASEmitterTokens.FUNCTION);
- emitParameters(node.getParameterNodes());
- write(ASEmitterTokens.SPACE);
- writeNewline(ASEmitterTokens.BLOCK_OPEN);
-
- write(ASEmitterTokens.VAR);
- write(ASEmitterTokens.SPACE);
- write("oldValue");
- write(ASEmitterTokens.SPACE);
- write(ASEmitterTokens.EQUAL);
- write(ASEmitterTokens.SPACE);
- write(ASEmitterTokens.THIS);
- write(ASEmitterTokens.MEMBER_ACCESS);
- write("get_" + node.getName());
- write(ASEmitterTokens.PAREN_OPEN);
- write(ASEmitterTokens.PAREN_CLOSE);
- writeNewline(ASEmitterTokens.SEMICOLON);
-
- // add change check
- write(ASEmitterTokens.IF);
- write(ASEmitterTokens.SPACE);
- write(ASEmitterTokens.PAREN_OPEN);
- write("oldValue");
- write(ASEmitterTokens.SPACE);
- write(ASEmitterTokens.STRICT_EQUAL);
- write(ASEmitterTokens.SPACE);
- IParameterNode[] params = node.getParameterNodes();
- write(params[0].getName());
- write(ASEmitterTokens.PAREN_CLOSE);
- write(ASEmitterTokens.SPACE);
- write(ASEmitterTokens.RETURN);
- writeNewline(ASEmitterTokens.SEMICOLON);
-
- write(ASEmitterTokens.THIS);
- write(ASEmitterTokens.MEMBER_ACCESS);
- write("__bindingWrappedSetter__" + node.getName());
- write(ASEmitterTokens.PAREN_OPEN);
- write(params[0].getName());
- write(ASEmitterTokens.PAREN_CLOSE);
- writeNewline(ASEmitterTokens.SEMICOLON);
-
- // add dispatch of change event
- writeNewline(" this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(");
- writeNewline(" this, \"" + node.getName() + "\", oldValue, " + params[0].getName() + "));");
- write(ASEmitterTokens.BLOCK_CLOSE);
- writeNewline(ASEmitterTokens.SEMICOLON);
- writeNewline();
- writeNewline();
}
}
-
- if (project == null)
- project = getWalker().getProject();
-
- getDoc().emitMethodDoc(fn, project);
- write(formatQualifiedName(type.getQualifiedName()));
- if (!node.hasModifier(ASModifier.STATIC))
+ if (isBindableSetter)
{
+ write(ASEmitterTokens.FUNCTION);
+ emitParameters(node.getParameterNodes());
+ write(ASEmitterTokens.SPACE);
+ writeNewline(ASEmitterTokens.BLOCK_OPEN);
+
+ write(ASEmitterTokens.VAR);
+ write(ASEmitterTokens.SPACE);
+ write("oldValue");
+ write(ASEmitterTokens.SPACE);
+ write(ASEmitterTokens.EQUAL);
+ write(ASEmitterTokens.SPACE);
+ write(ASEmitterTokens.THIS);
write(ASEmitterTokens.MEMBER_ACCESS);
- write(JSEmitterTokens.PROTOTYPE);
- }
+ write("get_" + node.getName());
+ write(ASEmitterTokens.PAREN_OPEN);
+ write(ASEmitterTokens.PAREN_CLOSE);
+ writeNewline(ASEmitterTokens.SEMICOLON);
+
+ // add change check
+ write(ASEmitterTokens.IF);
+ write(ASEmitterTokens.SPACE);
+ write(ASEmitterTokens.PAREN_OPEN);
+ write("oldValue");
+ write(ASEmitterTokens.SPACE);
+ write(ASEmitterTokens.STRICT_EQUAL);
+ write(ASEmitterTokens.SPACE);
+ IParameterNode[] params = node.getParameterNodes();
+ write(params[0].getName());
+ write(ASEmitterTokens.PAREN_CLOSE);
+ write(ASEmitterTokens.SPACE);
+ write(ASEmitterTokens.RETURN);
+ writeNewline(ASEmitterTokens.SEMICOLON);
- write(ASEmitterTokens.MEMBER_ACCESS);
- if (isBindableSetter)
- write("__bindingWrappedSetter__");
+ write(ASEmitterTokens.THIS);
+ write(ASEmitterTokens.MEMBER_ACCESS);
+ write("__bindingWrappedSetter__" + node.getName());
+ write(ASEmitterTokens.PAREN_OPEN);
+ write(params[0].getName());
+ write(ASEmitterTokens.PAREN_CLOSE);
+ writeNewline(ASEmitterTokens.SEMICOLON);
+
+ // add dispatch of change event
+ writeNewline(" this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(");
+ writeNewline(" this, \"" + node.getName() + "\", oldValue, " + params[0].getName() + "));");
+ write(ASEmitterTokens.BLOCK_CLOSE);
+ writeNewline(ASEmitterTokens.SEMICOLON);
+ writeNewline();
+ writeNewline();
+ }
else
- writeGetSetPrefix(node instanceof IGetterNode);
- writeToken(node.getName());
- writeToken(ASEmitterTokens.EQUAL);
- write(ASEmitterTokens.FUNCTION);
- emitParameters(node.getParameterNodes());
- //writeNewline();
- emitMethodScope(node.getScopedNode());
+ super.emitDefinePropertyFunction(node);
}
-
+
+ /*
private void writeGetSetPrefix(boolean isGet)
{
if (isGet)
@@ -1399,7 +1324,8 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
write(ASEmitterTokens.SET);
write("_");
}
-
+ */
+
private JSFlexJSDocEmitter docEmitter = null;
@Override
@@ -1841,6 +1767,8 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
write("E4XFilter");
write(ASEmitterTokens.SINGLE_QUOTE);
}
+
+ /*
@Override
public void emitUnaryOperator(IUnaryOperatorNode node)
{
@@ -1894,8 +1822,10 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
}
super.emitUnaryOperator(node);
}
+ */
- private String formatQualifiedName(String name)
+ @Override
+ protected String formatQualifiedName(String name)
{
if (name.contains("goog.") || name.startsWith("Vector."))
return name;
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4faba4a5/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
index 7050999..28e17f5 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
@@ -455,7 +455,7 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
String qname = getTypeDefinition(node).getQualifiedName();
if (qname != null && !qname.equals(""))
{
- write(qname);
+ write(formatQualifiedName(qname));
if (!isConstructor)
{
write(ASEmitterTokens.MEMBER_ACCESS);
@@ -496,11 +496,11 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
writeNewline();
write(JSGoogEmitterTokens.GOOG_INHERITS);
write(ASEmitterTokens.PAREN_OPEN);
- write(qname);
+ write(formatQualifiedName(qname));
writeToken(ASEmitterTokens.COMMA);
String sname = getSuperClassDefinition(node, project)
.getQualifiedName();
- write(sname);
+ write(formatQualifiedName(sname));
write(ASEmitterTokens.PAREN_CLOSE);
}
}
@@ -1024,7 +1024,7 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
write(ASEmitterTokens.FUNCTION);
emitParameters(node.getParameterNodes());
- emitMethodScope(node.getScopedNode());
+ emitDefinePropertyFunction(node);
writeToken(ASEmitterTokens.COMMA);
write(JSEmitterTokens.CONFIGURABLE);
@@ -1036,6 +1036,11 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
write(ASEmitterTokens.PAREN_CLOSE);
}
+ protected void emitDefinePropertyFunction(IAccessorNode node)
+ {
+ emitMethodScope(node.getScopedNode());
+ }
+
//--------------------------------------------------------------------------
// Operators
//--------------------------------------------------------------------------
@@ -1151,4 +1156,10 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
}
return list;
}
+
+ protected String formatQualifiedName(String name)
+ {
+ return name;
+ }
+
}
[09/18] git commit: [flex-falcon] [refs/heads/develop] - make sure
backing vars have '_'
Posted by ah...@apache.org.
make sure backing vars have '_'
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/01fc34f4
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/01fc34f4
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/01fc34f4
Branch: refs/heads/develop
Commit: 01fc34f430794b84152da117928a93dab8fd5ddf
Parents: 57161bd
Author: Alex Harui <ah...@apache.org>
Authored: Sat Mar 28 07:13:08 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Sat Mar 28 07:13:08 2015 -0700
----------------------------------------------------------------------
.../codegen/mxml/flexjs/MXMLFlexJSEmitter.java | 66 ++++++++++++--------
1 file changed, 41 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/01fc34f4/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index 71667b8..ef8ccfc 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -447,7 +447,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
writeNewline(" */");
write(ASEmitterTokens.THIS);
write(ASEmitterTokens.MEMBER_ACCESS);
- write(instance.id);
+ write(instance.id + "_");
writeNewline(ASEmitterTokens.SEMICOLON);
}
}
@@ -835,46 +835,62 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
protected void emitPropertyGetterSetters(String cname)
{
+ int n = 0;
+ for (MXMLDescriptorSpecifier instance : instances)
+ {
+ if (!instance.id.startsWith(MXMLFlexJSEmitterTokens.ID_PREFIX
+ .getToken()))
+ {
+ n++;
+ }
+ }
+ if (n == 0)
+ return;
+
+ String formattedCName = formatQualifiedName(cname);
+
+ write("Object.defineProperties(");
+ write(formattedCName);
+ writeNewline(".prototype, {");
+ indentPush();
+ int i = 0;
for (MXMLDescriptorSpecifier instance : instances)
{
if (!instance.id.startsWith(MXMLFlexJSEmitterTokens.ID_PREFIX
.getToken()))
{
- writeNewline("/**");
- writeNewline(" * @expose");
- writeNewline(" * @return {" + instance.name + "}");
- writeNewline(" */");
- writeNewline(formatQualifiedName(cname)
- + ".prototype.get_" + instance.id + " = function()");
indentPush();
- writeNewline("{");
+ writeNewline("'" + instance.id + "': {");
+ writeNewline("/** @this {" + formattedCName + "} */");
+ indentPush();
+ writeNewline("get: function() {");
indentPop();
- writeNewline("return this." + instance.id + ";");
- writeNewline("};");
- writeNewline();
- writeNewline();
- writeNewline("/**");
- writeNewline(" * @expose");
- writeNewline(" * @param {" + instance.name + "} value");
- writeNewline(" */");
- writeNewline(formatQualifiedName(cname)
- + ".prototype.set_" + instance.id
- + " = function(value)");
+ writeNewline("return this." + instance.id + "_;");
+ writeNewline("},");
+ writeNewline("/** @this {" + formattedCName + "} */");
indentPush();
- writeNewline("{");
+ writeNewline("set: function(value) {");
indentPush();
- writeNewline("if (value != this." + instance.id + ") {");
- writeNewline("this." + instance.id + " = value;");
+ writeNewline("if (value != this." + instance.id + "_) {");
+ writeNewline("this." + instance.id + "_ = value;");
write("this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(this, '");
indentPop();
writeNewline(instance.id + "', null, value));");
indentPop();
writeNewline("}");
- writeNewline("};");
- writeNewline();
- writeNewline();
+ indentPop();
+ writeNewline("}");
+ if (i < n - 1)
+ writeNewline("},");
+ else
+ {
+ indentPop();
+ writeNewline("}");
+ }
+ i++;
}
}
+ writeNewline("});");
}
//--------------------------------------------------------------------------
[16/18] git commit: [flex-falcon] [refs/heads/develop] - re-fix
FLEX-34771 in defineProp and add test
Posted by ah...@apache.org.
re-fix FLEX-34771 in defineProp and add test
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/6e79a10d
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/6e79a10d
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/6e79a10d
Branch: refs/heads/develop
Commit: 6e79a10d3b44c29fb393d67a603810d0717cd1c6
Parents: 4d501de
Author: Alex Harui <ah...@apache.org>
Authored: Wed Apr 8 08:01:20 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Wed Apr 8 08:01:20 2015 -0700
----------------------------------------------------------------------
.../internal/codegen/mxml/TestMXMLScript.java | 1 -
.../mxml/flexjs/TestFlexJSMXMLScript.java | 51 ++++++++++++++++++++
.../compiler/internal/test/FlexJSTestBase.java | 2 +-
.../codegen/js/flexjs/JSFlexJSEmitter.java | 6 +++
.../internal/codegen/js/goog/JSGoogEmitter.java | 13 ++++-
5 files changed, 70 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6e79a10d/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/TestMXMLScript.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/TestMXMLScript.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/TestMXMLScript.java
index 9b03d9a..3e49131 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/TestMXMLScript.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/TestMXMLScript.java
@@ -103,5 +103,4 @@ public class TestMXMLScript extends MXMLTestBase
//
// assertOut("<script><![CDATA[\n\tvar n:int = 3;\n\tfor (var i:int = 0; i < n; i++) {\n\tAlert.show(\"Hi\");\n};\n]]></script>");
}
-
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6e79a10d/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLScript.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLScript.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLScript.java
new file mode 100644
index 0000000..8984cd4
--- /dev/null
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLScript.java
@@ -0,0 +1,51 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.flex.compiler.internal.codegen.mxml.flexjs;
+
+import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitter;
+import org.apache.flex.compiler.internal.test.FlexJSTestBase;
+import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLScriptNode;
+import org.junit.Test;
+
+public class TestFlexJSMXMLScript extends FlexJSTestBase
+{
+
+ @Test
+ public void testSuperInScript()
+ {
+ String code = "" + "<fx:Script><![CDATA["
+ + " override public function addedToParent():void {"
+ + " super.addedToParent();}"
+ + "]]></fx:Script>";
+
+ IMXMLScriptNode node = (IMXMLScriptNode) getNode(code,
+ IMXMLScriptNode.class, FlexJSTestBase.WRAP_LEVEL_DOCUMENT);
+
+ IMXMLDocumentNode dnode = (IMXMLDocumentNode) node
+ .getAncestorOfType(IMXMLDocumentNode.class);
+ ((JSFlexJSEmitter)(mxmlBlockWalker.getASEmitter())).thisClass = dnode.getDefinition();
+ mxmlBlockWalker.visitDocument(dnode);
+ String appName = dnode.getQualifiedName();
+ String outTemplate = "/**\n * AppName\n *\n * @fileoverview\n *\n * @suppress {checkTypes}\n */\n\ngoog.provide('AppName');\n\ngoog.require('org_apache_flex_core_Application');\n\n\n\n\n/**\n * @constructor\n * @extends {org_apache_flex_core_Application}\n */\nAppName = function() {\n AppName.base(this, 'constructor');\n \n /**\n * @private\n * @type {Array}\n */\n this.mxmldd;\n \n /**\n * @private\n * @type {Array}\n */\n this.mxmldp;\n};\ngoog.inherits(AppName, org_apache_flex_core_Application);\n\n\n/**\n * Metadata\n *\n * @type {Object.<string, Array.<Object>>}\n */\nAppName.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'AppName', qName: 'AppName' }] };\n\n\n/**\n * @expose\n * @override\n */\nAppName.prototype.addedToParent = function() {\n AppName.base(this, 'addedToParent');\n};\n\n\n";
+
+ assertOut(outTemplate.replaceAll("AppName", appName));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6e79a10d/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java
index 0f6e6d0..8ce033d 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/FlexJSTestBase.java
@@ -103,7 +103,7 @@ public class FlexJSTestBase extends TestBase
{
if (wrapLevel >= WRAP_LEVEL_DOCUMENT)
code = ""
- + "<basic:Application xmlns:basic=\"library://ns.apache.org/flexjs/basic\">"
+ + "<basic:Application xmlns:fx=\"http://ns.adobe.com/mxml/2009\" xmlns:basic=\"library://ns.apache.org/flexjs/basic\">"
+ code + "</basic:Application>";
IMXMLFileNode node = compileMXML(code);
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6e79a10d/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index d78c83f..792287b 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -2160,4 +2160,10 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
name = name.replaceAll("\\.", "_");
return name;
}
+
+ @Override
+ protected IDefinition getClassDefinition()
+ {
+ return thisClass;
+ }
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6e79a10d/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
index b253fbc..ebe7c4e 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
@@ -665,7 +665,13 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
IClassNode cnode = (IClassNode) node
.getAncestorOfType(IClassNode.class);
- write(formatQualifiedName(cnode.getQualifiedName()));
+ if (cnode == null)
+ {
+ IDefinition cdef = getClassDefinition();
+ write(formatQualifiedName(cdef.getQualifiedName()));
+ }
+ else
+ write(formatQualifiedName(cnode.getQualifiedName()));
write(ASEmitterTokens.MEMBER_ACCESS);
write(JSGoogEmitterTokens.GOOG_BASE);
write(ASEmitterTokens.PAREN_OPEN);
@@ -1166,5 +1172,10 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
{
return name;
}
+
+ protected IDefinition getClassDefinition()
+ {
+ return null;
+ }
}
[11/18] git commit: [flex-falcon] [refs/heads/develop] - debug
version of FlexJSStore now runs. minified version does not due to GCC having
problems with the property names in the defineProperties structure.
Posted by ah...@apache.org.
debug version of FlexJSStore now runs. minified version does not due to GCC having problems with the property names in the defineProperties structure.
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/d9658d62
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/d9658d62
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/d9658d62
Branch: refs/heads/develop
Commit: d9658d627a22861494b0bd4f3c351e72d016ed92
Parents: 7328a52
Author: Alex Harui <ah...@apache.org>
Authored: Fri Apr 3 09:32:19 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Apr 3 09:32:19 2015 -0700
----------------------------------------------------------------------
.../codegen/js/flexjs/JSFlexJSEmitter.java | 172 ++++++++++++++-----
.../codegen/mxml/flexjs/MXMLFlexJSEmitter.java | 31 ++--
2 files changed, 144 insertions(+), 59 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d9658d62/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index 87a39f2..cbf89b6 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -121,6 +121,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
}
HashMap<String, PropertyNodes> propertyMap = new HashMap<String, PropertyNodes>();
+ ArrayList<String> bindableVars = new ArrayList<String>();
@Override
protected String getIndent(int numIndent)
@@ -223,6 +224,13 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
}
}
+ emitBindableVariables(node.getDefinition());
+
+ emitASGettersAndSetters(node.getDefinition());
+ }
+
+ public void emitASGettersAndSetters(IClassDefinition definition)
+ {
if (!propertyMap.isEmpty())
{
write(JSGoogEmitterTokens.OBJECT);
@@ -440,50 +448,82 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
}
if (node.getNodeID() == ASTNodeID.BindableVariableID)
{
- // [Bindable]
- writeNewline(ASEmitterTokens.SEMICOLON.getToken());
- writeNewline();
- writeNewline("/**");
- writeNewline("@expose");
- writeNewline(" */");
- writeNewline(formatQualifiedName(definition.getQualifiedName())
- + ASEmitterTokens.MEMBER_ACCESS.getToken() + root
- + "get_" + node.getName()
- + ASEmitterTokens.SPACE.getToken() + ASEmitterTokens.EQUAL.getToken()
- + ASEmitterTokens.SPACE.getToken() + ASEmitterTokens.FUNCTION.getToken()
- + ASEmitterTokens.PAREN_OPEN.getToken() + ASEmitterTokens.PAREN_CLOSE.getToken()
- + ASEmitterTokens.SPACE.getToken() + ASEmitterTokens.BLOCK_OPEN.getToken());
- writeNewline(ASEmitterTokens.RETURN.getToken() + ASEmitterTokens.SPACE.getToken()
- + ASEmitterTokens.THIS.getToken() + ASEmitterTokens.MEMBER_ACCESS.getToken()
- + node.getName() + ASEmitterTokens.SEMICOLON.getToken());
- writeNewline(ASEmitterTokens.BLOCK_CLOSE.getToken() + ASEmitterTokens.SEMICOLON.getToken());
- writeNewline();
- writeNewline("/**");
- writeNewline("@expose");
- writeNewline(" */");
- writeNewline(formatQualifiedName(definition.getQualifiedName())
- + ASEmitterTokens.MEMBER_ACCESS.getToken() + root
- + "set_" + node.getName()
- + ASEmitterTokens.SPACE.getToken() + ASEmitterTokens.EQUAL.getToken()
- + ASEmitterTokens.SPACE.getToken() + ASEmitterTokens.FUNCTION.getToken()
- + ASEmitterTokens.PAREN_OPEN.getToken() + "value" + ASEmitterTokens.PAREN_CLOSE.getToken()
- + ASEmitterTokens.SPACE.getToken() + ASEmitterTokens.BLOCK_OPEN.getToken());
- writeNewline("if (value != " + ASEmitterTokens.THIS.getToken()
- + ASEmitterTokens.MEMBER_ACCESS.getToken() + node.getName() + ") {");
- writeNewline(" var oldValue = "
- + ASEmitterTokens.THIS.getToken() + ASEmitterTokens.MEMBER_ACCESS.getToken()
- + node.getName() + ASEmitterTokens.SEMICOLON.getToken());
- writeNewline(" " + ASEmitterTokens.THIS.getToken() + ASEmitterTokens.MEMBER_ACCESS.getToken()
- + node.getName() + " = value;");
- writeNewline(" this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(");
- writeNewline(" this, \"" + node.getName() + "\", oldValue, value));");
- writeNewline("}");
- write(ASEmitterTokens.BLOCK_CLOSE.getToken());
-
-
+ bindableVars.add(node.getName());
}
}
+ private void emitBindableVariables(IClassDefinition cdef)
+ {
+ if (bindableVars.size() > 0)
+ {
+ write(JSGoogEmitterTokens.OBJECT);
+ write(ASEmitterTokens.MEMBER_ACCESS);
+ write(JSEmitterTokens.DEFINE_PROPERTIES);
+ write(ASEmitterTokens.PAREN_OPEN);
+ String qname = cdef.getQualifiedName();
+ write(formatQualifiedName(qname));
+ write(ASEmitterTokens.MEMBER_ACCESS);
+ write(JSEmitterTokens.PROTOTYPE);
+ write(ASEmitterTokens.COMMA);
+ write(ASEmitterTokens.SPACE);
+ writeNewline(ASEmitterTokens.BLOCK_OPEN);
+
+ boolean firstTime = true;
+ for (String varName : bindableVars)
+ {
+ if (firstTime)
+ firstTime = false;
+ else
+ write(ASEmitterTokens.COMMA);
+
+ emitBindableVarDefineProperty(varName, cdef);
+ }
+ writeNewline(ASEmitterTokens.BLOCK_CLOSE);
+ write(ASEmitterTokens.PAREN_CLOSE);
+ write(ASEmitterTokens.SEMICOLON);
+
+ }
+ }
+
+ private void emitBindableVarDefineProperty(String name, IClassDefinition cdef)
+ {
+ // 'PropName': {
+ writeNewline(ASEmitterTokens.SINGLE_QUOTE.getToken() + name +
+ ASEmitterTokens.SINGLE_QUOTE.getToken() +
+ ASEmitterTokens.COLON.getToken() +
+ ASEmitterTokens.SPACE.getToken() +
+ ASEmitterTokens.BLOCK_OPEN.getToken());
+ indentPush();
+ writeNewline("/** @this {" + formatQualifiedName(cdef.getQualifiedName()) + "} */");
+ writeNewline(ASEmitterTokens.GET.getToken() + ASEmitterTokens.COLON.getToken()
+ + ASEmitterTokens.SPACE.getToken() + ASEmitterTokens.FUNCTION.getToken()
+ + ASEmitterTokens.PAREN_OPEN.getToken() + ASEmitterTokens.PAREN_CLOSE.getToken()
+ + ASEmitterTokens.SPACE.getToken() + ASEmitterTokens.BLOCK_OPEN.getToken());
+ writeNewline(ASEmitterTokens.RETURN.getToken() + ASEmitterTokens.SPACE.getToken()
+ + ASEmitterTokens.THIS.getToken() + ASEmitterTokens.MEMBER_ACCESS.getToken()
+ + name + "_" + ASEmitterTokens.SEMICOLON.getToken());
+ indentPop();
+ writeNewline(ASEmitterTokens.BLOCK_CLOSE.getToken() + ASEmitterTokens.COMMA.getToken());
+ writeNewline();
+ writeNewline("/** @this {" + formatQualifiedName(cdef.getQualifiedName()) + "} */");
+ writeNewline(ASEmitterTokens.SET.getToken() + ASEmitterTokens.COLON.getToken()
+ + ASEmitterTokens.SPACE.getToken() + ASEmitterTokens.FUNCTION.getToken()
+ + ASEmitterTokens.PAREN_OPEN.getToken() + "value" + ASEmitterTokens.PAREN_CLOSE.getToken()
+ + ASEmitterTokens.SPACE.getToken() + ASEmitterTokens.BLOCK_OPEN.getToken());
+ writeNewline("if (value != " + ASEmitterTokens.THIS.getToken()
+ + ASEmitterTokens.MEMBER_ACCESS.getToken() + name + "_) {");
+ writeNewline(" var oldValue = "
+ + ASEmitterTokens.THIS.getToken() + ASEmitterTokens.MEMBER_ACCESS.getToken()
+ + name + "_" + ASEmitterTokens.SEMICOLON.getToken());
+ writeNewline(" " + ASEmitterTokens.THIS.getToken() + ASEmitterTokens.MEMBER_ACCESS.getToken()
+ + name + "_ = value;");
+ writeNewline(" this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(");
+ writeNewline(" this, \"" + name + "_\", oldValue, value));");
+ writeNewline("}");
+ write(ASEmitterTokens.BLOCK_CLOSE.getToken());
+ write(ASEmitterTokens.BLOCK_CLOSE.getToken());
+ }
+
/*
@Override
protected void emitAccessors(IAccessorNode node)
@@ -1364,11 +1404,49 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
FunctionNode fn = (FunctionNode) node;
fn.parseFunctionBody(getProblems());
+ boolean isBindableSetter = false;
+ if (node instanceof SetterNode)
+ {
+ IMetaInfo[] metaInfos = null;
+ metaInfos = node.getMetaInfos();
+ for (IMetaInfo metaInfo : metaInfos)
+ {
+ name = metaInfo.getTagName();
+ if (name.equals("Bindable") && metaInfo.getAllAttributes().length == 0)
+ {
+ isBindableSetter = true;
+ break;
+ }
+ }
+ }
+ if (isBindableSetter)
+ {
+ IFunctionDefinition definition = node.getDefinition();
+ ITypeDefinition type = (ITypeDefinition) definition.getParent();
+ getDoc().emitMethodDoc(fn, project);
+ write(formatQualifiedName(type.getQualifiedName()));
+ if (!node.hasModifier(ASModifier.STATIC))
+ {
+ write(ASEmitterTokens.MEMBER_ACCESS);
+ write(JSEmitterTokens.PROTOTYPE);
+ }
+
+ write(ASEmitterTokens.MEMBER_ACCESS);
+ write("__bindingWrappedSetter__");
+ writeToken(node.getName());
+ writeToken(ASEmitterTokens.EQUAL);
+ write(ASEmitterTokens.FUNCTION);
+ emitParameters(node.getParameterNodes());
+ //writeNewline();
+ emitMethodScope(node.getScopedNode());
+ }
}
@Override
protected void emitObjectDefineProperty(IAccessorNode node)
{
+ //TODO: ajh is this method needed anymore?
+
FunctionNode fn = (FunctionNode) node;
fn.parseFunctionBody(getProblems());
@@ -1436,8 +1514,8 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
}
if (isBindableSetter)
{
- write(ASEmitterTokens.FUNCTION);
- emitParameters(node.getParameterNodes());
+ //write(ASEmitterTokens.FUNCTION);
+ //emitParameters(node.getParameterNodes());
write(ASEmitterTokens.SPACE);
writeNewline(ASEmitterTokens.BLOCK_OPEN);
@@ -1449,9 +1527,9 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
write(ASEmitterTokens.SPACE);
write(ASEmitterTokens.THIS);
write(ASEmitterTokens.MEMBER_ACCESS);
- write("get_" + node.getName());
- write(ASEmitterTokens.PAREN_OPEN);
- write(ASEmitterTokens.PAREN_CLOSE);
+ write(node.getName());
+ //write(ASEmitterTokens.PAREN_OPEN);
+ //write(ASEmitterTokens.PAREN_CLOSE);
writeNewline(ASEmitterTokens.SEMICOLON);
// add change check
@@ -1481,7 +1559,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
writeNewline(" this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(");
writeNewline(" this, \"" + node.getName() + "\", oldValue, " + params[0].getName() + "));");
write(ASEmitterTokens.BLOCK_CLOSE);
- writeNewline(ASEmitterTokens.SEMICOLON);
+ //writeNewline(ASEmitterTokens.SEMICOLON);
writeNewline();
writeNewline();
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d9658d62/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index ef8ccfc..cf5d3df 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -210,6 +210,8 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
emitScripts();
+ ((JSFlexJSEmitter)asEmitter).emitASGettersAndSetters(cdef);
+
emitEvents(cname);
emitPropertyGetterSetters(cname);
@@ -844,7 +846,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
n++;
}
}
- if (n == 0)
+ if (n == 0 && descriptorTree.size() == 0)
return;
String formattedCName = formatQualifiedName(cname);
@@ -880,7 +882,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
writeNewline("}");
indentPop();
writeNewline("}");
- if (i < n - 1)
+ if (i < n - 1 || descriptorTree.size() > 0)
writeNewline("},");
else
{
@@ -890,7 +892,8 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
i++;
}
}
- writeNewline("});");
+ if (descriptorTree.size() == 0)
+ writeNewline("});");
}
//--------------------------------------------------------------------------
@@ -903,18 +906,18 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
MXMLDescriptorSpecifier root = descriptorTree.get(0);
root.isTopNode = false;
- writeNewline("/**");
- writeNewline(" * @override");
- writeNewline(" * @return {Array} the Array of UI element descriptors.");
- writeNewline(" */");
- writeNewline(formatQualifiedName(cname) + ".prototype.get_MXMLDescriptor = function()");
+ indentPush();
+ writeNewline("'MXMLDescriptor': {");
+ writeNewline("/** @this {" + formatQualifiedName(cname) + "} */");
+ indentPush();
+ writeNewline("get: function() {");
indentPush();
writeNewline("{");
writeNewline("if (this.mxmldd == undefined)");
indentPush();
writeNewline("{");
writeNewline("/** @type {Array} */");
- writeNewline("var arr = " + formatQualifiedName(cname) + ".base(this, 'get_MXMLDescriptor');");
+ writeNewline("var arr = org_apache_flex_utils_Language.superGetter(" + formatQualifiedName(cname) + ",this, 'MXMLDescriptor');");
writeNewline("/** @type {Array} */");
indentPop();
indentPop();
@@ -938,10 +941,14 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
writeNewline("}");
indentPop();
writeNewline("return this.mxmldd;");
- writeNewline("};");
- writeNewline();
+ writeNewline("}");
+ indentPop();
+ writeNewline("}");
+ indentPop();
+ writeNewline("}");
+ writeNewline("});");
}
-
+
}
//--------------------------------------------------------------------------
[18/18] git commit: [flex-falcon] [refs/heads/develop] - fix bug in
binding event
Posted by ah...@apache.org.
fix bug in binding event
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/8596224e
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/8596224e
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/8596224e
Branch: refs/heads/develop
Commit: 8596224ed995cb033b0370cb8f44dbe88b5166b4
Parents: 83c8eb2
Author: Alex Harui <ah...@apache.org>
Authored: Wed Apr 8 15:21:48 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Wed Apr 8 15:21:48 2015 -0700
----------------------------------------------------------------------
.../compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8596224e/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index 792287b..c29a9bc 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -517,7 +517,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
}
}
- private void emitBindableVariables(IClassDefinition cdef)
+ public void emitBindableVariables(IClassDefinition cdef)
{
if (bindableVars.size() > 0)
{
@@ -584,7 +584,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
writeNewline(" " + ASEmitterTokens.THIS.getToken() + ASEmitterTokens.MEMBER_ACCESS.getToken()
+ name + "_ = value;");
writeNewline(" this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(");
- writeNewline(" this, \"" + name + "_\", oldValue, value));");
+ writeNewline(" this, \"" + name + "\", oldValue, value));");
writeNewline("}");
write(ASEmitterTokens.BLOCK_CLOSE.getToken());
write(ASEmitterTokens.BLOCK_CLOSE.getToken());
[04/18] git commit: [flex-falcon] [refs/heads/develop] - output
formatted name
Posted by ah...@apache.org.
output formatted name
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/01997dcd
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/01997dcd
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/01997dcd
Branch: refs/heads/develop
Commit: 01997dcdb7929ef8a4dd541da6d3ceff32c4b80f
Parents: 1ac7cf4
Author: Alex Harui <ah...@apache.org>
Authored: Tue Mar 24 22:44:44 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Mar 24 22:44:44 2015 -0700
----------------------------------------------------------------------
.../flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/01997dcd/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
index 28e17f5..6b495b1 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
@@ -660,7 +660,7 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
IClassNode cnode = (IClassNode) node
.getAncestorOfType(IClassNode.class);
- write(cnode.getQualifiedName());
+ write(formatQualifiedName(cnode.getQualifiedName()));
write(ASEmitterTokens.MEMBER_ACCESS);
write(JSGoogEmitterTokens.GOOG_BASE);
write(ASEmitterTokens.PAREN_OPEN);
[03/18] git commit: [flex-falcon] [refs/heads/develop] - add
DEFINE_PROPERTIES
Posted by ah...@apache.org.
add DEFINE_PROPERTIES
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/1ac7cf46
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/1ac7cf46
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/1ac7cf46
Branch: refs/heads/develop
Commit: 1ac7cf4614969d11be2ac884dc8707cfc5c149a3
Parents: 1562c8c
Author: Alex Harui <ah...@apache.org>
Authored: Tue Mar 24 22:44:10 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Mar 24 22:44:10 2015 -0700
----------------------------------------------------------------------
.../apache/flex/compiler/internal/codegen/js/JSEmitterTokens.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1ac7cf46/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitterTokens.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitterTokens.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitterTokens.java
index f12049a..ab8d079 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitterTokens.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitterTokens.java
@@ -27,6 +27,7 @@ public enum JSEmitterTokens implements IEmitterTokens
CONFIGURABLE("configurable"),
CONSTRUCTOR("constructor"),
DEFINE_PROPERTY("defineProperty"),
+ DEFINE_PROPERTIES("defineProperties"),
INTERFACE("interface"),
PROTOTYPE("prototype"),
SLICE("slice");
[17/18] git commit: [flex-falcon] [refs/heads/develop] - don't forget
bindable vars in MXML script blocks
Posted by ah...@apache.org.
don't forget bindable vars in MXML script blocks
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/83c8eb2c
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/83c8eb2c
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/83c8eb2c
Branch: refs/heads/develop
Commit: 83c8eb2c3d0e24332645e40410b508d8b1321da0
Parents: 6e79a10
Author: Alex Harui <ah...@apache.org>
Authored: Wed Apr 8 15:21:26 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Wed Apr 8 15:21:26 2015 -0700
----------------------------------------------------------------------
.../compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/83c8eb2c/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index 55d830a..0104180 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -210,6 +210,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
emitScripts();
+ ((JSFlexJSEmitter)asEmitter).emitBindableVariables(cdef);
((JSFlexJSEmitter)asEmitter).emitASGettersAndSetters(cdef);
emitEvents(cname);
[06/18] git commit: [flex-falcon] [refs/heads/develop] - output
object.defineProperties
Posted by ah...@apache.org.
output object.defineProperties
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/e7deb062
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/e7deb062
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/e7deb062
Branch: refs/heads/develop
Commit: e7deb062a61fc40f95b71f07c6b77ec9b44f3b6d
Parents: f454bff
Author: Alex Harui <ah...@apache.org>
Authored: Tue Mar 24 22:49:48 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Mar 24 22:49:48 2015 -0700
----------------------------------------------------------------------
.../codegen/js/flexjs/JSFlexJSEmitter.java | 382 ++++++++++++++-----
.../js/flexjs/JSFlexJSEmitterTokens.java | 2 +
2 files changed, 280 insertions(+), 104 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e7deb062/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index 37c8045..87a39f2 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -22,10 +22,9 @@ package org.apache.flex.compiler.internal.codegen.js.flexjs;
import java.io.FilterWriter;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
import java.util.Set;
import org.apache.flex.compiler.asdoc.flexjs.ASDocComment;
@@ -44,6 +43,7 @@ import org.apache.flex.compiler.definitions.INamespaceDefinition;
import org.apache.flex.compiler.definitions.IPackageDefinition;
import org.apache.flex.compiler.definitions.ITypeDefinition;
import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSDocEmitterTokens;
import org.apache.flex.compiler.internal.codegen.js.JSEmitterTokens;
import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogEmitter;
import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogEmitterTokens;
@@ -63,7 +63,7 @@ import org.apache.flex.compiler.internal.tree.as.ChainedVariableNode;
import org.apache.flex.compiler.internal.tree.as.ClassNode;
import org.apache.flex.compiler.internal.tree.as.FunctionCallNode;
import org.apache.flex.compiler.internal.tree.as.FunctionNode;
-import org.apache.flex.compiler.internal.tree.as.MemberAccessExpressionNode;
+import org.apache.flex.compiler.internal.tree.as.GetterNode;
import org.apache.flex.compiler.internal.tree.as.ParameterNode;
import org.apache.flex.compiler.internal.tree.as.RegExpLiteralNode;
import org.apache.flex.compiler.internal.tree.as.SetterNode;
@@ -76,7 +76,6 @@ import org.apache.flex.compiler.tree.as.IAccessorNode;
import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
import org.apache.flex.compiler.tree.as.IClassNode;
import org.apache.flex.compiler.tree.as.IDefinitionNode;
-import org.apache.flex.compiler.tree.as.IDynamicAccessNode;
import org.apache.flex.compiler.tree.as.IExpressionNode;
import org.apache.flex.compiler.tree.as.IForLoopNode;
import org.apache.flex.compiler.tree.as.IFunctionCallNode;
@@ -87,7 +86,6 @@ import org.apache.flex.compiler.tree.as.IIdentifierNode;
import org.apache.flex.compiler.tree.as.IInterfaceNode;
import org.apache.flex.compiler.tree.as.ILanguageIdentifierNode;
import org.apache.flex.compiler.tree.as.ILiteralNode;
-import org.apache.flex.compiler.tree.as.IUnaryOperatorNode;
import org.apache.flex.compiler.tree.as.ILiteralNode.LiteralType;
import org.apache.flex.compiler.tree.as.IMemberAccessExpressionNode;
import org.apache.flex.compiler.tree.as.IParameterNode;
@@ -116,6 +114,14 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
public IDefinition thisClass;
+ class PropertyNodes
+ {
+ public IGetterNode getter;
+ public ISetterNode setter;
+ }
+
+ HashMap<String, PropertyNodes> propertyMap = new HashMap<String, PropertyNodes>();
+
@Override
protected String getIndent(int numIndent)
{
@@ -216,6 +222,88 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
write(ASEmitterTokens.SEMICOLON);
}
}
+
+ if (!propertyMap.isEmpty())
+ {
+ write(JSGoogEmitterTokens.OBJECT);
+ write(ASEmitterTokens.MEMBER_ACCESS);
+ write(JSEmitterTokens.DEFINE_PROPERTIES);
+ write(ASEmitterTokens.PAREN_OPEN);
+ String qname = definition.getQualifiedName();
+ write(formatQualifiedName(qname));
+ write(ASEmitterTokens.MEMBER_ACCESS);
+ write(JSEmitterTokens.PROTOTYPE);
+ write(ASEmitterTokens.COMMA);
+ write(ASEmitterTokens.SPACE);
+ writeNewline(ASEmitterTokens.BLOCK_OPEN);
+
+ Set<String> propertyNames = propertyMap.keySet();
+ boolean firstTime = true;
+ for (String propName : propertyNames)
+ {
+ if (firstTime)
+ firstTime = false;
+ else
+ writeNewline(ASEmitterTokens.COMMA);
+
+ PropertyNodes p = propertyMap.get(propName);
+ write(ASEmitterTokens.SINGLE_QUOTE);
+ write(propName);
+ write(ASEmitterTokens.SINGLE_QUOTE);
+ write(ASEmitterTokens.COLON);
+ write(ASEmitterTokens.SPACE);
+ writeNewline(ASEmitterTokens.BLOCK_OPEN);
+ if (p.getter != null)
+ {
+ write(ASEmitterTokens.GET);
+ write(ASEmitterTokens.COLON);
+ write(ASEmitterTokens.SPACE);
+ write(JSDocEmitterTokens.JSDOC_OPEN);
+ write(ASEmitterTokens.SPACE);
+ write(ASEmitterTokens.ATSIGN);
+ write(ASEmitterTokens.THIS);
+ write(ASEmitterTokens.SPACE);
+ write(ASEmitterTokens.BLOCK_OPEN);
+ write(formatQualifiedName(qname));
+ write(ASEmitterTokens.BLOCK_CLOSE);
+ write(ASEmitterTokens.SPACE);
+ write(JSDocEmitterTokens.JSDOC_CLOSE);
+ write(ASEmitterTokens.SPACE);
+ write(ASEmitterTokens.FUNCTION);
+ emitParameters(p.getter.getParameterNodes());
+
+ emitDefinePropertyFunction(p.getter);
+ }
+ if (p.setter != null)
+ {
+ if (p.getter != null)
+ writeNewline(ASEmitterTokens.COMMA);
+
+ write(ASEmitterTokens.SET);
+ write(ASEmitterTokens.COLON);
+ write(ASEmitterTokens.SPACE);
+ write(JSDocEmitterTokens.JSDOC_OPEN);
+ write(ASEmitterTokens.SPACE);
+ write(ASEmitterTokens.ATSIGN);
+ write(ASEmitterTokens.THIS);
+ write(ASEmitterTokens.SPACE);
+ write(ASEmitterTokens.BLOCK_OPEN);
+ write(formatQualifiedName(qname));
+ write(ASEmitterTokens.BLOCK_CLOSE);
+ write(ASEmitterTokens.SPACE);
+ write(JSDocEmitterTokens.JSDOC_CLOSE);
+ write(ASEmitterTokens.SPACE);
+ write(ASEmitterTokens.FUNCTION);
+ emitParameters(p.setter.getParameterNodes());
+
+ emitDefinePropertyFunction(p.setter);
+ }
+ write(ASEmitterTokens.BLOCK_CLOSE);
+ }
+ writeNewline(ASEmitterTokens.BLOCK_CLOSE);
+ write(ASEmitterTokens.PAREN_CLOSE);
+ write(ASEmitterTokens.SEMICOLON);
+ }
}
private void loadImportIgnores(String doc)
@@ -755,9 +843,9 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
}
}
- IDefinition parentDef = (nodeDef != null) ? nodeDef.getParent() : null;
- boolean isNative = (parentDef != null)
- && NativeUtils.isNative(parentDef.getBaseName());
+ //IDefinition parentDef = (nodeDef != null) ? nodeDef.getParent() : null;
+ //boolean isNative = (parentDef != null)
+ // && NativeUtils.isNative(parentDef.getBaseName());
if (emitName)
{
if (nodeDef != null)
@@ -768,7 +856,6 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
}
//--------------------------------------------------------------------------
- /*
@Override
protected void emitSuperCall(IASNode node, String type)
{
@@ -777,110 +864,86 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
IFunctionCallNode fcnode = (node instanceof IFunctionCallNode) ? (FunctionCallNode) node
: null;
- if (type == CONSTRUCTOR_EMPTY)
- {
- indentPush();
- writeNewline();
- indentPop();
- }
- else if (type == SUPER_FUNCTION_CALL)
+ if (type == SUPER_FUNCTION_CALL)
{
if (fnode == null)
fnode = (IFunctionNode) fcnode
.getAncestorOfType(IFunctionNode.class);
- }
- if (fnode != null && fnode.isConstructor() && !hasSuperClass(fnode))
- return;
-
- IClassNode cnode = (IClassNode) node
- .getAncestorOfType(IClassNode.class);
-
- // ToDo (erikdebruin): add VF2JS conditional -> only use check during full SDK compilation
- if (cnode == null)
- return;
-
- write(formatQualifiedName(cnode.getQualifiedName()));
- write(ASEmitterTokens.MEMBER_ACCESS);
- write(JSGoogEmitterTokens.GOOG_BASE);
- write(ASEmitterTokens.PAREN_OPEN);
- write(ASEmitterTokens.THIS);
-
- if (fnode != null && fnode.isConstructor())
- {
- writeToken(ASEmitterTokens.COMMA);
- write(ASEmitterTokens.SINGLE_QUOTE);
- write(JSGoogEmitterTokens.GOOG_CONSTRUCTOR);
- write(ASEmitterTokens.SINGLE_QUOTE);
- }
-
- if (fnode != null && !fnode.isConstructor())
- {
- writeToken(ASEmitterTokens.COMMA);
- write(ASEmitterTokens.SINGLE_QUOTE);
- if (fnode.getNodeID() == ASTNodeID.GetterID
- || fnode.getNodeID() == ASTNodeID.SetterID)
- writeGetSetPrefix(fnode.getNodeID() == ASTNodeID.GetterID);
- write(fnode.getName());
- write(ASEmitterTokens.SINGLE_QUOTE);
- }
-
- IASNode[] anodes = null;
- boolean writeArguments = false;
- if (fcnode != null)
- {
- anodes = fcnode.getArgumentNodes();
-
- writeArguments = anodes.length > 0;
- }
- else if (fnode != null && fnode.isConstructor())
- {
- anodes = fnode.getParameterNodes();
-
- writeArguments = (anodes != null && anodes.length > 0);
- }
- else if (fnode == null && node instanceof BinaryOperatorAssignmentNode)
- {
- BinaryOperatorAssignmentNode bnode = (BinaryOperatorAssignmentNode) node;
-
- IFunctionNode pnode = (IFunctionNode) bnode.getAncestorOfType(IFunctionNode.class);
-
- if (pnode.getNodeID() == ASTNodeID.SetterID)
- {
- writeToken(ASEmitterTokens.COMMA);
- write(ASEmitterTokens.SINGLE_QUOTE);
- writeGetSetPrefix(false);
- getWalker().walk(bnode.getLeftOperandNode());
- write(ASEmitterTokens.SINGLE_QUOTE);
- writeToken(ASEmitterTokens.COMMA);
- getWalker().walk(bnode.getRightOperandNode());
- }
- }
-
- if (writeArguments)
- {
- int len = anodes.length;
- for (int i = 0; i < len; i++)
- {
- writeToken(ASEmitterTokens.COMMA);
-
- getWalker().walk(anodes[i]);
- }
- }
-
- write(ASEmitterTokens.PAREN_CLOSE);
+ if (fnode != null && fnode.isConstructor() && !hasSuperClass(fnode))
+ return;
- if (type == CONSTRUCTOR_FULL)
- {
- write(ASEmitterTokens.SEMICOLON);
- writeNewline();
- }
- else if (type == CONSTRUCTOR_EMPTY)
- {
- write(ASEmitterTokens.SEMICOLON);
+ IClassNode cnode = (IClassNode) node
+ .getAncestorOfType(IClassNode.class);
+
+ // ToDo (erikdebruin): add VF2JS conditional -> only use check during full SDK compilation
+ if (cnode == null)
+ return;
+
+ if (fnode != null && (fnode.getNodeID() == ASTNodeID.GetterID
+ || fnode.getNodeID() == ASTNodeID.SetterID))
+ {
+ write(JSFlexJSEmitterTokens.LANGUAGE_QNAME);
+ write(ASEmitterTokens.MEMBER_ACCESS);
+ if (fnode.getNodeID() == ASTNodeID.GetterID)
+ write(JSFlexJSEmitterTokens.SUPERGETTER);
+ else
+ write(JSFlexJSEmitterTokens.SUPERSETTER);
+ write(ASEmitterTokens.PAREN_OPEN);
+ write(formatQualifiedName(cnode.getQualifiedName()));
+ writeToken(ASEmitterTokens.COMMA);
+ write(ASEmitterTokens.THIS);
+ writeToken(ASEmitterTokens.COMMA);
+ write(ASEmitterTokens.SINGLE_QUOTE);
+ write(fnode.getName());
+ write(ASEmitterTokens.SINGLE_QUOTE);
+
+ IASNode[] anodes = null;
+ boolean writeArguments = false;
+ if (fcnode != null)
+ {
+ anodes = fcnode.getArgumentNodes();
+
+ writeArguments = anodes.length > 0;
+ }
+ else if (fnode != null && fnode.isConstructor())
+ {
+ anodes = fnode.getParameterNodes();
+
+ writeArguments = (anodes != null && anodes.length > 0);
+ }
+ else if (fnode == null && node instanceof BinaryOperatorAssignmentNode)
+ {
+ BinaryOperatorAssignmentNode bnode = (BinaryOperatorAssignmentNode) node;
+
+ IFunctionNode pnode = (IFunctionNode) bnode.getAncestorOfType(IFunctionNode.class);
+
+ if (pnode.getNodeID() == ASTNodeID.SetterID)
+ {
+ writeToken(ASEmitterTokens.COMMA);
+ getWalker().walk(bnode.getRightOperandNode());
+ }
+ }
+
+ if (writeArguments)
+ {
+ int len = anodes.length;
+ for (int i = 0; i < len; i++)
+ {
+ writeToken(ASEmitterTokens.COMMA);
+
+ getWalker().walk(anodes[i]);
+ }
+ }
+
+ write(ASEmitterTokens.PAREN_CLOSE);
+ return;
+ }
}
+ super.emitSuperCall(node, type);
}
+ /*
@Override
protected void emitDefaultParameterCodeBlock(IFunctionNode node)
{
@@ -977,6 +1040,61 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
}
else
{
+ IExpressionNode leftSide = node.getLeftOperandNode();
+ if (leftSide.getNodeID() == ASTNodeID.MemberAccessExpressionID)
+ {
+ IASNode lnode = leftSide.getChild(0);
+ IASNode rnode = leftSide.getChild(1);
+ IDefinition rnodeDef = ((IIdentifierNode) rnode).resolve(getWalker().getProject());
+ if (lnode.getNodeID() == ASTNodeID.SuperID &&
+ rnodeDef instanceof AccessorDefinition)
+ {
+ String op = node.getOperator().getOperatorText();
+ boolean isAssignment = op.contains("=") && !op.contains("==") &&
+ !(op.startsWith("<") ||
+ op.startsWith(">") ||
+ op.startsWith("!"));
+ if (isAssignment)
+ {
+ write(JSFlexJSEmitterTokens.LANGUAGE_QNAME);
+ write(ASEmitterTokens.MEMBER_ACCESS);
+ write(JSFlexJSEmitterTokens.SUPERSETTER);
+ write(ASEmitterTokens.PAREN_OPEN);
+ IClassNode cnode = (IClassNode) node
+ .getAncestorOfType(IClassNode.class);
+ write(formatQualifiedName(cnode.getQualifiedName()));
+ writeToken(ASEmitterTokens.COMMA);
+ write(ASEmitterTokens.THIS);
+ writeToken(ASEmitterTokens.COMMA);
+ write(ASEmitterTokens.SINGLE_QUOTE);
+ write(rnodeDef.getBaseName());
+ write(ASEmitterTokens.SINGLE_QUOTE);
+ writeToken(ASEmitterTokens.COMMA);
+
+ if (op.length() > 1) // += and things like that
+ {
+ write(JSFlexJSEmitterTokens.LANGUAGE_QNAME);
+ write(ASEmitterTokens.MEMBER_ACCESS);
+ write(JSFlexJSEmitterTokens.SUPERSETTER);
+ write(ASEmitterTokens.PAREN_OPEN);
+ write(formatQualifiedName(cnode.getQualifiedName()));
+ writeToken(ASEmitterTokens.COMMA);
+ write(ASEmitterTokens.THIS);
+ writeToken(ASEmitterTokens.COMMA);
+ write(ASEmitterTokens.SINGLE_QUOTE);
+ write(rnodeDef.getBaseName());
+ write(ASEmitterTokens.SINGLE_QUOTE);
+ write(ASEmitterTokens.PAREN_CLOSE);
+ write(op.substring(0, 1));
+ }
+
+ getWalker().walk(node.getRightOperandNode());
+ write(ASEmitterTokens.PAREN_CLOSE);
+ return;
+ }
+ }
+ }
+
super.emitBinaryOperator(node);
/*
IExpressionNode leftSide = node.getLeftOperandNode();
@@ -1112,6 +1230,9 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
@Override
public void emitMemberAccessExpression(IMemberAccessExpressionNode node)
{
+ if (ASNodeUtils.hasParenOpen(node))
+ write(ASEmitterTokens.PAREN_OPEN);
+
IASNode leftNode = node.getLeftOperandNode();
IASNode rightNode = node.getRightOperandNode();
@@ -1162,6 +1283,25 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
getWalker().walk(node.getLeftOperandNode());
write(node.getOperator().getOperatorText());
}
+ else if (leftNode.getNodeID() == ASTNodeID.SuperID &&
+ rightNode.getNodeID() == ASTNodeID.GetterID)
+ {
+ // setter is handled in binaryOperator
+ write(JSFlexJSEmitterTokens.LANGUAGE_QNAME);
+ write(ASEmitterTokens.MEMBER_ACCESS);
+ write(JSFlexJSEmitterTokens.SUPERGETTER);
+ write(ASEmitterTokens.PAREN_OPEN);
+ IClassNode cnode = (IClassNode) node
+ .getAncestorOfType(IClassNode.class);
+ write(formatQualifiedName(cnode.getQualifiedName()));
+ writeToken(ASEmitterTokens.COMMA);
+ write(ASEmitterTokens.THIS);
+ writeToken(ASEmitterTokens.COMMA);
+ write(ASEmitterTokens.SINGLE_QUOTE);
+ write(((GetterNode)rightNode).getName());
+ write(ASEmitterTokens.SINGLE_QUOTE);
+ continueWalk = false;
+ }
}
else
{
@@ -1173,6 +1313,9 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
if (continueWalk)
getWalker().walk(node.getRightOperandNode());
+
+ if (ASNodeUtils.hasParenClose(node))
+ write(ASEmitterTokens.PAREN_CLOSE);
}
/*
@@ -1193,6 +1336,37 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
*/
@Override
+ public void emitGetAccessor(IGetterNode node)
+ {
+ String name = node.getName();
+ PropertyNodes p = propertyMap.get(name);
+ if (p == null)
+ {
+ p = new PropertyNodes();
+ propertyMap.put(name, p);
+ }
+ p.getter = node;
+ FunctionNode fn = (FunctionNode) node;
+ fn.parseFunctionBody(getProblems());
+ }
+
+ @Override
+ public void emitSetAccessor(ISetterNode node)
+ {
+ String name = node.getName();
+ PropertyNodes p = propertyMap.get(name);
+ if (p == null)
+ {
+ p = new PropertyNodes();
+ propertyMap.put(name, p);
+ }
+ p.setter = node;
+ FunctionNode fn = (FunctionNode) node;
+ fn.parseFunctionBody(getProblems());
+
+ }
+
+ @Override
protected void emitObjectDefineProperty(IAccessorNode node)
{
FunctionNode fn = (FunctionNode) node;
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e7deb062/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitterTokens.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitterTokens.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitterTokens.java
index ea99061..1bb2356 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitterTokens.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitterTokens.java
@@ -40,6 +40,8 @@ public enum JSFlexJSEmitterTokens implements IEmitterTokens
PREDECREMENT("predecrement"),
POSTINCREMENT("postincrement"),
POSTDECREMENT("postdecrement"),
+ SUPERGETTER("superGetter"),
+ SUPERSETTER("superSetter"),
;
private String token;
[08/18] git commit: [flex-falcon] [refs/heads/develop] - need
formatting of interface names
Posted by ah...@apache.org.
need formatting of interface names
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/57161bd8
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/57161bd8
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/57161bd8
Branch: refs/heads/develop
Commit: 57161bd83fd9eb1d7a12fff4dc04ffda04372805
Parents: 8e68d5d
Author: Alex Harui <ah...@apache.org>
Authored: Sat Mar 28 07:12:39 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Sat Mar 28 07:12:39 2015 -0700
----------------------------------------------------------------------
.../flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/57161bd8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
index 6b495b1..58cc59f 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
@@ -262,7 +262,7 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
String qname = node.getQualifiedName();
if (qname != null && !qname.equals(""))
{
- write(qname);
+ write(formatQualifiedName(qname));
write(ASEmitterTokens.SPACE);
writeToken(ASEmitterTokens.EQUAL);
write(ASEmitterTokens.FUNCTION);
@@ -285,7 +285,7 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
{
writeNewline();
- write(qname);
+ write(formatQualifiedName(qname));
write(ASEmitterTokens.MEMBER_ACCESS);
write(JSEmitterTokens.PROTOTYPE);
write(ASEmitterTokens.MEMBER_ACCESS);
[05/18] git commit: [flex-falcon] [refs/heads/develop] - handle
parens around unary operators as well
Posted by ah...@apache.org.
handle parens around unary operators as well
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/f454bff0
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/f454bff0
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/f454bff0
Branch: refs/heads/develop
Commit: f454bff0a4c91af4905487c6d044d6f105849599
Parents: 01997dc
Author: Alex Harui <ah...@apache.org>
Authored: Tue Mar 24 22:45:38 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Mar 24 22:45:38 2015 -0700
----------------------------------------------------------------------
.../apache/flex/compiler/internal/codegen/as/ASEmitter.java | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f454bff0/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
index 9214d39..b7db495 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
@@ -1377,6 +1377,9 @@ public class ASEmitter implements IASEmitter, IEmitter
@Override
public void emitUnaryOperator(IUnaryOperatorNode node)
{
+ if (ASNodeUtils.hasParenOpen(node))
+ write(ASEmitterTokens.PAREN_OPEN);
+
if (node.getNodeID() == ASTNodeID.Op_PreIncrID
|| node.getNodeID() == ASTNodeID.Op_PreDecrID
|| node.getNodeID() == ASTNodeID.Op_BitwiseNotID
@@ -1417,6 +1420,9 @@ public class ASEmitter implements IASEmitter, IEmitter
getWalker().walk(node.getOperandNode());
write(ASEmitterTokens.PAREN_CLOSE);
}
+
+ if (ASNodeUtils.hasParenClose(node))
+ write(ASEmitterTokens.PAREN_CLOSE);
}
@Override
[15/18] git commit: [flex-falcon] [refs/heads/develop] - merge
defineProp work into develop branch. FLEX-34771 breaks and will be fixed in
next commit
Posted by ah...@apache.org.
merge defineProp work into develop branch. FLEX-34771 breaks and will be fixed in next commit
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/4d501de5
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/4d501de5
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/4d501de5
Branch: refs/heads/develop
Commit: 4d501de58344108b8e910e122febbdde2f4f45c9
Parents: c899a8d b974c9a
Author: Alex Harui <ah...@apache.org>
Authored: Wed Apr 8 08:00:36 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Wed Apr 8 08:00:36 2015 -0700
----------------------------------------------------------------------
.../js/flexjs/TestFlexJSAccessorMembers.java | 71 +-
.../codegen/js/flexjs/TestFlexJSAccessors.java | 8 +-
.../codegen/js/flexjs/TestFlexJSClass.java | 8 +-
.../js/flexjs/TestFlexJSExpressions.java | 50 +-
.../codegen/js/flexjs/TestFlexJSInterface.java | 6 +-
.../internal/codegen/js/goog/TestGoogClass.java | 14 +-
.../codegen/js/goog/TestGoogEmiter.java | 2 +-
.../flexjs/files/FlexJSTest_again_result.js | 92 +-
.../flexjs/files/MyInitialView_result.js | 411 ++++-----
.../files/controllers/MyController_result.js | 18 +-
.../flexjs/files/models/MyModel_result.js | 55 +-
.../projects/interfaces/interfaces/IE_result.js | 20 +-
.../flexjs/projects/super/Base_result.js | 29 +-
.../flexjs/projects/super/Super_result.js | 25 +-
.../test-files/goog/files/call-super_result.js | 4 +-
.../test-files/goog/files/output.js | 2 +-
.../test-files/goog/files/poc_result.js | 2 +-
.../goog/files/qualify-new-object_result.js | 2 +-
.../compiler/internal/codegen/as/ASEmitter.java | 6 +
.../internal/codegen/js/JSEmitterTokens.java | 1 +
.../codegen/js/flexjs/JSFlexJSEmitter.java | 913 ++++++++++++-------
.../js/flexjs/JSFlexJSEmitterTokens.java | 2 +
.../internal/codegen/js/goog/JSGoogEmitter.java | 34 +-
.../codegen/mxml/flexjs/MXMLFlexJSEmitter.java | 92 +-
.../mxml/flexjs/MXMLFlexJSPublisher.java | 56 +-
.../compiler/internal/graph/GoogDepsWriter.java | 156 +++-
.../apache/flex/compiler/utils/ASNodeUtils.java | 5 +-
.../utils/JSClosureCompilerWrapper.java | 17 +-
.../utils/VF2JSClosureCompilerWrapper.java | 2 +-
29 files changed, 1247 insertions(+), 856 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4d501de5/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --cc compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index 7968c21,51a3510..d78c83f
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@@ -752,107 -948,10 +949,11 @@@ public class JSFlexJSEmitter extends JS
}
}
- IDefinition parentDef = (nodeDef != null) ? nodeDef.getParent() : null;
- boolean isNative = (parentDef != null)
- && NativeUtils.isNative(parentDef.getBaseName());
- if ((identifierIsAccessorFunction && !isNative)
- || (nodeDef instanceof VariableDefinition && ((VariableDefinition) nodeDef)
- .isBindable()))
- {
- IASNode anode = node
- .getAncestorOfType(BinaryOperatorAssignmentNode.class);
-
- boolean isAssignment = false;
- if (anode != null)
- {
- IASNode leftNode = anode.getChild(0);
- if (anode == parentNode)
- {
- if (node == leftNode)
- isAssignment = true;
- }
- else
- {
- IASNode pnode = parentNode;
- IASNode thisNode = node;
- while (anode != pnode)
- {
- if (pnode instanceof IMemberAccessExpressionNode)
- {
- if (thisNode != pnode.getChild(1))
- {
- // can't be an assignment because
- // we're on the left side of a memberaccessexpression
- break;
- }
- }
- if (pnode instanceof IDynamicAccessNode)
- {
- if (thisNode != pnode.getChild(1))
- {
- // can't be an assignment because
- // we're on the left side of a DynamicAccessNode
- break;
- }
- }
- if (pnode == leftNode)
- {
- isAssignment = true;
- }
- thisNode = pnode;
- pnode = pnode.getParent();
- }
- }
- String op = ((IBinaryOperatorNode) anode).getOperator()
- .getOperatorText();
- if (op.contains("==") || !op.contains("="))
- isAssignment = false;
- }
-
- if (parentNode.getNodeID() == ASTNodeID.MemberAccessExpressionID
- && parentNode.getChild(0).getNodeID() == ASTNodeID.SuperID)
- {
- IClassNode cnode = (IClassNode) node
- .getAncestorOfType(IClassNode.class);
-
- // ToDo (erikdebruin): add VF2JS conditional -> only use check during full SDK compilation
- if (cnode == null && MXMLJSC.jsOutputType == JSOutputType.VF2JS)
- return;
-
- if (cnode == null && thisClass != null)
- write(formatQualifiedName(thisClass.getQualifiedName()));
- else
- write(formatQualifiedName(cnode.getQualifiedName()));
- write(ASEmitterTokens.MEMBER_ACCESS);
- write(JSGoogEmitterTokens.GOOG_BASE);
- write(ASEmitterTokens.PAREN_OPEN);
- write(ASEmitterTokens.THIS);
- writeToken(ASEmitterTokens.COMMA);
- write(ASEmitterTokens.SINGLE_QUOTE);
- writeGetSetPrefix(!isAssignment);
- write(nodeDef.getQualifiedName());
- write(ASEmitterTokens.SINGLE_QUOTE);
- if (isAssignment)
- {
- writeToken(ASEmitterTokens.COMMA);
- }
- }
- else
- {
- writeGetSetPrefix(!isAssignment);
- write(node.getName());
- write(ASEmitterTokens.PAREN_OPEN);
- }
+
- if (anode != null && isAssignment)
- {
- getWalker().walk(((BinaryOperatorAssignmentNode) anode)
- .getRightOperandNode());
- }
-
- write(ASEmitterTokens.PAREN_CLOSE);
- }
- else if (emitName)
+ //IDefinition parentDef = (nodeDef != null) ? nodeDef.getParent() : null;
+ //boolean isNative = (parentDef != null)
+ // && NativeUtils.isNative(parentDef.getBaseName());
+ if (emitName)
{
if (nodeDef != null)
write(formatQualifiedName(nodeDef.getQualifiedName()));
@@@ -882,102 -974,81 +976,84 @@@
if (fnode == null)
fnode = (IFunctionNode) fcnode
.getAncestorOfType(IFunctionNode.class);
- }
-
- if (fnode != null && fnode.isConstructor() && !hasSuperClass(fnode))
- return;
-
- IClassNode cnode = (IClassNode) node
- .getAncestorOfType(IClassNode.class);
- // ToDo (erikdebruin): add VF2JS conditional -> only use check during full SDK compilation
- if (cnode == null && MXMLJSC.jsOutputType == JSOutputType.VF2JS)
- return;
-
- if (cnode == null && thisClass != null)
- write(formatQualifiedName(thisClass.getQualifiedName()));
- else
- write(formatQualifiedName(cnode.getQualifiedName()));
- write(ASEmitterTokens.MEMBER_ACCESS);
- write(JSGoogEmitterTokens.GOOG_BASE);
- write(ASEmitterTokens.PAREN_OPEN);
- write(ASEmitterTokens.THIS);
-
- if (fnode != null && fnode.isConstructor())
- {
- writeToken(ASEmitterTokens.COMMA);
- write(ASEmitterTokens.SINGLE_QUOTE);
- write(JSGoogEmitterTokens.GOOG_CONSTRUCTOR);
- write(ASEmitterTokens.SINGLE_QUOTE);
- }
-
- if (fnode != null && !fnode.isConstructor())
- {
- writeToken(ASEmitterTokens.COMMA);
- write(ASEmitterTokens.SINGLE_QUOTE);
- if (fnode.getNodeID() == ASTNodeID.GetterID
- || fnode.getNodeID() == ASTNodeID.SetterID)
- writeGetSetPrefix(fnode.getNodeID() == ASTNodeID.GetterID);
- write(fnode.getName());
- write(ASEmitterTokens.SINGLE_QUOTE);
- }
-
- IASNode[] anodes = null;
- boolean writeArguments = false;
- if (fcnode != null)
- {
- anodes = fcnode.getArgumentNodes();
-
- writeArguments = anodes.length > 0;
- }
- else if (fnode != null && fnode.isConstructor())
- {
- anodes = fnode.getParameterNodes();
-
- writeArguments = (anodes != null && anodes.length > 0);
- }
- else if (fnode == null && node instanceof BinaryOperatorAssignmentNode)
- {
- BinaryOperatorAssignmentNode bnode = (BinaryOperatorAssignmentNode) node;
-
- IFunctionNode pnode = (IFunctionNode) bnode.getAncestorOfType(IFunctionNode.class);
-
- if (pnode.getNodeID() == ASTNodeID.SetterID)
- {
- writeToken(ASEmitterTokens.COMMA);
- write(ASEmitterTokens.SINGLE_QUOTE);
- writeGetSetPrefix(false);
- getWalker().walk(bnode.getLeftOperandNode());
- write(ASEmitterTokens.SINGLE_QUOTE);
- writeToken(ASEmitterTokens.COMMA);
- getWalker().walk(bnode.getRightOperandNode());
- }
- }
-
- if (writeArguments)
- {
- int len = anodes.length;
- for (int i = 0; i < len; i++)
- {
- writeToken(ASEmitterTokens.COMMA);
-
- getWalker().walk(anodes[i]);
- }
- }
-
- write(ASEmitterTokens.PAREN_CLOSE);
+ if (fnode != null && fnode.isConstructor() && !hasSuperClass(fnode))
+ return;
- if (type == CONSTRUCTOR_FULL)
- {
- write(ASEmitterTokens.SEMICOLON);
- writeNewline();
- }
- else if (type == CONSTRUCTOR_EMPTY)
- {
- write(ASEmitterTokens.SEMICOLON);
+ IClassNode cnode = (IClassNode) node
+ .getAncestorOfType(IClassNode.class);
+
+ // ToDo (erikdebruin): add VF2JS conditional -> only use check during full SDK compilation
- if (cnode == null)
++ if (cnode == null && MXMLJSC.jsOutputType == JSOutputType.VF2JS)
+ return;
+
+ if (fnode != null && (fnode.getNodeID() == ASTNodeID.GetterID
+ || fnode.getNodeID() == ASTNodeID.SetterID))
+ {
+ write(JSFlexJSEmitterTokens.LANGUAGE_QNAME);
+ write(ASEmitterTokens.MEMBER_ACCESS);
+ if (fnode.getNodeID() == ASTNodeID.GetterID)
+ write(JSFlexJSEmitterTokens.SUPERGETTER);
+ else
+ write(JSFlexJSEmitterTokens.SUPERSETTER);
+ write(ASEmitterTokens.PAREN_OPEN);
- write(formatQualifiedName(cnode.getQualifiedName()));
++ if (cnode == null && thisClass != null)
++ write(formatQualifiedName(thisClass.getQualifiedName()));
++ else
++ write(formatQualifiedName(cnode.getQualifiedName()));
+ writeToken(ASEmitterTokens.COMMA);
+ write(ASEmitterTokens.THIS);
+ writeToken(ASEmitterTokens.COMMA);
+ write(ASEmitterTokens.SINGLE_QUOTE);
+ write(fnode.getName());
+ write(ASEmitterTokens.SINGLE_QUOTE);
+
+ IASNode[] anodes = null;
+ boolean writeArguments = false;
+ if (fcnode != null)
+ {
+ anodes = fcnode.getArgumentNodes();
+
+ writeArguments = anodes.length > 0;
+ }
+ else if (fnode != null && fnode.isConstructor())
+ {
+ anodes = fnode.getParameterNodes();
+
+ writeArguments = (anodes != null && anodes.length > 0);
+ }
+ else if (fnode == null && node instanceof BinaryOperatorAssignmentNode)
+ {
+ BinaryOperatorAssignmentNode bnode = (BinaryOperatorAssignmentNode) node;
+
+ IFunctionNode pnode = (IFunctionNode) bnode.getAncestorOfType(IFunctionNode.class);
+
+ if (pnode.getNodeID() == ASTNodeID.SetterID)
+ {
+ writeToken(ASEmitterTokens.COMMA);
+ getWalker().walk(bnode.getRightOperandNode());
+ }
+ }
+
+ if (writeArguments)
+ {
+ int len = anodes.length;
+ for (int i = 0; i < len; i++)
+ {
+ writeToken(ASEmitterTokens.COMMA);
+
+ getWalker().walk(anodes[i]);
+ }
+ }
+
+ write(ASEmitterTokens.PAREN_CLOSE);
+ return;
+ }
}
+ super.emitSuperCall(node, type);
}
-
+
+ /*
@Override
protected void emitDefaultParameterCodeBlock(IFunctionNode node)
{
[10/18] git commit: [flex-falcon] [refs/heads/develop] - new GCC will
figure out deps for you
Posted by ah...@apache.org.
new GCC will figure out deps for you
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/7328a52e
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/7328a52e
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/7328a52e
Branch: refs/heads/develop
Commit: 7328a52e600a438ff7c23ed30efcd26688391b67
Parents: 01fc34f
Author: Alex Harui <ah...@apache.org>
Authored: Sat Mar 28 07:13:50 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Sat Mar 28 07:13:50 2015 -0700
----------------------------------------------------------------------
.../mxml/flexjs/MXMLFlexJSPublisher.java | 25 ++++++++++----------
.../compiler/internal/graph/GoogDepsWriter.java | 15 ++++++++----
2 files changed, 24 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7328a52e/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
index 6e1c7eb..1d1b542 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
@@ -92,6 +92,7 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements
private boolean isMarmotinniRun;
private String outputPathParameter;
private boolean useStrictPublishing;
+ private String closureLibDirPath;
@Override
public File getOutputFolder()
@@ -166,7 +167,6 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements
// If the closure-lib parameter is empty we'll try to find the resources
// in the classpath, dump its content to the output directory and use this
// as closure-lib parameter.
- final String closureLibDirPath;
if(((JSGoogConfiguration) configuration).isClosureLibSet()) {
closureLibDirPath = ((JSGoogConfiguration) configuration).getClosureLib();
} else {
@@ -245,8 +245,8 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements
+ "/closure/goog/";
final String closureGoogTgtLibDirPath = intermediateDirPath
+ "/library/closure/goog";
- final String depsSrcFilePath = intermediateDirPath
- + "/library/closure/goog/deps.js";
+ //final String depsSrcFilePath = intermediateDirPath
+ // + "/library/closure/goog/deps.js";
final String depsTgtFilePath = intermediateDirPath + "/deps.js";
final String projectIntermediateJSFilePath = intermediateDirPath
+ File.separator + outputFileName;
@@ -256,17 +256,18 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements
appendExportSymbol(projectIntermediateJSFilePath, projectName);
appendEncodedCSS(projectIntermediateJSFilePath, projectName);
- if (!subsetGoog)
- {
+ //if (!subsetGoog)
+ //{
// (erikdebruin) We need to leave the 'goog' files and dependencies well
// enough alone. We copy the entire library over so the
// 'goog' dependencies will resolve without our help.
FileUtils.copyDirectory(new File(closureGoogSrcLibDirPath), new File(closureGoogTgtLibDirPath));
- }
+ //}
JSClosureCompilerWrapper compilerWrapper = new JSClosureCompilerWrapper();
GoogDepsWriter gdw = new GoogDepsWriter(intermediateDir, projectName, (JSGoogConfiguration) configuration);
+ StringBuilder depsFileData = new StringBuilder();
try
{
ArrayList<String> fileList = gdw.getListOfFiles();
@@ -274,9 +275,8 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements
{
compilerWrapper.addJSSourceFile(file);
}
- /*
- StringBuilder depsFileData = new StringBuilder();
ok = gdw.generateDeps(problems, depsFileData);
+ /*
if (!subsetGoog)
{
writeFile(depsTgtFilePath, depsFileData.toString(), false);
@@ -384,10 +384,10 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements
FileUtils.copyDirectory(srcDir, intermediateDir, subdirs);
FileUtils.copyDirectory(srcDir, releaseDir, subdirs);
- File srcDeps = new File(depsSrcFilePath);
+ //File srcDeps = new File(depsSrcFilePath);
- writeHTML("intermediate", projectName, intermediateDirPath, gdw.additionalHTML);
- writeHTML("release", projectName, releaseDirPath, gdw.additionalHTML);
+ writeHTML("intermediate", projectName, intermediateDirPath, depsFileData.toString(), gdw.additionalHTML);
+ writeHTML("release", projectName, releaseDirPath, null, gdw.additionalHTML);
writeCSS(projectName, intermediateDirPath);
writeCSS(projectName, releaseDirPath);
@@ -549,7 +549,7 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements
return code;
}
- private void writeHTML(String type, String projectName, String dirPath, List<String> additionalHTML)
+ private void writeHTML(String type, String projectName, String dirPath, String deps, List<String> additionalHTML)
throws IOException
{
StringBuilder htmlFile = new StringBuilder();
@@ -567,6 +567,7 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements
{
htmlFile.append("\t<script type=\"text/javascript\" src=\"./library/closure/goog/base.js\"></script>\n");
htmlFile.append("\t<script type=\"text/javascript\">\n");
+ htmlFile.append(deps);
htmlFile.append("\t\tgoog.require(\"");
htmlFile.append(projectName);
htmlFile.append("\");\n");
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7328a52e/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java b/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
index cd036be..617f87d 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
@@ -53,13 +53,17 @@ public class GoogDepsWriter {
private String mainName;
private List<String> otherPaths;
private boolean problemsFound = false;
+ private ArrayList<GoogDep> dps;
private HashMap<String,GoogDep> depMap = new HashMap<String,GoogDep>();
public ArrayList<String> getListOfFiles() throws InterruptedException
{
- buildDB();
- ArrayList<GoogDep> dps = sort(mainName);
+ if (dps == null)
+ {
+ buildDB();
+ dps = sort(mainName);
+ }
ArrayList<String> files = new ArrayList<String>();
for (GoogDep gd : dps)
{
@@ -72,8 +76,11 @@ public class GoogDepsWriter {
{
problemsFound = false;
this.problems = problems;
- buildDB();
- ArrayList<GoogDep> dps = sort(mainName);
+ if (dps == null)
+ {
+ buildDB();
+ dps = sort(mainName);
+ }
String outString = "// generated by FalconJS" + "\n";
int n = dps.size();
for (int i = n - 1; i >= 0; i--)
[14/18] git commit: [flex-falcon] [refs/heads/develop] - adjust the
tests for defineProp
Posted by ah...@apache.org.
adjust the tests for defineProp
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/b974c9aa
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/b974c9aa
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/b974c9aa
Branch: refs/heads/develop
Commit: b974c9aa4c8ce0337500e2036a369e217375dc47
Parents: 8eefb00
Author: Alex Harui <ah...@apache.org>
Authored: Tue Apr 7 21:12:03 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Apr 7 21:12:03 2015 -0700
----------------------------------------------------------------------
.../js/flexjs/TestFlexJSAccessorMembers.java | 71 ++--
.../codegen/js/flexjs/TestFlexJSAccessors.java | 8 +-
.../codegen/js/flexjs/TestFlexJSClass.java | 8 +-
.../js/flexjs/TestFlexJSExpressions.java | 50 +--
.../codegen/js/flexjs/TestFlexJSInterface.java | 6 +-
.../internal/codegen/js/goog/TestGoogClass.java | 14 +-
.../codegen/js/goog/TestGoogEmiter.java | 2 +-
.../flexjs/files/FlexJSTest_again_result.js | 92 ++---
.../flexjs/files/MyInitialView_result.js | 411 ++++++++-----------
.../files/controllers/MyController_result.js | 18 +-
.../flexjs/files/models/MyModel_result.js | 55 ++-
.../projects/interfaces/interfaces/IE_result.js | 20 +-
.../flexjs/projects/super/Base_result.js | 29 +-
.../flexjs/projects/super/Super_result.js | 25 +-
.../test-files/goog/files/call-super_result.js | 4 +-
.../test-files/goog/files/output.js | 2 +-
.../test-files/goog/files/poc_result.js | 2 +-
.../goog/files/qualify-new-object_result.js | 2 +-
.../codegen/js/flexjs/JSFlexJSEmitter.java | 78 +++-
.../internal/codegen/js/goog/JSGoogEmitter.java | 9 +-
20 files changed, 458 insertions(+), 448 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b974c9aa/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java
index 0d40229..09bf25c 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java
@@ -22,6 +22,7 @@ package org.apache.flex.compiler.internal.codegen.js.flexjs;
import org.apache.flex.compiler.driver.IBackend;
import org.apache.flex.compiler.internal.codegen.js.goog.TestGoogAccessorMembers;
import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend;
+import org.apache.flex.compiler.tree.as.IClassNode;
import org.apache.flex.compiler.tree.as.IGetterNode;
import org.apache.flex.compiler.tree.as.ISetterNode;
import org.junit.Test;
@@ -35,90 +36,100 @@ public class TestFlexJSAccessorMembers extends TestGoogAccessorMembers
@Test
public void testGetAccessor()
{
- IGetterNode node = (IGetterNode) getAccessor("function get foo():int{}");
- asBlockWalker.visitGetter(node);
- assertOut("/**\n * @return {number}\n */\nFalconTest_A.prototype.get_foo = function() {\n}");
+ IClassNode node = (IClassNode) getNode("function get foo():int{}",
+ IClassNode.class, WRAP_LEVEL_CLASS);
+ asBlockWalker.visitClass(node);
+ assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @expose\n * @type {number}\n */\nFalconTest_A.prototype.foo;\n\n;Object.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @expose */\nfoo: {\nget: /** @this {FalconTest_A} */ function() {\n}}}\n);");
}
@Override
@Test
public void testGetAccessor_withBody()
{
- IGetterNode node = (IGetterNode) getAccessor("function get foo():int{return -1;}");
- asBlockWalker.visitGetter(node);
- assertOut("/**\n * @return {number}\n */\nFalconTest_A.prototype.get_foo = function() {\n return -1;\n}");
+ IClassNode node = (IClassNode) getNode("function get foo():int{return -1;}",
+ IClassNode.class, WRAP_LEVEL_CLASS);
+ asBlockWalker.visitClass(node);
+ assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @expose\n * @type {number}\n */\nFalconTest_A.prototype.foo;\n\n;Object.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @expose */\nfoo: {\nget: /** @this {FalconTest_A} */ function() {\n return -1;\n}}}\n);");
}
@Override
@Test
public void testGetAccessor_withNamespace()
{
- IGetterNode node = (IGetterNode) getAccessor("public function get foo():int{return -1;}");
- asBlockWalker.visitGetter(node);
- assertOut("/**\n * @expose\n * @return {number}\n */\nFalconTest_A.prototype.get_foo = function() {\n return -1;\n}");
+ IClassNode node = (IClassNode) getNode("public function get foo():int{return -1;}",
+ IClassNode.class, WRAP_LEVEL_CLASS);
+ asBlockWalker.visitClass(node);
+ assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @expose\n * @type {number}\n */\nFalconTest_A.prototype.foo;\n\n;Object.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @expose */\nfoo: {\nget: /** @this {FalconTest_A} */ function() {\n return -1;\n}}}\n);");
}
@Override
@Test
public void testGetAccessor_withNamespaceOverride()
{
- IGetterNode node = (IGetterNode) getAccessor("public override function get foo():int{super.foo(); return -1;}");
- asBlockWalker.visitGetter(node);
- assertOut("/**\n * @expose\n * @return {number}\n * @override\n */\nFalconTest_A.prototype.get_foo = function() {\n FalconTest_A.base(this, 'get_foo');\n return -1;\n}");
+ IClassNode node = (IClassNode) getNode("public override function get foo():int{super.foo(); return -1;}",
+ IClassNode.class, WRAP_LEVEL_CLASS);
+ asBlockWalker.visitClass(node);
+ assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @expose\n * @type {number}\n */\nFalconTest_A.prototype.foo;\n\n;Object.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @expose */\nfoo: {\nget: /** @this {FalconTest_A} */ function() {\n org_apache_flex_utils_Language.superGetter(FalconTest_A, this, 'foo');\n return -1;\n}}}\n);");
}
@Override
@Test
public void testGetAccessor_withStatic()
{
- IGetterNode node = (IGetterNode) getAccessor("public static function get foo():int{return -1;}");
- asBlockWalker.visitGetter(node);
- assertOut("/**\n * @expose\n * @return {number}\n */\nFalconTest_A.get_foo = function() {\n return -1;\n}");
+ IClassNode node = (IClassNode) getNode("public static function get foo():int{return -1;}",
+ IClassNode.class, WRAP_LEVEL_CLASS);
+ asBlockWalker.visitClass(node);
+ assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @expose\n * @type {number}\n */\nFalconTest_A.foo;\n\n;Object.defineProperties(FalconTest_A, /** @lends {FalconTest_A} */ {\n/** @expose */\nfoo: {\nget: function() {\n return -1;\n}}}\n);");
}
@Override
@Test
public void testSetAccessor()
{
- ISetterNode node = (ISetterNode) getAccessor("function set foo(value:int):void{}");
- asBlockWalker.visitSetter(node);
- assertOut("/**\n * @param {number} value\n */\nFalconTest_A.prototype.set_foo = function(value) {\n}");
+ IClassNode node = (IClassNode) getNode("function set foo(value:int):void{}",
+ IClassNode.class, WRAP_LEVEL_CLASS);
+ asBlockWalker.visitClass(node);
+ assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @expose\n * @type {number}\n */\nFalconTest_A.prototype.foo;\n\n;Object.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @expose */\nfoo: {\nset: /** @this {FalconTest_A} */ function(value) {\n}}}\n);");
}
@Override
@Test
public void testSetAccessor_withBody()
{
- ISetterNode node = (ISetterNode) getAccessor("function set foo(value:int):void{fetch('haai');}");
- asBlockWalker.visitSetter(node);
- assertOut("/**\n * @param {number} value\n */\nFalconTest_A.prototype.set_foo = function(value) {\n fetch('haai');\n}");
+ IClassNode node = (IClassNode) getNode("function set foo(value:int):void{fetch('haai');}",
+ IClassNode.class, WRAP_LEVEL_CLASS);
+ asBlockWalker.visitClass(node);
+ assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @expose\n * @type {number}\n */\nFalconTest_A.prototype.foo;\n\n;Object.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @expose */\nfoo: {\nset: /** @this {FalconTest_A} */ function(value) {\n fetch('haai');\n}}}\n);");
}
@Override
@Test
public void testSetAccessor_withNamespace()
{
- ISetterNode node = (ISetterNode) getAccessor("public function set foo(value:int):void{}");
- asBlockWalker.visitSetter(node);
- assertOut("/**\n * @expose\n * @param {number} value\n */\nFalconTest_A.prototype.set_foo = function(value) {\n}");
+ IClassNode node = (IClassNode) getNode("public function set foo(value:int):void{}",
+ IClassNode.class, WRAP_LEVEL_CLASS);
+ asBlockWalker.visitClass(node);
+ assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @expose\n * @type {number}\n */\nFalconTest_A.prototype.foo;\n\n;Object.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @expose */\nfoo: {\nset: /** @this {FalconTest_A} */ function(value) {\n}}}\n);");
}
@Override
@Test
public void testSetAccessor_withNamespaceOverride()
{
- ISetterNode node = (ISetterNode) getAccessor("public override function set foo(value:int):void{super.foo();}");
- asBlockWalker.visitSetter(node);
- assertOut("/**\n * @expose\n * @param {number} value\n * @override\n */\nFalconTest_A.prototype.set_foo = function(value) {\n FalconTest_A.base(this, 'set_foo');\n}");
+ IClassNode node = (IClassNode) getNode("public class B extends A { public override function set foo(value:int):void {super.foo = value;} }; public class A extends B { public override set foo(value:int):void{}}",
+ IClassNode.class, WRAP_LEVEL_PACKAGE);
+ asBlockWalker.visitClass(node);
+ assertOut("/**\n * @constructor\n * @extends {A}\n */\nB = function() {\n B.base(this, 'constructor');\n};\ngoog.inherits(B, A);\n\n\n/**\n * @expose\n * @type {number}\n */\nB.prototype.foo;\n\n;Object.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/** @expose */\nfoo: {\nset: /** @this {B} */ function(value) {\n org_apache_flex_utils_Language.superSetter(B, this, 'foo', value);\n}}}\n);");
}
@Override
@Test
public void testSetAccessor_withStatic()
{
- ISetterNode node = (ISetterNode) getAccessor("public static function set foo(value:int):void{}");
- asBlockWalker.visitSetter(node);
- assertOut("/**\n * @expose\n * @param {number} value\n */\nFalconTest_A.set_foo = function(value) {\n}");
+ IClassNode node = (IClassNode) getNode("public static function set foo(value:int):void{}",
+ IClassNode.class, WRAP_LEVEL_CLASS);
+ asBlockWalker.visitClass(node);
+ assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @expose\n * @type {number}\n */\nFalconTest_A.foo;\n\n;Object.defineProperties(FalconTest_A, /** @lends {FalconTest_A} */ {\n/** @expose */\nfoo: {\nset: function(value) {\n}}}\n);");
}
@Override
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b974c9aa/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessors.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessors.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessors.java
index d6e6a28..2844dcc 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessors.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessors.java
@@ -38,7 +38,7 @@ public class TestFlexJSAccessors extends ASTestBase
"public function doStuff():void {label = 'hello, bye'; var theLabel:String = label;}; private var _label:String; public function get label():String {return _label}; public function set label(value:String):void {_label = value}; ",
IClassNode.class, WRAP_LEVEL_CLASS);
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @expose\n */\nFalconTest_A.prototype.doStuff = function() {\n this.set_label('hello, bye');\n var /** @type {string} */ theLabel = this.get_label();\n};\n\n\n/**\n * @private\n * @type {string}\n */\nFalconTest_A.prototype._label;\n\n\n/**\n * @expose\n * @return {string}\n */\nFalconTest_A.prototype.get_label = function() {\n return this._label;\n};\n\n\n/**\n * @expose\n * @param {string} value\n */\nFalconTest_A.prototype.set_label = function(value) {\n this._label = value;\n};";
+ String expected = "/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @expose\n */\nFalconTest_A.prototype.doStuff = function() {\n this.label = 'hello, bye';\n var /** @type {string} */ theLabel = this.label;\n};\n\n\n/**\n * @private\n * @type {string}\n */\nFalconTest_A.prototype._label;\n\n\n/**\n * @expose\n * @type {string}\n */\nFalconTest_A.prototype.label;\n\n;\n\n\n;Object.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @expose */\nlabel: {\nget: /** @this {FalconTest_A} */ function() {\n return this._label;\n},\nset: /** @this {FalconTest_A} */ function(value) {\n this._label = value;\n}}}\n);";
assertOut(expected);
}
@@ -49,7 +49,7 @@ public class TestFlexJSAccessors extends ASTestBase
"public class B { public function B() {}; public function doStuff():void {this.label = label + 'bye'; var theLabel:String = label;}; private var _label:String; public function get label():String {return _label}; public function set label(value:String):void {_label = value};}",
IClassNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\nB = function() {\n};\n\n\n/**\n * @expose\n */\nB.prototype.doStuff = function() {\n this.set_label(this.get_label() + 'bye');\n var /** @type {string} */ theLabel = this.get_label();\n};\n\n\n/**\n * @private\n * @type {string}\n */\nB.prototype._label;\n\n\n/**\n * @expose\n * @return {string}\n */\nB.prototype.get_label = function() {\n return this._label;\n};\n\n\n/**\n * @expose\n * @param {string} value\n */\nB.prototype.set_label = function(value) {\n this._label = value;\n};";
+ String expected = "/**\n * @constructor\n */\nB = function() {\n};\n\n\n/**\n * @expose\n */\nB.prototype.doStuff = function() {\n this.label = this.label + 'bye';\n var /** @type {string} */ theLabel = this.label;\n};\n\n\n/**\n * @private\n * @type {string}\n */\nB.prototype._label;\n\n\n/**\n * @expose\n * @type {string}\n */\nB.prototype.label;\n\n;\n\n\n;Object.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/** @expose */\nlabel: {\nget: /** @this {B} */ function() {\n return this._label;\n},\nset: /** @this {B} */ function(value) {\n this._label = value;\n}}}\n);";
assertOut(expected);
}
@@ -60,7 +60,7 @@ public class TestFlexJSAccessors extends ASTestBase
"public function doStuff():void {label = label + 'bye'; var theLabel:String = label;}; private var _label:String; public function get label():String {return _label}; public function set label(value:String):void {_label = value}; ",
IClassNode.class, WRAP_LEVEL_CLASS);
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @expose\n */\nFalconTest_A.prototype.doStuff = function() {\n this.set_label(this.get_label() + 'bye');\n var /** @type {string} */ theLabel = this.get_label();\n};\n\n\n/**\n * @private\n * @type {string}\n */\nFalconTest_A.prototype._label;\n\n\n/**\n * @expose\n * @return {string}\n */\nFalconTest_A.prototype.get_label = function() {\n return this._label;\n};\n\n\n/**\n * @expose\n * @param {string} value\n */\nFalconTest_A.prototype.set_label = function(value) {\n this._label = value;\n};";
+ String expected = "/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @expose\n */\nFalconTest_A.prototype.doStuff = function() {\n this.label = this.label + 'bye';\n var /** @type {string} */ theLabel = this.label;\n};\n\n\n/**\n * @private\n * @type {string}\n */\nFalconTest_A.prototype._label;\n\n\n/**\n * @expose\n * @type {string}\n */\nFalconTest_A.prototype.label;\n\n;\n\n\n;Object.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @expose */\nlabel: {\nget: /** @this {FalconTest_A} */ function() {\n return this._label;\n},\nset: /** @this {FalconTest_A} */ function(value) {\n this._label = value;\n}}}\n);";
assertOut(expected);
}
@@ -71,7 +71,7 @@ public class TestFlexJSAccessors extends ASTestBase
"public class B { public function B() {}; public function doStuff():void {label = this.label; var theLabel:String = label;}; private var _label:String; public function get label():String {return _label}; public function set label(value:String):void {_label = value};}",
IClassNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\nB = function() {\n};\n\n\n/**\n * @expose\n */\nB.prototype.doStuff = function() {\n this.set_label(this.get_label());\n var /** @type {string} */ theLabel = this.get_label();\n};\n\n\n/**\n * @private\n * @type {string}\n */\nB.prototype._label;\n\n\n/**\n * @expose\n * @return {string}\n */\nB.prototype.get_label = function() {\n return this._label;\n};\n\n\n/**\n * @expose\n * @param {string} value\n */\nB.prototype.set_label = function(value) {\n this._label = value;\n};";
+ String expected = "/**\n * @constructor\n */\nB = function() {\n};\n\n\n/**\n * @expose\n */\nB.prototype.doStuff = function() {\n this.label = this.label;\n var /** @type {string} */ theLabel = this.label;\n};\n\n\n/**\n * @private\n * @type {string}\n */\nB.prototype._label;\n\n\n/**\n * @expose\n * @type {string}\n */\nB.prototype.label;\n\n;\n\n\n;Object.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/** @expose */\nlabel: {\nget: /** @this {B} */ function() {\n return this._label;\n},\nset: /** @this {B} */ function(value) {\n this._label = value;\n}}}\n);";
assertOut(expected);
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b974c9aa/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
index fd121ea..1eb5434 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
@@ -108,7 +108,7 @@ public class TestFlexJSClass extends TestGoogClass
{
IClassNode node = getClassNode("public class B {public function B() {}; public var button:Button = new Button(); public function foo():String {return button.label;};}");
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\n/**\n * @expose\n * @type {spark_components_Button}\n */\norg_apache_flex_B.prototype.button = new spark_components_Button();\n\n\n/**\n * @expose\n * @return {string}\n */\norg_apache_flex_B.prototype.foo = function() {\n return this.button.get_label();\n};";
+ String expected = "/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\n/**\n * @expose\n * @type {spark_components_Button}\n */\norg_apache_flex_B.prototype.button = new spark_components_Button();\n\n\n/**\n * @expose\n * @return {string}\n */\norg_apache_flex_B.prototype.foo = function() {\n return this.button.label;\n};";
assertOut(expected);
}
@@ -153,7 +153,7 @@ public class TestFlexJSClass extends TestGoogClass
{
IClassNode node = getClassNode("public class B {public function B() {}; public function set baz(value:Object):void {}; public function set foo(value:Object):void {baz = value;};}");
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\n/**\n * @expose\n * @param {Object} value\n */\norg_apache_flex_B.prototype.set_baz = function(value) {\n};\n\n\n/**\n * @expose\n * @param {Object} value\n */\norg_apache_flex_B.prototype.set_foo = function(value) {\n this.set_baz(value);\n};";
+ String expected = "/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\n/**\n * @expose\n * @type {Object}\n */\norg_apache_flex_B.prototype.baz;\n\n;\n\n\n/**\n * @expose\n * @type {Object}\n */\norg_apache_flex_B.prototype.foo;\n\n;Object.defineProperties(org_apache_flex_B.prototype, /** @lends {org_apache_flex_B.prototype} */ {\n/** @expose */\nbaz: {\nset: /** @this {org_apache_flex_B} */ function(value) {\n}},\n/** @expose */\nfoo: {\nset: /** @this {org_apache_flex_B} */ function(value) {\n this.baz = value;\n}}}\n);";
assertOut(expected);
}
@@ -162,7 +162,7 @@ public class TestFlexJSClass extends TestGoogClass
{
IClassNode node = getClassNode("public class B {public function B() {}; override public function set foo(value:Object):void {super.foo = value;};}");
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\n/**\n * @expose\n * @param {Object} value\n * @override\n */\norg_apache_flex_B.prototype.set_foo = function(value) {\n org_apache_flex_B.base(this, 'set_foo', value);\n};";
+ String expected = "/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\n/**\n * @expose\n * @type {Object}\n */\norg_apache_flex_B.prototype.foo;\n\n;Object.defineProperties(org_apache_flex_B.prototype, /** @lends {org_apache_flex_B.prototype} */ {\n/** @expose */\nfoo: {\nset: /** @this {org_apache_flex_B} */ function(value) {\n foo = value;\n}}}\n);";
assertOut(expected);
}
@@ -214,7 +214,7 @@ public class TestFlexJSClass extends TestGoogClass
+ "foo_bar function get foo6():Object{return null;}"
+ "foo_bar function set foo6(value:Object):void{}" + "}");
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\norg_apache_flex_A = function() {\n};\n\n\n/**\n * @expose\n * @return {Object}\n */\norg_apache_flex_A.prototype.get_foo1 = function() {\n return null;\n};\n\n\n/**\n * @expose\n * @param {Object} value\n */\norg_apache_flex_A.prototype.set_foo1 = function(value) {\n};\n\n\n/**\n * @protected\n * @return {Object}\n */\norg_apache_flex_A.prototype.get_foo2 = function() {\n return null;\n};\n\n\n/**\n * @protected\n * @param {Object} value\n */\norg_apache_flex_A.prototype.set_foo2 = function(value) {\n};\n\n\n/**\n * @private\n * @return {Object}\n */\norg_apache_flex_A.prototype.get_foo3 = function() {\n return null;\n};\n\n\n/**\n * @private\n * @param {Object} value\n */\norg_apache_flex_A.prototype.set_foo3 = function(value) {\n};\n\n\n/**\n * @return {Object}\n */\norg_apache_flex_A.prototype.get_foo5 = function() {\n return null;\n};\n\n\n/**\n * @param {Object} value\n */\norg_apache_flex_A.prototype.set_foo5 = function(value)
{\n};\n\n\n/**\n * @return {Object}\n */\norg_apache_flex_A.prototype.get_foo6 = function() {\n return null;\n};\n\n\n/**\n * @param {Object} value\n */\norg_apache_flex_A.prototype.set_foo6 = function(value) {\n};");
+ assertOut("/**\n * @constructor\n */\norg_apache_flex_A = function() {\n};\n\n\n/**\n * @expose\n * @type {Object}\n */\norg_apache_flex_A.prototype.foo1;\n\n;\n\n\n;\n\n\n/**\n * @protected\n * @type {Object}\n */\norg_apache_flex_A.prototype.foo2;\n\n;\n\n\n;\n\n\n/**\n * @private\n * @type {Object}\n */\norg_apache_flex_A.prototype.foo3;\n\n;\n\n\n;\n\n\n/**\n * @expose\n * @type {Object}\n */\norg_apache_flex_A.prototype.foo5;\n\n;\n\n\n;\n\n\n/**\n * @expose\n * @type {Object}\n */\norg_apache_flex_A.prototype.foo6;\n\n;\n\n\n;Object.defineProperties(org_apache_flex_A.prototype, /** @lends {org_apache_flex_A.prototype} */ {\n/** @expose */\nfoo5: {\nget: /** @this {org_apache_flex_A} */ function() {\n return null;\n},\nset: /** @this {org_apache_flex_A} */ function(value) {\n}},\n/** @expose */\nfoo3: {\nget: /** @this {org_apache_flex_A} */ function() {\n return null;\n},\nset: /** @this {org_apache_flex_A} */ function(value) {\n}},\n/** @expose */\nfoo2: {\nget: /**
@this {org_apache_flex_A} */ function() {\n return null;\n},\nset: /** @this {org_apache_flex_A} */ function(value) {\n}},\n/** @expose */\nfoo1: {\nget: /** @this {org_apache_flex_A} */ function() {\n return null;\n},\nset: /** @this {org_apache_flex_A} */ function(value) {\n}},\n/** @expose */\nfoo6: {\nget: /** @this {org_apache_flex_A} */ function() {\n return null;\n},\nset: /** @this {org_apache_flex_A} */ function(value) {\n}}}\n);");
}
@Override
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b974c9aa/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
index 84ddd03..9691b70 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
@@ -104,7 +104,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {public function b(s:String):Boolean {return this.c + 10; } public function get c():int { return 0; }}",
IBinaryOperatorNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitBinaryOperator(node);
- assertOut("this.get_c() + 10");
+ assertOut("this.c + 10");
}
@Test
@@ -134,7 +134,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {public function set b(value:int):void {}; public function c() { b = 1; }}",
IBinaryOperatorNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitBinaryOperator(node);
- assertOut("this.set_b(1)");
+ assertOut("this.b = 1");
}
@Test
@@ -144,7 +144,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {public function set b(value:int):void {}; public function c() { this.b = 1; }}",
IBinaryOperatorNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitBinaryOperator(node);
- assertOut("this.set_b(1)");
+ assertOut("this.b = 1");
}
@Test
@@ -168,7 +168,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
((JSFlexJSEmitter)asEmitter).thisClass = def;
asBlockWalker.visitBinaryOperator(bnode);
- assertOut("this.set_b(1)");
+ assertOut("this.b = 1");
}
@Test
@@ -192,7 +192,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
((JSFlexJSEmitter)asEmitter).thisClass = def;
asBlockWalker.visitBinaryOperator(bnode);
- assertOut("this.set_b(1)");
+ assertOut("this.b = 1");
}
@Test
@@ -202,7 +202,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {public function set b(value:int):void {}; public function c(other:B) { other.b = 1; }}",
IBinaryOperatorNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitBinaryOperator(node);
- assertOut("other.set_b(1)");
+ assertOut("other.b = 1");
}
@Test
@@ -212,7 +212,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {public function set b(value:int):void {}; public function get d():B {}; public function c(other:B) { d.d.b = 1; }}",
IBinaryOperatorNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitBinaryOperator(node);
- assertOut("this.get_d().get_d().set_b(1)");
+ assertOut("this.d.d.b = 1");
}
@Test
@@ -222,7 +222,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {public function set b(value:int):void {}; public function get d():B {}; public function c(other:B) { other.d.b = 1; }}",
IBinaryOperatorNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitBinaryOperator(node);
- assertOut("other.get_d().set_b(1)");
+ assertOut("other.d.b = 1");
}
@Test
@@ -232,7 +232,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {public function set b(value:int):void {}; public function c() { b = b + 1; }}",
IBinaryOperatorNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitBinaryOperator(node);
- assertOut("this.set_b(this.get_b() + 1)");
+ assertOut("this.b = this.b + 1");
}
@Test
@@ -262,7 +262,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {[Bindable] public var b:int; public function c() { b = 1; }}",
IBinaryOperatorNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitBinaryOperator(node);
- assertOut("this.set_b(1)");
+ assertOut("this.b = 1");
}
@Test
@@ -272,7 +272,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {[Bindable] public var b:int; public function c() { this.b = 1; }}",
IBinaryOperatorNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitBinaryOperator(node);
- assertOut("this.set_b(1)");
+ assertOut("this.b = 1");
}
@Test
@@ -282,7 +282,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {[Bindable] public var b:int; public function c(other:B) { other.b = 1; }}",
IBinaryOperatorNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitBinaryOperator(node);
- assertOut("other.set_b(1)");
+ assertOut("other.b = 1");
}
@Test
@@ -292,7 +292,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {[Bindable] public var b:int; [Bindable] public var d:B; public function c(other:B) { d.d.b = 1; }}",
IBinaryOperatorNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitBinaryOperator(node);
- assertOut("this.get_d().get_d().set_b(1)");
+ assertOut("this.d.d.b = 1");
}
@Test
@@ -302,7 +302,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {[Bindable] public var b:int; [Bindable] public var d:B; public function c(other:B) { other.d.b = 1; }}",
IBinaryOperatorNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitBinaryOperator(node);
- assertOut("other.get_d().set_b(1)");
+ assertOut("other.d.b = 1");
}
@Test
@@ -312,7 +312,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {[Bindable] public var b:int; public function c() { b = b + 1; }}",
IBinaryOperatorNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitBinaryOperator(node);
- assertOut("this.set_b(this.get_b() + 1)");
+ assertOut("this.b = this.b + 1");
}
@Test
@@ -372,7 +372,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {[Bindable] public var b:int; public var d:B; public function c(other:B) { d.d.b = 1; }}",
IBinaryOperatorNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitBinaryOperator(node);
- assertOut("this.d.d.set_b(1)");
+ assertOut("this.d.d.b = 1");
}
@Test
@@ -392,7 +392,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {[Bindable] public var b:int; public var d:B; public function c(other:B) { other.d.b = 1; }}",
IBinaryOperatorNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitBinaryOperator(node);
- assertOut("other.d.set_b(1)");
+ assertOut("other.d.b = 1");
}
@Test
@@ -434,7 +434,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
IBinaryOperatorNode bnode = (IBinaryOperatorNode) findFirstDescendantOfType(
node, IBinaryOperatorNode.class);
asBlockWalker.visitBinaryOperator(bnode);
- assertOut("foo_bar_B.set_b(1)");
+ assertOut("foo_bar_B.b = 1");
}
@Test
@@ -446,7 +446,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
IBinaryOperatorNode bnode = (IBinaryOperatorNode) findFirstDescendantOfType(
node, IBinaryOperatorNode.class);
asBlockWalker.visitBinaryOperator(bnode);
- assertOut("foo_bar_B.set_b(1)");
+ assertOut("foo_bar_B.b = 1");
}
@Test
@@ -458,7 +458,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
IBinaryOperatorNode bnode = (IBinaryOperatorNode) findFirstDescendantOfType(
node, IBinaryOperatorNode.class);
asBlockWalker.visitBinaryOperator(bnode);
- assertOut("foo_bar_B.get_d().set_b(1)");
+ assertOut("foo_bar_B.d.b = 1");
}
@Test
@@ -482,7 +482,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
((JSFlexJSEmitter)asEmitter).thisClass = def;
asBlockWalker.visitBinaryOperator(bnode);
- assertOut("foo_bar_B.get_d().set_b(1)");
+ assertOut("foo_bar_B.d.b = 1");
}
@Test
@@ -494,7 +494,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
IBinaryOperatorNode bnode = (IBinaryOperatorNode) findFirstDescendantOfType(
node, IBinaryOperatorNode.class);
asBlockWalker.visitBinaryOperator(bnode);
- assertOut("foo_bar_B.set_b(foo_bar_B.get_b() + 1)");
+ assertOut("foo_bar_B.b = foo_bar_B.b + 1");
}
@Test
@@ -542,7 +542,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
((JSFlexJSEmitter)asEmitter).thisClass = def;
asBlockWalker.visitBinaryOperator(bnode);
- assertOut("org_apache_flex_utils_Language.as(this.model, foo_bar_E, true).set_labelText(null)");
+ assertOut("org_apache_flex_utils_Language.as(this.model, foo_bar_E, true).labelText = null");
}
@Test
@@ -636,7 +636,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
{
IClassNode node = (IClassNode) getNode("import spark.components.Button; public class B implements Button { public function B() { Button(b).label = ''; } }", ClassNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n * @implements {spark_components_Button}\n */\nB = function() {\n org_apache_flex_utils_Language.as(b, spark_components_Button, true).set_label('');\n};");
+ assertOut("/**\n * @constructor\n * @implements {spark_components_Button}\n */\nB = function() {\n org_apache_flex_utils_Language.as(b, spark_components_Button, true).label = '';\n};");
}
@Test
@@ -644,7 +644,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
{
IFunctionNode node = getMethod("function foo(){var foo:Object = FalconTest_A(bar).bar = '';}; public function get bar():Object { return this; };");
asBlockWalker.visitFunction(node);
- assertOut("FalconTest_A.prototype.foo = function() {\n var /** @type {Object} */ foo = org_apache_flex_utils_Language.as(this.get_bar(), FalconTest_A, true).set_bar('');\n}");
+ assertOut("FalconTest_A.prototype.foo = function() {\n var /** @type {Object} */ foo = org_apache_flex_utils_Language.as(this.bar, FalconTest_A, true).bar = '';\n}");
}
@Test
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b974c9aa/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSInterface.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSInterface.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSInterface.java
index 1bc10f4..5d1028b 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSInterface.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSInterface.java
@@ -43,7 +43,7 @@ public class TestFlexJSInterface extends TestGoogInterface
+ "function get foo1():Object;"
+ "function set foo1(value:Object):void;}");
asBlockWalker.visitInterface(node);
- assertOut("/**\n * @interface\n */\nIA = function() {\n};\n\n\n/**\n * @return {Object}\n */\nIA.prototype.get_foo1 = function() {};\n\n\n/**\n * @param {Object} value\n */\nIA.prototype.set_foo1 = function(value) {};");
+ assertOut("/**\n * @interface\n */\nIA = function() {\n};\nIA.prototype.foo1;");
}
@Override
@@ -54,7 +54,7 @@ public class TestFlexJSInterface extends TestGoogInterface
+ "function baz1():Object;"
+ "function baz2(value:Object):void;}");
asBlockWalker.visitInterface(node);
- assertOut("/**\n * @interface\n */\nIA = function() {\n};\n\n\n/**\n * @return {Object}\n */\nIA.prototype.baz1 = function() {};\n\n\n/**\n * @param {Object} value\n */\nIA.prototype.baz2 = function(value) {};");
+ assertOut("/**\n * @interface\n */\nIA = function() {\n};\nIA.prototype.baz1 = function() {\n};\nIA.prototype.baz2 = function(value) {\n};");
}
@Override
@@ -67,7 +67,7 @@ public class TestFlexJSInterface extends TestGoogInterface
+ "function baz1():Object;"
+ "function baz2(value:Object):void;}");
asBlockWalker.visitInterface(node);
- assertOut("/**\n * @interface\n */\nIA = function() {\n};\n\n\n/**\n * @return {Object}\n */\nIA.prototype.get_foo1 = function() {};\n\n\n/**\n * @param {Object} value\n */\nIA.prototype.set_foo1 = function(value) {};\n\n\n/**\n * @return {Object}\n */\nIA.prototype.baz1 = function() {};\n\n\n/**\n * @param {Object} value\n */\nIA.prototype.baz2 = function(value) {};");
+ assertOut("/**\n * @interface\n */\nIA = function() {\n};\nIA.prototype.foo1;\nIA.prototype.baz1 = function() {\n};\nIA.prototype.baz2 = function(value) {\n};");
}
protected IBackend createBackend()
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b974c9aa/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogClass.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogClass.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogClass.java
index 791e7d4..bbe0720 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogClass.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogClass.java
@@ -81,7 +81,7 @@ public class TestGoogClass extends TestClass
{
IClassNode node = getClassNode("public class A extends Button {public function A() {}}");
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n */\norg.apache.flex.A = function() {\n\torg.apache.flex.A.base(this, 'constructor');\n}\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
+ assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n */\norg.apache.flex.A = function() {\n\torg.apache.flex.A.base(this, 'constructor');\n};\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
}
@Override
@@ -108,7 +108,7 @@ public class TestGoogClass extends TestClass
{
IClassNode node = getClassNode("public class A extends Button implements IEventDispatcher {public function A() {}}");
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @implements {flash.events.IEventDispatcher}\n */\norg.apache.flex.A = function() {\n\torg.apache.flex.A.base(this, 'constructor');\n}\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
+ assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @implements {flash.events.IEventDispatcher}\n */\norg.apache.flex.A = function() {\n\torg.apache.flex.A.base(this, 'constructor');\n};\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
}
@Override
@@ -117,7 +117,7 @@ public class TestGoogClass extends TestClass
{
IClassNode node = getClassNode("public class A extends Button implements IEventDispatcher, ILogger {public function A() {}}");
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @implements {flash.events.IEventDispatcher}\n * @implements {mx.logging.ILogger}\n */\norg.apache.flex.A = function() {\n\torg.apache.flex.A.base(this, 'constructor');\n}\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
+ assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @implements {flash.events.IEventDispatcher}\n * @implements {mx.logging.ILogger}\n */\norg.apache.flex.A = function() {\n\torg.apache.flex.A.base(this, 'constructor');\n};\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
}
@Override
@@ -126,7 +126,7 @@ public class TestGoogClass extends TestClass
{
IClassNode node = getClassNode("public final class A extends Button implements IEventDispatcher, ILogger {public function A() {}}");
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @implements {flash.events.IEventDispatcher}\n * @implements {mx.logging.ILogger}\n */\norg.apache.flex.A = function() {\n\torg.apache.flex.A.base(this, 'constructor');\n}\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
+ assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @implements {flash.events.IEventDispatcher}\n * @implements {mx.logging.ILogger}\n */\norg.apache.flex.A = function() {\n\torg.apache.flex.A.base(this, 'constructor');\n};\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
}
@Override
@@ -135,7 +135,7 @@ public class TestGoogClass extends TestClass
{
IClassNode node = getClassNode("public class A extends spark.components.Button implements flash.events.IEventDispatcher, mx.logging.ILogger {public function A() {}}");
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @implements {flash.events.IEventDispatcher}\n * @implements {mx.logging.ILogger}\n */\norg.apache.flex.A = function() {\n\torg.apache.flex.A.base(this, 'constructor');\n}\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
+ assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @implements {flash.events.IEventDispatcher}\n * @implements {mx.logging.ILogger}\n */\norg.apache.flex.A = function() {\n\torg.apache.flex.A.base(this, 'constructor');\n};\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
}
@Override
@@ -160,7 +160,7 @@ public class TestGoogClass extends TestClass
{
IClassNode node = getClassNode("public class A extends spark.components.Button { public function A() { super('foo', 42);}}");
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n */\norg.apache.flex.A = function() {\n\tvar self = this;\n\torg.apache.flex.A.base(this, 'constructor', 'foo', 42);\n}\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
+ assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n */\norg.apache.flex.A = function() {\n\tvar self = this;\n\torg.apache.flex.A.base(this, 'constructor', 'foo', 42);\n};\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
}
@Override
@@ -178,7 +178,7 @@ public class TestGoogClass extends TestClass
{
IClassNode node = getClassNode("public class A extends spark.components.Button {public function A(arg1:String, arg2:int) {}}");
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @param {string} arg1\n * @param {number} arg2\n */\norg.apache.flex.A = function(arg1, arg2) {\n\torg.apache.flex.A.base(this, 'constructor', arg1, arg2);\n}\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
+ assertOut("/**\n * @constructor\n * @extends {spark.components.Button}\n * @param {string} arg1\n * @param {number} arg2\n */\norg.apache.flex.A = function(arg1, arg2) {\n\torg.apache.flex.A.base(this, 'constructor', arg1, arg2);\n};\ngoog.inherits(org.apache.flex.A, spark.components.Button);");
}
@Override
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b974c9aa/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogEmiter.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogEmiter.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogEmiter.java
index ac460d2..e1f1278 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogEmiter.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogEmiter.java
@@ -50,7 +50,7 @@ public class TestGoogEmiter extends ASTestBase
+ "return \"Don't \" + _privateVar + value; }";
IFileNode node = compileAS(code);
asBlockWalker.visitFile(node);
- assertOut("goog.provide('com.example.components.MyTextButton');\n\ngoog.require('spark.components.Button');\n\n/**\n * @constructor\n * @extends {spark.components.Button}\n */\ncom.example.components.MyTextButton = function() {\n\tvar self = this;\n\tcom.example.components.MyTextButton.base(this, 'constructor');\n\tif (foo() != 42) {\n\t\tbar();\n\t}\n}\ngoog.inherits(com.example.components.MyTextButton, spark.components.Button);\n\n/**\n * @private\n * @type {string}\n */\ncom.example.components.MyTextButton.prototype._privateVar = \"do \";\n\n/**\n * @type {number}\n */\ncom.example.components.MyTextButton.prototype.publicProperty = 100;\n\n/**\n * @param {string} value\n * @return {string}\n */\ncom.example.components.MyTextButton.prototype.myFunction = function(value) {\n\tvar self = this;\n\treturn \"Don't \" + self._privateVar + value;\n};");
+ assertOut("goog.provide('com.example.components.MyTextButton');\n\ngoog.require('spark.components.Button');\n\n/**\n * @constructor\n * @extends {spark.components.Button}\n */\ncom.example.components.MyTextButton = function() {\n\tvar self = this;\n\tcom.example.components.MyTextButton.base(this, 'constructor');\n\tif (foo() != 42) {\n\t\tbar();\n\t}\n};\ngoog.inherits(com.example.components.MyTextButton, spark.components.Button);\n\n/**\n * @private\n * @type {string}\n */\ncom.example.components.MyTextButton.prototype._privateVar = \"do \";\n\n/**\n * @type {number}\n */\ncom.example.components.MyTextButton.prototype.publicProperty = 100;\n\n/**\n * @param {string} value\n * @return {string}\n */\ncom.example.components.MyTextButton.prototype.myFunction = function(value) {\n\tvar self = this;\n\treturn \"Don't \" + self._privateVar + value;\n};");
}
@Test
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b974c9aa/compiler.jx.tests/test-files/flexjs/files/FlexJSTest_again_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/FlexJSTest_again_result.js b/compiler.jx.tests/test-files/flexjs/files/FlexJSTest_again_result.js
index 5d6a1ca..5460952 100644
--- a/compiler.jx.tests/test-files/flexjs/files/FlexJSTest_again_result.js
+++ b/compiler.jx.tests/test-files/flexjs/files/FlexJSTest_again_result.js
@@ -46,49 +46,49 @@ FlexJSTest_again = function() {
* @private
* @type {org_apache_flex_core_SimpleCSSValuesImpl}
*/
- this.$ID0;
+ this.$ID0_;
/**
* @private
* @type {MyInitialView}
*/
- this.$ID1;
+ this.$ID1_;
/**
* @private
* @type {models_MyModel}
*/
- this.$ID2;
+ this.$ID2_;
/**
* @private
* @type {controllers_MyController}
*/
- this.$ID3;
+ this.$ID3_;
/**
* @private
* @type {org_apache_flex_net_HTTPService}
*/
- this.service;
+ this.service_;
/**
* @private
* @type {org_apache_flex_net_dataConverters_LazyCollection}
*/
- this.collection;
+ this.collection_;
/**
* @private
* @type {org_apache_flex_net_JSONInputParser}
*/
- this.$ID4;
+ this.$ID4_;
/**
* @private
* @type {StockDataJSONItemConverter}
*/
- this.$ID5;
+ this.$ID5_;
/**
* @private
@@ -142,54 +142,38 @@ FlexJSTest_again.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'FlexJSTest_aga
*/
FlexJSTest_again.prototype.$EH0 = function(event)
{
- org_apache_flex_utils_Language.as(this.model, models_MyModel, true).set_labelText('Hello World');
+ org_apache_flex_utils_Language.as(this.model, models_MyModel, true).labelText = 'Hello World';
};
-/**
- * @expose
- * @return {org_apache_flex_net_HTTPService}
- */
-FlexJSTest_again.prototype.get_service = function()
-{
- return this.service;
-};
-
-
-/**
- * @expose
- * @param {org_apache_flex_net_HTTPService} value
- */
-FlexJSTest_again.prototype.set_service = function(value)
-{
- if (value != this.service) {
- this.service = value;
- this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(this, 'service', null, value));
+Object.defineProperties(FlexJSTest_again.prototype, /** @lends {FlexJSTest_again.prototype} */ {
+/** @expose */
+ service: {
+ /** @this {FlexJSTest_again} */
+ get: function() {
+ return this.service_;
+ },
+ /** @this {FlexJSTest_again} */
+ set: function(value) {
+ if (value != this.service_) {
+ this.service_ = value;
+ this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(this, 'service', null, value));
+ }
+ }
+ },
+ /** @expose */
+ collection: {
+ /** @this {FlexJSTest_again} */
+ get: function() {
+ return this.collection_;
+ },
+ /** @this {FlexJSTest_again} */
+ set: function(value) {
+ if (value != this.collection_) {
+ this.collection_ = value;
+ this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(this, 'collection', null, value));
+ }
+ }
}
-};
-
-
-/**
- * @expose
- * @return {org_apache_flex_net_dataConverters_LazyCollection}
- */
-FlexJSTest_again.prototype.get_collection = function()
-{
- return this.collection;
-};
-
-
-/**
- * @expose
- * @param {org_apache_flex_net_dataConverters_LazyCollection} value
- */
-FlexJSTest_again.prototype.set_collection = function(value)
-{
- if (value != this.collection) {
- this.collection = value;
- this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(this, 'collection', null, value));
- }
-};
-
-
+});
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b974c9aa/compiler.jx.tests/test-files/flexjs/files/MyInitialView_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/MyInitialView_result.js b/compiler.jx.tests/test-files/flexjs/files/MyInitialView_result.js
index 5f38962..6062278 100644
--- a/compiler.jx.tests/test-files/flexjs/files/MyInitialView_result.js
+++ b/compiler.jx.tests/test-files/flexjs/files/MyInitialView_result.js
@@ -51,139 +51,139 @@ MyInitialView = function() {
* @private
* @type {org_apache_flex_html_Label}
*/
- this.lbl;
+ this.lbl_;
/**
* @private
* @type {org_apache_flex_binding_SimpleBinding}
*/
- this.$ID0;
+ this.$ID0_;
/**
* @private
* @type {org_apache_flex_html_TextButton}
*/
- this.$ID1;
+ this.$ID1_;
/**
* @private
* @type {org_apache_flex_html_TextButton}
*/
- this.$ID2;
+ this.$ID2_;
/**
* @private
* @type {org_apache_flex_html_Label}
*/
- this.timerLabel;
+ this.timerLabel_;
/**
* @private
* @type {org_apache_flex_html_List}
*/
- this.cityList;
+ this.cityList_;
/**
* @private
* @type {org_apache_flex_binding_ConstantBinding}
*/
- this.$ID3;
+ this.$ID3_;
/**
* @private
* @type {org_apache_flex_html_TextArea}
*/
- this.$ID5;
+ this.$ID5_;
/**
* @private
* @type {org_apache_flex_binding_SimpleBinding}
*/
- this.$ID4;
+ this.$ID4_;
/**
* @private
* @type {org_apache_flex_html_TextInput}
*/
- this.input;
+ this.input_;
/**
* @private
* @type {org_apache_flex_html_TextButton}
*/
- this.$ID6;
+ this.$ID6_;
/**
* @private
* @type {org_apache_flex_html_CheckBox}
*/
- this.checkbox;
+ this.checkbox_;
/**
* @private
* @type {org_apache_flex_html_RadioButton}
*/
- this.$ID7;
+ this.$ID7_;
/**
* @private
* @type {org_apache_flex_html_RadioButton}
*/
- this.$ID8;
+ this.$ID8_;
/**
* @private
* @type {org_apache_flex_html_RadioButton}
*/
- this.$ID9;
+ this.$ID9_;
/**
* @private
* @type {org_apache_flex_html_RadioButton}
*/
- this.$ID10;
+ this.$ID10_;
/**
* @private
* @type {org_apache_flex_html_RadioButton}
*/
- this.$ID11;
+ this.$ID11_;
/**
* @private
* @type {org_apache_flex_html_RadioButton}
*/
- this.$ID12;
+ this.$ID12_;
/**
* @private
* @type {org_apache_flex_html_DropDownList}
*/
- this.list;
+ this.list_;
/**
* @private
* @type {org_apache_flex_binding_ConstantBinding}
*/
- this.$ID13;
+ this.$ID13_;
/**
* @private
* @type {org_apache_flex_html_TextButton}
*/
- this.$ID14;
+ this.$ID14_;
/**
* @private
* @type {org_apache_flex_html_ComboBox}
*/
- this.comboBox;
+ this.comboBox_;
/**
* @private
* @type {org_apache_flex_binding_ConstantBinding}
*/
- this.$ID15;
+ this.$ID15_;
/**
* @private
@@ -215,40 +215,16 @@ MyInitialView.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'MyInitialView', q
MyInitialView.prototype.timer;
-/**
- * @expose
- * @return {string}
- */
-MyInitialView.prototype.get_symbol = function() {
- return org_apache_flex_utils_Language.as(this.get_list().get_selectedItem(), String);
-};
+;
-/**
- * @expose
- * @return {string}
- */
-MyInitialView.prototype.get_city = function() {
- return org_apache_flex_utils_Language.as(this.get_cityList().get_selectedItem(), String);
-};
+;
-/**
- * @expose
- * @return {string}
- */
-MyInitialView.prototype.get_inputText = function() {
- return this.get_input().get_text();
-};
+;
-/**
- * @expose
- * @return {string}
- */
-MyInitialView.prototype.get_comboBoxValue = function() {
- return String(this.get_comboBox().get_selectedItem());
-};
+;
/**
@@ -267,11 +243,32 @@ MyInitialView.prototype.startTimer = function(event) {
* @param {org_apache_flex_events_Event} event
*/
MyInitialView.prototype.timerHandler = function(event) {
- this.get_timerLabel().set_text(this.timer.get_currentCount().toString());
+ this.timerLabel.text = this.timer.currentCount.toString();
};
-/**
+Object.defineProperties(MyInitialView.prototype, /** @lends {MyInitialView.prototype} */ {
+/** @expose */
+comboBoxValue: {
+get: /** @this {MyInitialView} */ function() {
+ return String(this.comboBox.selectedItem);
+}},
+/** @expose */
+inputText: {
+get: /** @this {MyInitialView} */ function() {
+ return this.input.text;
+}},
+/** @expose */
+symbol: {
+get: /** @this {MyInitialView} */ function() {
+ return org_apache_flex_utils_Language.as(this.list.selectedItem, String);
+}},
+/** @expose */
+city: {
+get: /** @this {MyInitialView} */ function() {
+ return org_apache_flex_utils_Language.as(this.cityList.selectedItem, String);
+}}}
+);/**
* @expose
* @param {org_apache_flex_events_Event} event
*/
@@ -342,180 +339,116 @@ MyInitialView.prototype.$EH6 = function(event)
};
-/**
- * @expose
- * @return {org_apache_flex_html_Label}
- */
-MyInitialView.prototype.get_lbl = function()
-{
- return this.lbl;
-};
-
-
-/**
- * @expose
- * @param {org_apache_flex_html_Label} value
- */
-MyInitialView.prototype.set_lbl = function(value)
-{
- if (value != this.lbl) {
- this.lbl = value;
- this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(this, 'lbl', null, value));
- }
-};
-
-
-/**
- * @expose
- * @return {org_apache_flex_html_Label}
- */
-MyInitialView.prototype.get_timerLabel = function()
-{
- return this.timerLabel;
-};
-
-
-/**
- * @expose
- * @param {org_apache_flex_html_Label} value
- */
-MyInitialView.prototype.set_timerLabel = function(value)
-{
- if (value != this.timerLabel) {
- this.timerLabel = value;
- this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(this, 'timerLabel', null, value));
- }
-};
-
-
-/**
- * @expose
- * @return {org_apache_flex_html_List}
- */
-MyInitialView.prototype.get_cityList = function()
-{
- return this.cityList;
-};
-
-
-/**
- * @expose
- * @param {org_apache_flex_html_List} value
- */
-MyInitialView.prototype.set_cityList = function(value)
-{
- if (value != this.cityList) {
- this.cityList = value;
- this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(this, 'cityList', null, value));
- }
-};
-
-
-/**
- * @expose
- * @return {org_apache_flex_html_TextInput}
- */
-MyInitialView.prototype.get_input = function()
-{
- return this.input;
-};
-
-
-/**
- * @expose
- * @param {org_apache_flex_html_TextInput} value
- */
-MyInitialView.prototype.set_input = function(value)
-{
- if (value != this.input) {
- this.input = value;
- this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(this, 'input', null, value));
- }
-};
-
-
-/**
- * @expose
- * @return {org_apache_flex_html_CheckBox}
- */
-MyInitialView.prototype.get_checkbox = function()
-{
- return this.checkbox;
-};
-
-
-/**
- * @expose
- * @param {org_apache_flex_html_CheckBox} value
- */
-MyInitialView.prototype.set_checkbox = function(value)
-{
- if (value != this.checkbox) {
- this.checkbox = value;
- this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(this, 'checkbox', null, value));
- }
-};
-
-
-/**
- * @expose
- * @return {org_apache_flex_html_DropDownList}
- */
-MyInitialView.prototype.get_list = function()
-{
- return this.list;
-};
-
-
-/**
- * @expose
- * @param {org_apache_flex_html_DropDownList} value
- */
-MyInitialView.prototype.set_list = function(value)
-{
- if (value != this.list) {
- this.list = value;
- this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(this, 'list', null, value));
- }
-};
-
-
-/**
- * @expose
- * @return {org_apache_flex_html_ComboBox}
- */
-MyInitialView.prototype.get_comboBox = function()
-{
- return this.comboBox;
-};
-
-
-/**
- * @expose
- * @param {org_apache_flex_html_ComboBox} value
- */
-MyInitialView.prototype.set_comboBox = function(value)
-{
- if (value != this.comboBox) {
- this.comboBox = value;
- this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(this, 'comboBox', null, value));
- }
-};
-
-
-/**
- * @override
- * @return {Array} the Array of UI element descriptors.
- */
-MyInitialView.prototype.get_MXMLDescriptor = function()
-{
- if (this.mxmldd == undefined)
- {
- /** @type {Array} */
- var arr = MyInitialView.base(this, 'get_MXMLDescriptor');
- /** @type {Array} */
- var data = [
-org_apache_flex_html_Label,
+Object.defineProperties(MyInitialView.prototype, /** @lends {MyInitialView.prototype} */ {
+/** @expose */
+ lbl: {
+ /** @this {MyInitialView} */
+ get: function() {
+ return this.lbl_;
+ },
+ /** @this {MyInitialView} */
+ set: function(value) {
+ if (value != this.lbl_) {
+ this.lbl_ = value;
+ this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(this, 'lbl', null, value));
+ }
+ }
+ },
+ /** @expose */
+ timerLabel: {
+ /** @this {MyInitialView} */
+ get: function() {
+ return this.timerLabel_;
+ },
+ /** @this {MyInitialView} */
+ set: function(value) {
+ if (value != this.timerLabel_) {
+ this.timerLabel_ = value;
+ this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(this, 'timerLabel', null, value));
+ }
+ }
+ },
+ /** @expose */
+ cityList: {
+ /** @this {MyInitialView} */
+ get: function() {
+ return this.cityList_;
+ },
+ /** @this {MyInitialView} */
+ set: function(value) {
+ if (value != this.cityList_) {
+ this.cityList_ = value;
+ this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(this, 'cityList', null, value));
+ }
+ }
+ },
+ /** @expose */
+ input: {
+ /** @this {MyInitialView} */
+ get: function() {
+ return this.input_;
+ },
+ /** @this {MyInitialView} */
+ set: function(value) {
+ if (value != this.input_) {
+ this.input_ = value;
+ this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(this, 'input', null, value));
+ }
+ }
+ },
+ /** @expose */
+ checkbox: {
+ /** @this {MyInitialView} */
+ get: function() {
+ return this.checkbox_;
+ },
+ /** @this {MyInitialView} */
+ set: function(value) {
+ if (value != this.checkbox_) {
+ this.checkbox_ = value;
+ this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(this, 'checkbox', null, value));
+ }
+ }
+ },
+ /** @expose */
+ list: {
+ /** @this {MyInitialView} */
+ get: function() {
+ return this.list_;
+ },
+ /** @this {MyInitialView} */
+ set: function(value) {
+ if (value != this.list_) {
+ this.list_ = value;
+ this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(this, 'list', null, value));
+ }
+ }
+ },
+ /** @expose */
+ comboBox: {
+ /** @this {MyInitialView} */
+ get: function() {
+ return this.comboBox_;
+ },
+ /** @this {MyInitialView} */
+ set: function(value) {
+ if (value != this.comboBox_) {
+ this.comboBox_ = value;
+ this.dispatchEvent(org_apache_flex_events_ValueChangeEvent.createUpdateEvent(this, 'comboBox', null, value));
+ }
+ }
+ },
+ 'MXMLDescriptor': {
+ /** @this {MyInitialView} */
+ get: function() {
+ {
+ if (this.mxmldd == undefined)
+ {
+ /** @type {Array} */
+ var arr = org_apache_flex_utils_Language.superGetter(MyInitialView,this, 'MXMLDescriptor');
+ /** @type {Array} */
+ var data = [
+ org_apache_flex_html_Label,
4,
'id',
true,
@@ -887,14 +820,16 @@ null, [org_apache_flex_binding_ConstantBinding, 4, '_id', true, '$ID15', 'source
'change',
this.$EH6,
null
-];
-
- if (arr)
- this.mxmldd = arr.concat(data);
- else
- this.mxmldd = data;
- }
- return this.mxmldd;
-};
-
-
+ ];
+
+ if (arr)
+ this.mxmldd = arr.concat(data);
+ else
+ this.mxmldd = data;
+ }
+ return this.mxmldd;
+ }
+ }
+ }
+ });
+
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b974c9aa/compiler.jx.tests/test-files/flexjs/files/controllers/MyController_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/controllers/MyController_result.js b/compiler.jx.tests/test-files/flexjs/files/controllers/MyController_result.js
index 27d163b..128b5e6 100644
--- a/compiler.jx.tests/test-files/flexjs/files/controllers/MyController_result.js
+++ b/compiler.jx.tests/test-files/flexjs/files/controllers/MyController_result.js
@@ -76,10 +76,10 @@ controllers_MyController.prototype.viewChangeHandler = function(event) {
* @param {org_apache_flex_events_Event} event
*/
controllers_MyController.prototype.buttonClickHandler = function(event) {
- var /** @type {string} */ sym = org_apache_flex_utils_Language.as(this.app.initialView, MyInitialView, true).get_symbol();
- this.app.get_service().set_url(this.queryBegin + sym + this.queryEnd);
- this.app.get_service().send();
- this.app.get_service().addEventListener("complete", goog.bind(this.completeHandler, this));
+ var /** @type {string} */ sym = org_apache_flex_utils_Language.as(this.app.initialView, MyInitialView, true).symbol;
+ this.app.service.url = this.queryBegin + sym + this.queryEnd;
+ this.app.service.send();
+ this.app.service.addEventListener("complete", goog.bind(this.completeHandler, this));
};
@@ -88,7 +88,7 @@ controllers_MyController.prototype.buttonClickHandler = function(event) {
* @param {org_apache_flex_events_Event} event
*/
controllers_MyController.prototype.completeHandler = function(event) {
- org_apache_flex_utils_Language.as(this.app.model, models_MyModel, true).set_labelText(org_apache_flex_utils_Language.as(this.app.get_collection().getItemAt(0), String));
+ org_apache_flex_utils_Language.as(this.app.model, models_MyModel, true).labelText = org_apache_flex_utils_Language.as(this.app.collection.getItemAt(0), String);
};
@@ -97,7 +97,7 @@ controllers_MyController.prototype.completeHandler = function(event) {
* @param {org_apache_flex_events_Event} event
*/
controllers_MyController.prototype.listChangedHandler = function(event) {
- org_apache_flex_utils_Language.as(this.app.model, models_MyModel, true).set_labelText(org_apache_flex_utils_Language.as(this.app.initialView, MyInitialView, true).get_symbol());
+ org_apache_flex_utils_Language.as(this.app.model, models_MyModel, true).labelText = org_apache_flex_utils_Language.as(this.app.initialView, MyInitialView, true).symbol;
};
@@ -106,7 +106,7 @@ controllers_MyController.prototype.listChangedHandler = function(event) {
* @param {org_apache_flex_events_Event} event
*/
controllers_MyController.prototype.cityListChangeHandler = function(event) {
- org_apache_flex_utils_Language.as(this.app.model, models_MyModel, true).set_labelText(org_apache_flex_utils_Language.as(this.app.initialView, MyInitialView, true).get_city());
+ org_apache_flex_utils_Language.as(this.app.model, models_MyModel, true).labelText = org_apache_flex_utils_Language.as(this.app.initialView, MyInitialView, true).city;
};
@@ -115,7 +115,7 @@ controllers_MyController.prototype.cityListChangeHandler = function(event) {
* @param {org_apache_flex_events_Event} event
*/
controllers_MyController.prototype.transferClickHandler = function(event) {
- org_apache_flex_utils_Language.as(this.app.model, models_MyModel, true).set_labelText(org_apache_flex_utils_Language.as(this.app.initialView, MyInitialView, true).get_inputText());
+ org_apache_flex_utils_Language.as(this.app.model, models_MyModel, true).labelText = org_apache_flex_utils_Language.as(this.app.initialView, MyInitialView, true).inputText;
};
@@ -124,7 +124,7 @@ controllers_MyController.prototype.transferClickHandler = function(event) {
* @param {org_apache_flex_events_Event} event
*/
controllers_MyController.prototype.comboBoxChangeHandler = function(event) {
- org_apache_flex_utils_Language.as(this.app.model, models_MyModel, true).set_labelText(org_apache_flex_utils_Language.as(this.app.initialView, MyInitialView, true).get_comboBoxValue());
+ org_apache_flex_utils_Language.as(this.app.model, models_MyModel, true).labelText = org_apache_flex_utils_Language.as(this.app.initialView, MyInitialView, true).comboBoxValue;
};
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b974c9aa/compiler.jx.tests/test-files/flexjs/files/models/MyModel_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/models/MyModel_result.js b/compiler.jx.tests/test-files/flexjs/files/models/MyModel_result.js
index 4f73cf3..5921236 100644
--- a/compiler.jx.tests/test-files/flexjs/files/models/MyModel_result.js
+++ b/compiler.jx.tests/test-files/flexjs/files/models/MyModel_result.js
@@ -42,23 +42,14 @@ models_MyModel.prototype._labelText;
/**
* @expose
- * @return {string}
+ * @type {string}
*/
-models_MyModel.prototype.get_labelText = function() {
- return this._labelText;
-};
+models_MyModel.prototype.labelText;
+;
-/**
- * @expose
- * @param {string} value
- */
-models_MyModel.prototype.set_labelText = function(value) {
- if (value != this._labelText) {
- this._labelText = value;
- this.dispatchEvent(new org_apache_flex_events_Event("labelTextChanged"));
- }
-};
+
+;
/**
@@ -70,11 +61,11 @@ models_MyModel.prototype._strings = ["AAPL", "ADBE", "GOOG", "MSFT", "YHOO"];
/**
* @expose
- * @return {Array}
+ * @type {Array}
*/
-models_MyModel.prototype.get_strings = function() {
- return this._strings;
-};
+models_MyModel.prototype.strings;
+
+;
/**
@@ -86,11 +77,33 @@ models_MyModel.prototype._cities = ["London", "Miami", "Paris", "Sydney", "Tokyo
/**
* @expose
- * @return {Array}
+ * @type {Array}
*/
-models_MyModel.prototype.get_cities = function() {
+models_MyModel.prototype.cities;
+
+;Object.defineProperties(models_MyModel.prototype, /** @lends {models_MyModel.prototype} */ {
+/** @expose */
+labelText: {
+get: /** @this {models_MyModel} */ function() {
+ return this._labelText;
+},
+set: /** @this {models_MyModel} */ function(value) {
+ if (value != this._labelText) {
+ this._labelText = value;
+ this.dispatchEvent(new org_apache_flex_events_Event("labelTextChanged"));
+ }
+}},
+/** @expose */
+cities: {
+get: /** @this {models_MyModel} */ function() {
return this._cities;
-};
+}},
+/** @expose */
+strings: {
+get: /** @this {models_MyModel} */ function() {
+ return this._strings;
+}}}
+);
/**
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b974c9aa/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE_result.js b/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE_result.js
index 19275b0..78e3f86 100644
--- a/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE_result.js
+++ b/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE_result.js
@@ -28,21 +28,9 @@ goog.provide('interfaces_IE');
*/
interfaces_IE = function() {
};
-
-
-interfaces_IE.prototype.myMethod = function() {};
-
-
-/**
- * @return {string}
- */
-interfaces_IE.prototype.get_myProp = function() {};
-
-
-/**
- * @param {string} value
- */
-interfaces_IE.prototype.set_myProp = function(value) {};
+interfaces_IE.prototype.myMethod = function() {
+};
+interfaces_IE.prototype.myProp;
/**
@@ -50,4 +38,4 @@ interfaces_IE.prototype.set_myProp = function(value) {};
*
* @type {Object.<string, Array.<Object>>}
*/
-interfaces_IE.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'IE', qName: 'interfaces_IE'}] };
+interfaces_IE.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'IE', qName: 'interfaces_IE'}] };
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b974c9aa/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js b/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js
index e482ccc..e9f3263 100644
--- a/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js
+++ b/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js
@@ -38,24 +38,25 @@ goog.inherits(Base, Super);
/**
* @expose
- * @return {string}
- * @override
+ * @type {string}
*/
-Base.prototype.get_text = function() {
- return "A" + Base.base(this, 'get_text');
-};
+Base.prototype.text;
+;
-/**
- * @expose
- * @param {string} value
- * @override
- */
-Base.prototype.set_text = function(value) {
- if (value != Base.base(this, 'get_text')) {
- Base.base(this, 'set_text', "B" + value);
+
+;Object.defineProperties(Base.prototype, /** @lends {Base.prototype} */ {
+/** @expose */
+text: {
+get: /** @this {Base} */ function() {
+ return "A" + text;
+},
+set: /** @this {Base} */ function(value) {
+ if (value != text) {
+ org_apache_flex_utils_Language.superSetter(Base, this, 'text', "B" + value);
}
-};
+}}}
+);
/**
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b974c9aa/compiler.jx.tests/test-files/flexjs/projects/super/Super_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/projects/super/Super_result.js b/compiler.jx.tests/test-files/flexjs/projects/super/Super_result.js
index 5a11768..d35c1e0 100644
--- a/compiler.jx.tests/test-files/flexjs/projects/super/Super_result.js
+++ b/compiler.jx.tests/test-files/flexjs/projects/super/Super_result.js
@@ -39,22 +39,25 @@ Super.prototype._text = '';
/**
* @expose
- * @return {string}
+ * @type {string}
*/
-Super.prototype.get_text = function() {
- return this._text;
-};
+Super.prototype.text;
+;
-/**
- * @expose
- * @param {string} value
- */
-Super.prototype.set_text = function(value) {
+
+;Object.defineProperties(Super.prototype, /** @lends {Super.prototype} */ {
+/** @expose */
+text: {
+get: /** @this {Super} */ function() {
+ return this._text;
+},
+set: /** @this {Super} */ function(value) {
if (value != this._text) {
this._text = value;
}
-};
+}}}
+);
/**
@@ -62,4 +65,4 @@ Super.prototype.set_text = function(value) {
*
* @type {Object.<string, Array.<Object>>}
*/
-Super.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'Super', qName: 'Super'}] };
+Super.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'Super', qName: 'Super'}] };
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b974c9aa/compiler.jx.tests/test-files/goog/files/call-super_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/goog/files/call-super_result.js b/compiler.jx.tests/test-files/goog/files/call-super_result.js
index 6b751fb..d877c86 100644
--- a/compiler.jx.tests/test-files/goog/files/call-super_result.js
+++ b/compiler.jx.tests/test-files/goog/files/call-super_result.js
@@ -25,7 +25,7 @@ goog.require('spark.components.Button');
org.apache.flex.A = function(z) {
var self = this;
org.apache.flex.A.base(this, 'constructor', z);
-}
+};
goog.inherits(org.apache.flex.A, spark.components.Button);
/**
@@ -38,4 +38,4 @@ org.apache.flex.A.prototype.hasSuperCall = function(a, b) {
org.apache.flex.A.base(this, 'hasSuperCall', a, b, 100);
var /** @type {string} */ result = myRegularFunctionCall(-1);
return result;
-};
+};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b974c9aa/compiler.jx.tests/test-files/goog/files/output.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/goog/files/output.js b/compiler.jx.tests/test-files/goog/files/output.js
index a2d00e5..af542a3 100644
--- a/compiler.jx.tests/test-files/goog/files/output.js
+++ b/compiler.jx.tests/test-files/goog/files/output.js
@@ -25,7 +25,7 @@ org.apache.flex.A = function() {
var self = this;
org.apache.flex.A.base(this, 'constructor');
self.trace(typeof("a"));
-}
+};
goog.inherits(org.apache.flex.A, spark.components.Button);
/**
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b974c9aa/compiler.jx.tests/test-files/goog/files/poc_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/goog/files/poc_result.js b/compiler.jx.tests/test-files/goog/files/poc_result.js
index 3b983ef..e9d176a 100644
--- a/compiler.jx.tests/test-files/goog/files/poc_result.js
+++ b/compiler.jx.tests/test-files/goog/files/poc_result.js
@@ -26,7 +26,7 @@ Example = function() {
var self = this;
Example.base(this, 'constructor');
self.init();
-}
+};
goog.inherits(Example, spark.components.Group);
/**
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b974c9aa/compiler.jx.tests/test-files/goog/files/qualify-new-object_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/goog/files/qualify-new-object_result.js b/compiler.jx.tests/test-files/goog/files/qualify-new-object_result.js
index b5821e4..e10f9fd 100644
--- a/compiler.jx.tests/test-files/goog/files/qualify-new-object_result.js
+++ b/compiler.jx.tests/test-files/goog/files/qualify-new-object_result.js
@@ -24,7 +24,7 @@ org.apache.flex.A = function() {
var self = this;
org.apache.flex.A.base(this, 'constructor');
self.init();
-}
+};
goog.inherits(org.apache.flex.A, flash.events.EventDispatcher);
/**
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b974c9aa/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index 46a4da9..51a3510 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -121,9 +121,16 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
}
HashMap<String, PropertyNodes> propertyMap = new HashMap<String, PropertyNodes>();
+ HashMap<String, PropertyNodes> staticPropertyMap = new HashMap<String, PropertyNodes>();
ArrayList<String> bindableVars = new ArrayList<String>();
@Override
+ protected void writeIndent()
+ {
+ write(JSFlexJSEmitterTokens.INDENT);
+ }
+
+ @Override
protected String getIndent(int numIndent)
{
final StringBuilder sb = new StringBuilder();
@@ -312,6 +319,63 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
write(ASEmitterTokens.PAREN_CLOSE);
write(ASEmitterTokens.SEMICOLON);
}
+ if (!staticPropertyMap.isEmpty())
+ {
+ write(JSGoogEmitterTokens.OBJECT);
+ write(ASEmitterTokens.MEMBER_ACCESS);
+ write(JSEmitterTokens.DEFINE_PROPERTIES);
+ write(ASEmitterTokens.PAREN_OPEN);
+ String qname = definition.getQualifiedName();
+ write(formatQualifiedName(qname));
+ write(ASEmitterTokens.COMMA);
+ write(ASEmitterTokens.SPACE);
+ write("/** @lends {" + formatQualifiedName(qname) + "} */ ");
+ writeNewline(ASEmitterTokens.BLOCK_OPEN);
+
+ Set<String> propertyNames = staticPropertyMap.keySet();
+ boolean firstTime = true;
+ for (String propName : propertyNames)
+ {
+ if (firstTime)
+ firstTime = false;
+ else
+ writeNewline(ASEmitterTokens.COMMA);
+
+ PropertyNodes p = staticPropertyMap.get(propName);
+ writeNewline("/** @expose */");
+ write(propName);
+ write(ASEmitterTokens.COLON);
+ write(ASEmitterTokens.SPACE);
+ writeNewline(ASEmitterTokens.BLOCK_OPEN);
+ if (p.getter != null)
+ {
+ write(ASEmitterTokens.GET);
+ write(ASEmitterTokens.COLON);
+ write(ASEmitterTokens.SPACE);
+ write(ASEmitterTokens.FUNCTION);
+ emitParameters(p.getter.getParameterNodes());
+
+ emitDefinePropertyFunction(p.getter);
+ }
+ if (p.setter != null)
+ {
+ if (p.getter != null)
+ writeNewline(ASEmitterTokens.COMMA);
+
+ write(ASEmitterTokens.SET);
+ write(ASEmitterTokens.COLON);
+ write(ASEmitterTokens.SPACE);
+ write(ASEmitterTokens.FUNCTION);
+ emitParameters(p.setter.getParameterNodes());
+
+ emitDefinePropertyFunction(p.setter);
+ }
+ write(ASEmitterTokens.BLOCK_CLOSE);
+ }
+ writeNewline(ASEmitterTokens.BLOCK_CLOSE);
+ write(ASEmitterTokens.PAREN_CLOSE);
+ write(ASEmitterTokens.SEMICOLON);
+ }
}
private void loadImportIgnores(String doc)
@@ -1379,12 +1443,15 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
@Override
public void emitGetAccessor(IGetterNode node)
{
+ ModifiersSet modifierSet = node.getDefinition().getModifiers();
+ boolean isStatic = (modifierSet != null && modifierSet.hasModifier(ASModifier.STATIC));
+ HashMap<String, PropertyNodes> map = isStatic ? staticPropertyMap : propertyMap;
String name = node.getName();
- PropertyNodes p = propertyMap.get(name);
+ PropertyNodes p = map.get(name);
if (p == null)
{
p = new PropertyNodes();
- propertyMap.put(name, p);
+ map.put(name, p);
}
p.getter = node;
FunctionNode fn = (FunctionNode) node;
@@ -1394,12 +1461,15 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
@Override
public void emitSetAccessor(ISetterNode node)
{
+ ModifiersSet modifierSet = node.getDefinition().getModifiers();
+ boolean isStatic = (modifierSet != null && modifierSet.hasModifier(ASModifier.STATIC));
+ HashMap<String, PropertyNodes> map = isStatic ? staticPropertyMap : propertyMap;
String name = node.getName();
- PropertyNodes p = propertyMap.get(name);
+ PropertyNodes p = map.get(name);
if (p == null)
{
p = new PropertyNodes();
- propertyMap.put(name, p);
+ map.put(name, p);
}
p.setter = node;
FunctionNode fn = (FunctionNode) node;
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b974c9aa/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
index 58cc59f..b253fbc 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
@@ -101,6 +101,11 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
return new JSGoogDocEmitter(this);
}
+ protected void writeIndent()
+ {
+ write(ASEmitterTokens.INDENT);
+ }
+
//--------------------------------------------------------------------------
//
//--------------------------------------------------------------------------
@@ -493,7 +498,7 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
if (isConstructor && hasSuperClass)
{
- writeNewline();
+ writeNewline(ASEmitterTokens.SEMICOLON);
write(JSGoogEmitterTokens.GOOG_INHERITS);
write(ASEmitterTokens.PAREN_OPEN);
write(formatQualifiedName(qname));
@@ -736,7 +741,7 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
if (!hasBody(node))
{
indentPush();
- write(ASEmitterTokens.INDENT);
+ writeIndent();
}
List<IParameterNode> parameters = new ArrayList<IParameterNode>(
[02/18] git commit: [flex-falcon] [refs/heads/develop] - need to
handle parens on things other than binary operators
Posted by ah...@apache.org.
need to handle parens on things other than binary operators
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/1562c8c4
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/1562c8c4
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/1562c8c4
Branch: refs/heads/develop
Commit: 1562c8c48cb64ac99ed1731c06730a9d6d902dc4
Parents: 4faba4a
Author: Alex Harui <ah...@apache.org>
Authored: Tue Mar 24 22:43:13 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Mar 24 22:43:13 2015 -0700
----------------------------------------------------------------------
compiler.jx/src/org/apache/flex/compiler/utils/ASNodeUtils.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1562c8c4/compiler.jx/src/org/apache/flex/compiler/utils/ASNodeUtils.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/utils/ASNodeUtils.java b/compiler.jx/src/org/apache/flex/compiler/utils/ASNodeUtils.java
index d847f4a..eb46626 100644
--- a/compiler.jx/src/org/apache/flex/compiler/utils/ASNodeUtils.java
+++ b/compiler.jx/src/org/apache/flex/compiler/utils/ASNodeUtils.java
@@ -27,6 +27,7 @@ import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
import org.apache.flex.compiler.tree.as.IBlockNode;
import org.apache.flex.compiler.tree.as.IConditionalNode;
import org.apache.flex.compiler.tree.as.IExpressionNode;
+import org.apache.flex.compiler.tree.as.IOperatorNode;
import org.apache.flex.compiler.tree.as.ISwitchNode;
import org.apache.flex.compiler.tree.as.ITerminalNode;
@@ -72,14 +73,14 @@ public class ASNodeUtils
return null;
}
- public static boolean hasParenOpen(IBinaryOperatorNode node)
+ public static boolean hasParenOpen(IOperatorNode node)
{
return node.hasParenthesis();
//return node.getParent() instanceof IBinaryOperatorNode
// && !ASNodeUtils.isString(node.getRightOperandNode());
}
- public static boolean hasParenClose(IBinaryOperatorNode node)
+ public static boolean hasParenClose(IOperatorNode node)
{
return node.hasParenthesis();
//return node.getParent() instanceof IBinaryOperatorNode
[07/18] git commit: [flex-falcon] [refs/heads/develop] - use more
recent GCC dependency options. We no longer need to compute deps.js,
but we get more goog.require warnings which we now suppress when we remove
circular goog.requires
Posted by ah...@apache.org.
use more recent GCC dependency options. We no longer need to compute deps.js, but we get more goog.require warnings which we now suppress when we remove circular goog.requires
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/8e68d5de
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/8e68d5de
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/8e68d5de
Branch: refs/heads/develop
Commit: 8e68d5dec4e8b0ca4bec371d1275e93440c6ac32
Parents: e7deb06
Author: Alex Harui <ah...@apache.org>
Authored: Tue Mar 24 22:53:42 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Mar 24 22:53:42 2015 -0700
----------------------------------------------------------------------
.../mxml/flexjs/MXMLFlexJSPublisher.java | 33 ++++-
.../compiler/internal/graph/GoogDepsWriter.java | 141 +++++++++++++++++--
.../utils/JSClosureCompilerWrapper.java | 14 +-
.../utils/VF2JSClosureCompilerWrapper.java | 2 +-
4 files changed, 168 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8e68d5de/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
index 0432bd0..6e1c7eb 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
@@ -269,6 +269,12 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements
GoogDepsWriter gdw = new GoogDepsWriter(intermediateDir, projectName, (JSGoogConfiguration) configuration);
try
{
+ ArrayList<String> fileList = gdw.getListOfFiles();
+ for (String file : fileList)
+ {
+ compilerWrapper.addJSSourceFile(file);
+ }
+ /*
StringBuilder depsFileData = new StringBuilder();
ok = gdw.generateDeps(problems, depsFileData);
if (!subsetGoog)
@@ -355,7 +361,7 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements
FileUtils.copyFileToDirectory(file, new File(dir));
compilerWrapper.addJSSourceFile(file.getCanonicalPath());
}
- }
+ }*/
}
catch (InterruptedException e)
{
@@ -385,6 +391,7 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements
writeCSS(projectName, intermediateDirPath);
writeCSS(projectName, releaseDirPath);
+ /*
if (!subsetGoog)
{
// (erikdebruin) add 'goog' files
@@ -396,22 +403,33 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements
compilerWrapper.addJSSourceFile(file.getCanonicalPath());
}
}
+ */
+ Collection<File> files = org.apache.commons.io.FileUtils.listFiles(new File(
+ closureGoogSrcLibDirPath), new RegexFileFilter("^.*(\\.js)"),
+ DirectoryFileFilter.DIRECTORY);
+ for (File file : files)
+ {
+ compilerWrapper.addJSSourceFile(file.getCanonicalPath());
+ }
+ /*
// (erikdebruin) add project files
for (String filePath : gdw.filePathsInOrder)
{
compilerWrapper.addJSSourceFile(
new File(filePath).getCanonicalPath());
}
+ */
compilerWrapper.setOptions(
- projectReleaseJSFilePath, useStrictPublishing);
+ projectReleaseJSFilePath, useStrictPublishing, projectName);
+ /*
// (erikdebruin) Include the 'goog' deps to allow the compiler to resolve
// dependencies.
compilerWrapper.addJSSourceFile(
closureGoogSrcLibDirPath + File.separator + "deps.js");
-
+ */
List<String> externs = ((JSGoogConfiguration)configuration).getExternalJSLib();
for (String extern : externs)
{
@@ -423,6 +441,7 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements
appendSourceMapLocation(projectReleaseJSFilePath, projectName);
+ /*
if (!isMarmotinniRun)
{
String allDeps = "";
@@ -435,8 +454,9 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements
org.apache.commons.io.FileUtils.deleteQuietly(new File(depsTgtFilePath));
}
-
- if (ok)
+ */
+
+ //if (ok)
System.out.println("The project '"
+ projectName
+ "' has been successfully compiled and optimized.");
@@ -444,6 +464,7 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements
return true;
}
+ /*
private void addDeps(ArrayList<DependencyRecord> subsetdeps, HashMap<String, String> gotgoog,
HashMap<String, DependencyRecord> defmap, String deps)
{
@@ -464,7 +485,7 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements
addDeps(subsetdeps, gotgoog, defmap, deprec.deps);
}
}
- }
+ }*/
private void appendExportSymbol(String path, String projectName)
throws IOException
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8e68d5de/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java b/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
index 53a216e..cd036be 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/graph/GoogDepsWriter.java
@@ -176,19 +176,89 @@ public class GoogDepsWriter {
List<String> fileLines = Files.readLines(new File(gd.filePath), Charset.defaultCharset());
ArrayList<String> finalLines = new ArrayList<String>();
- String inherits = getBaseClass(fileLines, className);
-
+ FileInfo fi = getBaseClass(fileLines, className);
+ int suppressCount = 0;
+ int i = 0;
for (String line : fileLines)
{
- int c = line.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
- if (c > -1)
- {
- int c2 = line.indexOf(")");
- String s = line.substring(c + 14, c2 - 1);
- if (circulars.contains(s) && !s.equals(inherits))
- continue;
- }
+ if (i < fi.constructorLine)
+ {
+ int c = line.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+ if (c > -1)
+ {
+ int c2 = line.indexOf(")");
+ String s = line.substring(c + 14, c2 - 1);
+ if (circulars.contains(s) && !s.equals(fi.inherits))
+ {
+ suppressCount++;
+ continue;
+ }
+ }
+ }
finalLines.add(line);
+ i++;
+ }
+ if (suppressCount > 0)
+ {
+ if (fi.suppressLine > 0)
+ {
+ if (fi.suppressLine < fi.constructorLine)
+ {
+ String line = finalLines.get(fi.suppressLine);
+ int c = line.indexOf("@suppress {");
+ if (c > -1)
+ {
+ if (!line.contains("missingRequire"))
+ {
+ line = line.substring(0, c) + "@suppress {missingRequire|" + line.substring(c + 11);
+ finalLines.remove(fi.suppressLine);
+ finalLines.add(fi.suppressLine, line);
+ }
+ }
+ else
+ System.out.println("Confused by @suppress in " + className);
+ }
+ else
+ {
+ // the @suppress was for the constructor or some other thing so add a top-level
+ // @suppress
+ if (fi.fileoverviewLine > -1)
+ {
+ // there is already a fileOverview but no @suppress
+ finalLines.add(fi.fileoverviewLine + 1, " * @suppress {missingRequire}");
+ }
+ else if (fi.googProvideLine > -1)
+ {
+ finalLines.add(fi.googProvideLine, " */");
+ finalLines.add(fi.googProvideLine, " * @suppress {missingRequire}");
+ finalLines.add(fi.googProvideLine, " * @fileoverview");
+ finalLines.add(fi.googProvideLine, "/**");
+ }
+ else
+ {
+ System.out.println("Confused by @suppress in " + className);
+ }
+ }
+ }
+ else
+ {
+ if (fi.fileoverviewLine > -1)
+ {
+ // there is already a fileoverview but no @suppress
+ finalLines.add(fi.fileoverviewLine + 1, " * @suppress {missingRequire}");
+ }
+ else if (fi.googProvideLine > -1)
+ {
+ finalLines.add(fi.googProvideLine, " */");
+ finalLines.add(fi.googProvideLine, " * @suppress {missingRequire}");
+ finalLines.add(fi.googProvideLine, " * @fileoverview");
+ finalLines.add(fi.googProvideLine, "/**");
+ }
+ else
+ {
+ System.out.println("Confused by @suppress in " + className);
+ }
+ }
}
File file = new File(gd.filePath);
PrintWriter out = new PrintWriter(new FileWriter(file));
@@ -207,9 +277,15 @@ public class GoogDepsWriter {
}
}
- String getBaseClass(List<String> lines, String className)
+ FileInfo getBaseClass(List<String> lines, String className)
{
+ FileInfo fi = new FileInfo();
+
int n = lines.size();
+ fi.constructorLine = n;
+ fi.suppressLine = -1;
+ fi.fileoverviewLine = -1;
+ fi.googProvideLine = -1;
for (int i = 0; i < n; i++)
{
String line = lines.get(i);
@@ -232,10 +308,41 @@ public class GoogDepsWriter {
}
c = inheritLine.indexOf(",");
c2 = inheritLine.indexOf(")");
- return inheritLine.substring(c + 1, c2).trim();
+ fi.inherits = inheritLine.substring(c + 1, c2).trim();
+ return fi;
+ }
+ else
+ {
+ c = line.indexOf("@constructor");
+ if (c > -1)
+ fi.constructorLine = i;
+ else
+ {
+ c = line.indexOf("@interface");
+ if (c > -1)
+ fi.constructorLine = i;
+ else
+ {
+ c = line.indexOf("@suppress");
+ if (c > -1)
+ fi.suppressLine = i;
+ else
+ {
+ c = line.indexOf("@fileoverview");
+ if (c > -1)
+ fi.fileoverviewLine = i;
+ else
+ {
+ c = line.indexOf("goog.provide");
+ if (c > -1)
+ fi.googProvideLine = i;
+ }
+ }
+ }
+ }
}
}
- return null;
+ return fi;
}
String getFilePath(String className)
@@ -403,4 +510,12 @@ public class GoogDepsWriter {
public ArrayList<String> deps;
}
+ private class FileInfo
+ {
+ public String inherits;
+ public int constructorLine;
+ public int suppressLine;
+ public int fileoverviewLine;
+ public int googProvideLine;
+ }
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8e68d5de/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java b/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
index 30d976c..b16522a 100644
--- a/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
+++ b/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
@@ -31,6 +31,7 @@ import com.google.javascript.jscomp.CommandLineRunner;
import com.google.javascript.jscomp.CompilationLevel;
import com.google.javascript.jscomp.Compiler;
import com.google.javascript.jscomp.CompilerOptions;
+import com.google.javascript.jscomp.DependencyOptions;
import com.google.javascript.jscomp.DiagnosticGroups;
import com.google.javascript.jscomp.FlexJSDiagnosticGroups;
import com.google.javascript.jscomp.SourceFile;
@@ -141,7 +142,7 @@ public class JSClosureCompilerWrapper
options_.setExtraAnnotationNames(Arrays.asList(asdocTags));
}
- public void setOptions(String sourceMapPath, boolean useStrictPublishing)
+ public void setOptions(String sourceMapPath, boolean useStrictPublishing, String projectName)
{
if (useStrictPublishing)
{
@@ -186,6 +187,15 @@ public class JSClosureCompilerWrapper
options_.setOptimizeCalls(true);
options_.setOptimizeArgumentsArray(true);
+ DependencyOptions dopts = new DependencyOptions();
+ ArrayList<String> entryPoints = new ArrayList<String>();
+ entryPoints.add(projectName);
+ dopts.setDependencyPruning(true)
+ .setDependencySorting(true)
+ .setMoocherDropping(true)
+ .setEntryPoints(entryPoints);
+ options_.setDependencyOptions(dopts);
+
// warnings already activated in previous incarnation
options_.setWarningLevel(DiagnosticGroups.ACCESS_CONTROLS, CheckLevel.WARNING);
options_.setWarningLevel(DiagnosticGroups.CONST, CheckLevel.WARNING);
@@ -197,7 +207,7 @@ public class JSClosureCompilerWrapper
// the 'full' set of warnings
options_.setWarningLevel(DiagnosticGroups.AMBIGUOUS_FUNCTION_DECL, CheckLevel.WARNING);
options_.setWarningLevel(DiagnosticGroups.CHECK_EVENTFUL_OBJECT_DISPOSAL, CheckLevel.WARNING);
- options_.setWarningLevel(DiagnosticGroups.CHECK_PROVIDES, CheckLevel.WARNING);
+ options_.setWarningLevel(DiagnosticGroups.MISSING_PROVIDE, CheckLevel.WARNING);
options_.setWarningLevel(DiagnosticGroups.CHECK_REGEXP, CheckLevel.WARNING);
options_.setWarningLevel(DiagnosticGroups.CHECK_STRUCT_DICT_INHERITANCE, CheckLevel.WARNING);
options_.setWarningLevel(DiagnosticGroups.CHECK_TYPES, CheckLevel.WARNING);
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8e68d5de/compiler.jx/src/org/apache/flex/compiler/utils/VF2JSClosureCompilerWrapper.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/utils/VF2JSClosureCompilerWrapper.java b/compiler.jx/src/org/apache/flex/compiler/utils/VF2JSClosureCompilerWrapper.java
index cdbdba6..9b188b9 100644
--- a/compiler.jx/src/org/apache/flex/compiler/utils/VF2JSClosureCompilerWrapper.java
+++ b/compiler.jx/src/org/apache/flex/compiler/utils/VF2JSClosureCompilerWrapper.java
@@ -183,7 +183,7 @@ public class VF2JSClosureCompilerWrapper
// the 'full' set of warnings
options_.setWarningLevel(DiagnosticGroups.AMBIGUOUS_FUNCTION_DECL, CheckLevel.WARNING);
options_.setWarningLevel(DiagnosticGroups.CHECK_EVENTFUL_OBJECT_DISPOSAL, CheckLevel.WARNING);
- options_.setWarningLevel(DiagnosticGroups.CHECK_PROVIDES, CheckLevel.WARNING);
+ options_.setWarningLevel(DiagnosticGroups.MISSING_PROVIDE, CheckLevel.WARNING);
options_.setWarningLevel(DiagnosticGroups.CHECK_REGEXP, CheckLevel.WARNING);
options_.setWarningLevel(DiagnosticGroups.CHECK_STRUCT_DICT_INHERITANCE, CheckLevel.WARNING);
options_.setWarningLevel(DiagnosticGroups.CHECK_TYPES, CheckLevel.WARNING);
[13/18] git commit: [flex-falcon] [refs/heads/develop] - use @expose
and remove single quotes in defineProperties structures.
Posted by ah...@apache.org.
use @expose and remove single quotes in defineProperties structures.
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/8eefb001
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/8eefb001
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/8eefb001
Branch: refs/heads/develop
Commit: 8eefb001a0eda7d1b70da98b51342db362067e23
Parents: 42de259
Author: Alex Harui <ah...@apache.org>
Authored: Tue Apr 7 11:15:39 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Apr 7 11:15:39 2015 -0700
----------------------------------------------------------------------
.../internal/codegen/js/flexjs/JSFlexJSEmitter.java | 9 +++++----
.../internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java | 5 +++--
2 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8eefb001/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index cbf89b6..46a4da9 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -243,6 +243,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
write(JSEmitterTokens.PROTOTYPE);
write(ASEmitterTokens.COMMA);
write(ASEmitterTokens.SPACE);
+ write("/** @lends {" + formatQualifiedName(qname) + ".prototype} */ ");
writeNewline(ASEmitterTokens.BLOCK_OPEN);
Set<String> propertyNames = propertyMap.keySet();
@@ -255,9 +256,8 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
writeNewline(ASEmitterTokens.COMMA);
PropertyNodes p = propertyMap.get(propName);
- write(ASEmitterTokens.SINGLE_QUOTE);
+ writeNewline("/** @expose */");
write(propName);
- write(ASEmitterTokens.SINGLE_QUOTE);
write(ASEmitterTokens.COLON);
write(ASEmitterTokens.SPACE);
writeNewline(ASEmitterTokens.BLOCK_OPEN);
@@ -466,6 +466,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
write(JSEmitterTokens.PROTOTYPE);
write(ASEmitterTokens.COMMA);
write(ASEmitterTokens.SPACE);
+ write("/** @lends {" + formatQualifiedName(qname) + ".prototype} */ ");
writeNewline(ASEmitterTokens.BLOCK_OPEN);
boolean firstTime = true;
@@ -488,8 +489,8 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
private void emitBindableVarDefineProperty(String name, IClassDefinition cdef)
{
// 'PropName': {
- writeNewline(ASEmitterTokens.SINGLE_QUOTE.getToken() + name +
- ASEmitterTokens.SINGLE_QUOTE.getToken() +
+ writeNewline("/** @expose */");
+ writeNewline(name +
ASEmitterTokens.COLON.getToken() +
ASEmitterTokens.SPACE.getToken() +
ASEmitterTokens.BLOCK_OPEN.getToken());
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/8eefb001/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index cf5d3df..55d830a 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -853,7 +853,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
write("Object.defineProperties(");
write(formattedCName);
- writeNewline(".prototype, {");
+ writeNewline(".prototype, /** @lends {" + formattedCName + ".prototype} */ {");
indentPush();
int i = 0;
for (MXMLDescriptorSpecifier instance : instances)
@@ -862,7 +862,8 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
.getToken()))
{
indentPush();
- writeNewline("'" + instance.id + "': {");
+ writeNewline("/** @expose */");
+ writeNewline(instance.id + ": {");
writeNewline("/** @this {" + formattedCName + "} */");
indentPush();
writeNewline("get: function() {");
[12/18] git commit: [flex-falcon] [refs/heads/develop] - turn on es5
strict
Posted by ah...@apache.org.
turn on es5 strict
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/42de2596
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/42de2596
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/42de2596
Branch: refs/heads/develop
Commit: 42de259648d91c13369f72a55be7e9792f254693
Parents: d9658d6
Author: Alex Harui <ah...@apache.org>
Authored: Tue Apr 7 11:14:15 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Apr 7 11:14:15 2015 -0700
----------------------------------------------------------------------
.../org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/42de2596/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java b/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
index b16522a..b4c7d5e 100644
--- a/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
+++ b/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
@@ -31,6 +31,7 @@ import com.google.javascript.jscomp.CommandLineRunner;
import com.google.javascript.jscomp.CompilationLevel;
import com.google.javascript.jscomp.Compiler;
import com.google.javascript.jscomp.CompilerOptions;
+import com.google.javascript.jscomp.CompilerOptions.LanguageMode;
import com.google.javascript.jscomp.DependencyOptions;
import com.google.javascript.jscomp.DiagnosticGroups;
import com.google.javascript.jscomp.FlexJSDiagnosticGroups;
@@ -153,7 +154,7 @@ public class JSClosureCompilerWrapper
"goog.DEBUG", new Node(Token.TRUE));
// ToDo (erikdebruin): re-evaluate this option on future GC release
- //options_.setLanguageIn(LanguageMode.ECMASCRIPT6_STRICT);
+ options_.setLanguageIn(LanguageMode.ECMASCRIPT5_STRICT);
options_.setPreferSingleQuotes(true);