Re: [4/5] git commit: [flex-falcon] [refs/heads/develop] - compiler.jx: added support for functions and variables in packages, and functions and variables after package (similar to internal classes)
I haven't done thorough research, but I think this change is causing the last remaining failure in the Falcon build. The failing case is org.apache.flex.compiler.internal.codegen.js.vf2js.TestVF2JSFile.testVersio n in compiler.jx.tests. The test case is dealing with an variable defined in an included file which has means the parent of the variable node will be a file node and look a lot like a file-level definition when it isn't. -Alex On 1/11/16, 11:54 AM, "joshtynj...@apache.org"wrote: >compiler.jx: added support for functions and variables in packages, and >functions and variables after package (similar to internal classes) > > >Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo >Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/56060782 >Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/56060782 >Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/56060782 > >Branch: refs/heads/develop >Commit: 5606078243b62fd965bf83f6e39993140d01de76 >Parents: 8a7bdc6 >Author: Josh Tynjala >Authored: Mon Jan 11 11:54:37 2016 -0800 >Committer: Josh Tynjala >Committed: Mon Jan 11 11:54:37 2016 -0800 > >-- > .../internal/codegen/as/ASBlockWalker.java | 20 ++-- > .../codegen/js/flexjs/JSFlexJSEmitter.java | 10 ++ > .../codegen/js/jx/PackageHeaderEmitter.java | 33 ++-- > 3 files changed, 49 insertions(+), 14 deletions(-) >-- > > >http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/56060782/compiler. >jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java >-- >diff --git >a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalk >er.java >b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalk >er.java >index fec44cc..b405bb0 100644 >--- >a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalk >er.java >+++ >b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalk >er.java >@@ -190,7 +190,9 @@ public class ASBlockWalker implements >IASBlockVisitor, IASBlockWalker > if (pnode != null && > (pnode instanceof IPackageNode || >pnode instanceof IInterfaceNode || >- pnode instanceof IClassNode)) >+ pnode instanceof IClassNode || >+ pnode instanceof IFunctionNode || >+ pnode instanceof IVariableNode)) > { > walk(pnode); > >@@ -238,11 +240,9 @@ public class ASBlockWalker implements >IASBlockVisitor, IASBlockWalker > public void visitVariable(IVariableNode node) > { > debug("visitVariable()"); >-if (SemanticUtils.isPackageDefinition(node.getDefinition())) >-{ >-//TODO: emit package-level variable >-} >-else if (SemanticUtils.isMemberDefinition(node.getDefinition())) >+if (SemanticUtils.isPackageDefinition(node.getDefinition()) || >+SemanticUtils.isMemberDefinition(node.getDefinition()) || >+node.getParent() instanceof IFileNode) > { > emitter.emitField(node); > } >@@ -256,11 +256,9 @@ public class ASBlockWalker implements >IASBlockVisitor, IASBlockWalker > public void visitFunction(IFunctionNode node) > { > debug("visitFunction()"); >-if (SemanticUtils.isPackageDefinition(node.getDefinition())) >-{ >-//TODO: emit package-level function >-} >-else if >(DefinitionUtils.isMemberDefinition(node.getDefinition())) >+if (SemanticUtils.isPackageDefinition(node.getDefinition()) || >+DefinitionUtils.isMemberDefinition(node.getDefinition()) || >+node.getParent() instanceof IFileNode) > { > emitter.emitMethod(node); > } > >http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/56060782/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/JSFl >exJSEmitter.java >b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFl >exJSEmitter.java >index a101a4c..1de63fe 100644 >--- >a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFl >exJSEmitter.java >+++ >b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFl >exJSEmitter.java >@@ -342,6 +342,16 @@ public class JSFlexJSEmitter extends JSGoogEmitter >implements IJSFlexJSEmitter > String className = >
Re: [4/5] git commit: [flex-falcon] [refs/heads/develop] - compiler.jx: added support for functions and variables in packages, and functions and variables after package (similar to internal classes)
Josh, does this commit resolve https://issues.apache.org/jira/browse/FLEX-35004 ? On Tue, Jan 12, 2016 at 11:24 AM, Alex Haruiwrote: > I haven't done thorough research, but I think this change is causing the > last remaining failure in the Falcon build. The failing case is > org.apache.flex.compiler.internal.codegen.js.vf2js.TestVF2JSFile.testVersio > n in compiler.jx.tests. The test case is dealing with an variable defined > in an included file which has means the parent of the variable node will > be a file node and look a lot like a file-level definition when it isn't. > > -Alex > > On 1/11/16, 11:54 AM, "joshtynj...@apache.org" > wrote: > > >compiler.jx: added support for functions and variables in packages, and > >functions and variables after package (similar to internal classes) > > > > > >Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo > >Commit: > http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/56060782 > >Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/56060782 > >Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/56060782 > > > >Branch: refs/heads/develop > >Commit: 5606078243b62fd965bf83f6e39993140d01de76 > >Parents: 8a7bdc6 > >Author: Josh Tynjala > >Authored: Mon Jan 11 11:54:37 2016 -0800 > >Committer: Josh Tynjala > >Committed: Mon Jan 11 11:54:37 2016 -0800 > > > >-- > > .../internal/codegen/as/ASBlockWalker.java | 20 ++-- > > .../codegen/js/flexjs/JSFlexJSEmitter.java | 10 ++ > > .../codegen/js/jx/PackageHeaderEmitter.java | 33 ++-- > > 3 files changed, 49 insertions(+), 14 deletions(-) > >-- > > > > > >http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/56060782/compiler > . > >jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java > >-- > >diff --git > >a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalk > >er.java > >b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalk > >er.java > >index fec44cc..b405bb0 100644 > >--- > >a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalk > >er.java > >+++ > >b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalk > >er.java > >@@ -190,7 +190,9 @@ public class ASBlockWalker implements > >IASBlockVisitor, IASBlockWalker > > if (pnode != null && > > (pnode instanceof IPackageNode || > >pnode instanceof IInterfaceNode || > >- pnode instanceof IClassNode)) > >+ pnode instanceof IClassNode || > >+ pnode instanceof IFunctionNode || > >+ pnode instanceof IVariableNode)) > > { > > walk(pnode); > > > >@@ -238,11 +240,9 @@ public class ASBlockWalker implements > >IASBlockVisitor, IASBlockWalker > > public void visitVariable(IVariableNode node) > > { > > debug("visitVariable()"); > >-if (SemanticUtils.isPackageDefinition(node.getDefinition())) > >-{ > >-//TODO: emit package-level variable > >-} > >-else if (SemanticUtils.isMemberDefinition(node.getDefinition())) > >+if (SemanticUtils.isPackageDefinition(node.getDefinition()) || > >+SemanticUtils.isMemberDefinition(node.getDefinition()) || > >+node.getParent() instanceof IFileNode) > > { > > emitter.emitField(node); > > } > >@@ -256,11 +256,9 @@ public class ASBlockWalker implements > >IASBlockVisitor, IASBlockWalker > > public void visitFunction(IFunctionNode node) > > { > > debug("visitFunction()"); > >-if (SemanticUtils.isPackageDefinition(node.getDefinition())) > >-{ > >-//TODO: emit package-level function > >-} > >-else if > >(DefinitionUtils.isMemberDefinition(node.getDefinition())) > >+if (SemanticUtils.isPackageDefinition(node.getDefinition()) || > >+DefinitionUtils.isMemberDefinition(node.getDefinition()) || > >+node.getParent() instanceof IFileNode) > > { > > emitter.emitMethod(node); > > } > > > >http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/56060782/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/JSFl > >exJSEmitter.java > >b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFl > >exJSEmitter.java > >index a101a4c..1de63fe 100644 > >--- >
[4/5] git commit: [flex-falcon] [refs/heads/develop] - compiler.jx: added support for functions and variables in packages, and functions and variables after package (similar to internal classes)
compiler.jx: added support for functions and variables in packages, and functions and variables after package (similar to internal classes) Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/56060782 Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/56060782 Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/56060782 Branch: refs/heads/develop Commit: 5606078243b62fd965bf83f6e39993140d01de76 Parents: 8a7bdc6 Author: Josh TynjalaAuthored: Mon Jan 11 11:54:37 2016 -0800 Committer: Josh Tynjala Committed: Mon Jan 11 11:54:37 2016 -0800 -- .../internal/codegen/as/ASBlockWalker.java | 20 ++-- .../codegen/js/flexjs/JSFlexJSEmitter.java | 10 ++ .../codegen/js/jx/PackageHeaderEmitter.java | 33 ++-- 3 files changed, 49 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/56060782/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java -- diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java index fec44cc..b405bb0 100644 --- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java +++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java @@ -190,7 +190,9 @@ public class ASBlockWalker implements IASBlockVisitor, IASBlockWalker if (pnode != null && (pnode instanceof IPackageNode || pnode instanceof IInterfaceNode || -pnode instanceof IClassNode)) +pnode instanceof IClassNode || + pnode instanceof IFunctionNode || + pnode instanceof IVariableNode)) { walk(pnode); @@ -238,11 +240,9 @@ public class ASBlockWalker implements IASBlockVisitor, IASBlockWalker public void visitVariable(IVariableNode node) { debug("visitVariable()"); -if (SemanticUtils.isPackageDefinition(node.getDefinition())) -{ -//TODO: emit package-level variable -} -else if (SemanticUtils.isMemberDefinition(node.getDefinition())) +if (SemanticUtils.isPackageDefinition(node.getDefinition()) || +SemanticUtils.isMemberDefinition(node.getDefinition()) || +node.getParent() instanceof IFileNode) { emitter.emitField(node); } @@ -256,11 +256,9 @@ public class ASBlockWalker implements IASBlockVisitor, IASBlockWalker public void visitFunction(IFunctionNode node) { debug("visitFunction()"); -if (SemanticUtils.isPackageDefinition(node.getDefinition())) -{ -//TODO: emit package-level function -} -else if (DefinitionUtils.isMemberDefinition(node.getDefinition())) +if (SemanticUtils.isPackageDefinition(node.getDefinition()) || +DefinitionUtils.isMemberDefinition(node.getDefinition()) || +node.getParent() instanceof IFileNode) { emitter.emitMethod(node); } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/56060782/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 a101a4c..1de63fe 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 @@ -342,6 +342,16 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter String className = ((IInterfaceNode)pnode).getQualifiedName(); getModel().getInternalClasses().put(className, mainClassName + "." + className); } +else if (pnode instanceof IFunctionNode) +{ +String className = ((IFunctionNode)pnode).getQualifiedName(); +getModel().getInternalClasses().put(className, mainClassName + "." + className); +} +else if (pnode instanceof IVariableNode) +{ +String className = ((IVariableNode)pnode).getQualifiedName(); +getModel().getInternalClasses().put(className, mainClassName + "." +