Awesome!  Any chance you can put up the working demo onto your people.a.o
site?  Makes it easier for folks to see what's happening.

Thanks,
Om
On Mar 27, 2013 4:15 PM, "Erik de Bruin" <e...@ixsoftware.nl> wrote:

> Forgot to mention this in the commit message: this goes only for the
> 'js-debug' code. The 'js-release' code has some more issues that
> currently prevent it from showing the view in the browser.
>
> EdB
>
>
>
> On Thu, Mar 28, 2013 at 12:07 AM,  <erikdebr...@apache.org> wrote:
> > Updated Branches:
> >   refs/heads/develop d8bb65f1e -> 112d8ca7f
> >
> >
> > FlexJS application now shows in browser
> >
> > Fixed various issues related to JS errors that prevented the FlexJS
> application from showing it's view in the browser. Note: although the view
> components are displayed as expected, none of the functionality is working.
> >
> > Signed-off-by: Erik de Bruin <e...@ixsoftware.nl>
> >
> >
> > Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
> > Commit:
> http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/112d8ca7
> > Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/112d8ca7
> > Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/112d8ca7
> >
> > Branch: refs/heads/develop
> > Commit: 112d8ca7ff1e218404e964f9242a104acee20311
> > Parents: d8bb65f
> > Author: Erik de Bruin <e...@ixsoftware.nl>
> > Authored: Thu Mar 28 00:07:11 2013 +0100
> > Committer: Erik de Bruin <e...@ixsoftware.nl>
> > Committed: Thu Mar 28 00:07:11 2013 +0100
> >
> > ----------------------------------------------------------------------
> >  .../codegen/js/flexjs/TestFlexJSAccessors.java     |   12 +++---
> >  .../codegen/js/flexjs/TestFlexJSClass.java         |    9 ++++
> >  .../codegen/js/flexjs/TestFlexJSExpressions.java   |   33 ++++++++++++++
> >  .../codegen/js/flexjs/TestFlexJSMethodMembers.java |   34
> +++++++++++++++
> >  .../codegen/js/flexjs/JSFlexJSEmitter.java         |   18 +++++++-
> >  .../codegen/mxml/flexjs/MXMLFlexJSPublisher.java   |    8 +++-
> >  6 files changed, 106 insertions(+), 8 deletions(-)
> > ----------------------------------------------------------------------
> >
> >
> >
> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/112d8ca7/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 cee5079..6e3e842 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
> > @@ -46,10 +46,10 @@ public class TestFlexJSAccessors extends ASTestBase
> >      public void testSetAccessorWithMemberAccessOnLeftSide()
> >      {
> >          IClassNode node = (IClassNode) getNode(
> > -                "public function A() {}; 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_CLASS);
> > +                "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 */\nA = function()
> {\n};\n\n/**\n * @this {A}\n */\nA.prototype.doStuff = function() {\n\tvar
> self = this;\n\tthis.set_label(get_label() + 'bye');\n\tvar /** @type
> {string} */ theLabel = get_label();\n};\n\n/**\n * @private\n * @type
> {string}\n */\nA.prototype._label;\n\nA.prototype.get_label = function()
> {\n\tvar self = this;\n\treturn _label;\n};\n\nA.prototype.set_label =
> function(value) {\n\tvar self = this;\n\t_label = value;\n};";
> > +        String expected = "/**\n * @constructor\n */\nB = function()
> {\n};\n\n/**\n * @this {B}\n */\nB.prototype.doStuff = function() {\n\tvar
> self = this;\n\tself.set_label(self.get_label() + 'bye');\n\tvar /** @type
> {string} */ theLabel = self.get_label();\n};\n\n/**\n * @private\n * @type
> {string}\n */\nB.prototype._label;\n\nB.prototype.get_label = function()
> {\n\tvar self = this;\n\treturn self._label;\n};\n\nB.prototype.set_label =
> function(value) {\n\tvar self = this;\n\tself._label = value;\n};";
> >          assertOut(expected);
> >      }
> >
> > @@ -68,10 +68,10 @@ public class TestFlexJSAccessors extends ASTestBase
> >      public void testSetAccessorWithMemberAccessOnRightSide()
> >      {
> >          IClassNode node = (IClassNode) getNode(
> > -                "public function A() {}; 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_CLASS);
> > +                "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 */\nA = function()
> {\n};\n\n/**\n * @this {A}\n */\nA.prototype.doStuff = function() {\n\tvar
> self = this;\n\tset_label(this.get_label());\n\tvar /** @type {string} */
> theLabel = get_label();\n};\n\n/**\n * @private\n * @type {string}\n
> */\nA.prototype._label;\n\nA.prototype.get_label = function() {\n\tvar self
> = this;\n\treturn _label;\n};\n\nA.prototype.set_label = function(value)
> {\n\tvar self = this;\n\t_label = value;\n};";
> > +        String expected = "/**\n * @constructor\n */\nB = function()
> {\n};\n\n/**\n * @this {B}\n */\nB.prototype.doStuff = function() {\n\tvar
> self = this;\n\tself.set_label(self.get_label());\n\tvar /** @type {string}
> */ theLabel = self.get_label();\n};\n\n/**\n * @private\n * @type
> {string}\n */\nB.prototype._label;\n\nB.prototype.get_label = function()
> {\n\tvar self = this;\n\treturn self._label;\n};\n\nB.prototype.set_label =
> function(value) {\n\tvar self = this;\n\tself._label = value;\n};";
> >          assertOut(expected);
> >      }
> >
> >
> >
> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/112d8ca7/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 a1a759a..7aed95a 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
> > @@ -31,6 +31,15 @@ import org.junit.Test;
> >  public class TestFlexJSClass extends TestGoogClass
> >  {
> >
> > +    @Test
> > +    public void testConstructor_withArgumentNameMatchingMemberName()
> > +    {
> > +        IClassNode node = getClassNode("public class B {public function
> B(arg1:String) {this.arg1 = arg1}; public var arg1:String;}");
> > +        asBlockWalker.visitClass(node);
> > +        String expected = "/**\n * @constructor\n * @param {string}
> arg1\n */\norg.apache.flex.B = function(arg1) {\n\tvar self =
> this;\n\tself.arg1 = arg1;\n};\n\n/**\n * @type {string}\n
> */\norg.apache.flex.B.prototype.arg1;";
> > +        assertOut(expected);
> > +    }
> > +
> >      @Override
> >      @Test
> >      public void testAccessors()
> >
> >
> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/112d8ca7/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 c96bf60..6968c38 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
> > @@ -24,6 +24,7 @@ import
> org.apache.flex.compiler.internal.codegen.js.goog.TestGoogExpressions;
> >  import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend;
> >  import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
> >  import org.apache.flex.compiler.tree.as.IFunctionNode;
> > +import org.apache.flex.compiler.tree.as.IMemberAccessExpressionNode;
> >  import org.junit.Test;
> >
> >  /**
> > @@ -34,6 +35,38 @@ public class TestFlexJSExpressions extends
> TestGoogExpressions
> >
> >      @Override
> >      @Test
> > +    public void testVisitLanguageIdentifierNode_This()
> > +    {
> > +        IMemberAccessExpressionNode node =
> (IMemberAccessExpressionNode) getNode(
> > +                "if (a) this.a;", IMemberAccessExpressionNode.class);
> > +        asBlockWalker.visitMemberAccessExpression(node);
> > +        assertOut("a");
> > +    }
> > +
> > +    @Override
> > +    @Test
> > +    public void testVisitLanguageIdentifierNode_This1()
> > +    {
> > +        IMemberAccessExpressionNode node =
> (IMemberAccessExpressionNode) getNode(
> > +                "if (a) this.a;", IMemberAccessExpressionNode.class);
> > +
> > +        asBlockWalker.visitMemberAccessExpression(node);
> > +        assertOut("a");
> > +    }
> > +
> > +    @Override
> > +    @Test
> > +    public void testVisitLanguageIdentifierNode_This2()
> > +    {
> > +        IMemberAccessExpressionNode node =
> (IMemberAccessExpressionNode) getNode(
> > +                "if (a) this.a;", IMemberAccessExpressionNode.class);
> > +
> > +        asBlockWalker.visitMemberAccessExpression(node);
> > +        assertOut("a");
> > +    }
> > +
> > +    @Override
> > +    @Test
> >      public void testVisitLanguageIdentifierNode_SuperMethod_1()
> >      {
> >          IFunctionNode node = getMethod("function foo(){if (a)
> super.foo();}");
> >
> >
> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/112d8ca7/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java
> > ----------------------------------------------------------------------
> > diff --git
> a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java
> b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java
> > index 15310f7..1df4b71 100644
> > ---
> a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java
> > +++
> b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java
> > @@ -22,6 +22,8 @@ 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.TestGoogMethodMembers;
> >  import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend;
> > +import org.apache.flex.compiler.tree.as.IFunctionNode;
> > +import org.junit.Test;
> >
> >  /**
> >   * @author Erik de Bruin
> > @@ -29,6 +31,38 @@ import
> org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend;
> >  public class TestFlexJSMethodMembers extends TestGoogMethodMembers
> >  {
> >
> > +
>  //--------------------------------------------------------------------------
> > +    // Doc Specific Tests
> > +
>  //--------------------------------------------------------------------------
> > +
> > +    @Override
> > +    @Test
> > +    public void testConstructor_withThisInBody()
> > +    {
> > +        IFunctionNode node = getMethod("public function
> A(){this.foo;};");
> > +        asBlockWalker.visitFunction(node);
> > +        assertOut("/**\n * @constructor\n */\nA = function() {\n\tvar
> self = this;\n\tfoo;\n}");
> > +    }
> > +
> > +    @Override
> > +    @Test
> > +    public void testMethod_withThisInBody()
> > +    {
> > +        IFunctionNode node = getMethod("function foo(){this.foo;}");
> > +        asBlockWalker.visitFunction(node);
> > +        assertOut("/**\n * @this {A}\n */\nA.prototype.foo = function()
> {\n\tvar self = this;\n\tfoo;\n}");
> > +    }
> > +
> > +    @Override
> > +    @Test
> > +    public void testMethod_withThisInBodyComplex()
> > +    {
> > +        IFunctionNode node = getMethod("function
> foo(){if(true){while(i){this.bar(42);}}}");
> > +        asBlockWalker.visitFunction(node);
> > +        assertOut("/**\n * @this {A}\n */\nA.prototype.foo = function()
> {\n\tvar self = this;\n\tif (true) "
> > +                + "{\n\t\twhile (i) {\n\t\t\tbar(42);\n\t\t}\n\t}\n}");
> > +    }
> > +
> >      @Override
> >      protected IBackend createBackend()
> >      {
> >
> >
> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/112d8ca7/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 dd4d137..4f58975 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
> > @@ -32,6 +32,7 @@ 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;
> >  import org.apache.flex.compiler.internal.definitions.AccessorDefinition;
> > +import
> org.apache.flex.compiler.internal.definitions.ParameterDefinition;
> >  import
> org.apache.flex.compiler.internal.tree.as.BinaryOperatorAssignmentNode;
> >  import org.apache.flex.compiler.internal.tree.as.FunctionCallNode;
> >  import org.apache.flex.compiler.internal.tree.as.FunctionNode;
> > @@ -47,6 +48,7 @@ import
> org.apache.flex.compiler.tree.as.IFunctionCallNode;
> >  import org.apache.flex.compiler.tree.as.IFunctionNode;
> >  import org.apache.flex.compiler.tree.as.IGetterNode;
> >  import org.apache.flex.compiler.tree.as.IIdentifierNode;
> > +import org.apache.flex.compiler.tree.as.ILanguageIdentifierNode;
> >  import org.apache.flex.compiler.tree.as.IMemberAccessExpressionNode;
> >  import org.apache.flex.compiler.tree.as.ISetterNode;
> >  import org.apache.flex.compiler.utils.ASNodeUtils;
> > @@ -94,7 +96,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter
> implements IJSFlexJSEmitter
> >          ASTNodeID inode = pnode.getNodeID();
> >
> >          boolean writeSelf = false;
> > -        if (cnode != null)
> > +        if (cnode != null && !(def instanceof ParameterDefinition))
> >          {
> >              IDefinitionNode[] members = cnode.getAllMemberNodes();
> >              for (IDefinitionNode mnode : members)
> > @@ -335,6 +337,20 @@ public class JSFlexJSEmitter extends JSGoogEmitter
> implements IJSFlexJSEmitter
> >      }
> >
> >      @Override
> > +    public void emitMemberAccessExpression(IMemberAccessExpressionNode
> node)
> > +    {
> > +        IASNode leftNode = node.getLeftOperandNode();
> > +
> > +        if (!(leftNode instanceof ILanguageIdentifierNode &&
> ((ILanguageIdentifierNode) leftNode)
> > +                .getKind() ==
> ILanguageIdentifierNode.LanguageIdentifierKind.THIS))
> > +        {
> > +            getWalker().walk(node.getLeftOperandNode());
> > +            write(node.getOperator().getOperatorText());
> > +        }
> > +        getWalker().walk(node.getRightOperandNode());
> > +    }
> > +
> > +    @Override
> >      protected void emitObjectDefineProperty(IAccessorNode node)
> >      {
> >          /*
> >
> >
> http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/112d8ca7/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 49832a3..430ec4b 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
> > @@ -191,9 +191,15 @@ public class MXMLFlexJSPublisher extends
> JSGoogPublisher implements
> >          htmlFile.append("</head>\n");
> >          htmlFile.append("<body>\n");
> >          htmlFile.append("\t<script type=\"text/javascript\">\n");
> > +
> > +        // TODO (erikdebruin) the utility methods should have their own
> place...
> > +        htmlFile.append("\t\tfunction is(object, type) {return
> object;};\n");
> > +        htmlFile.append("\t\t\n");
> > +
> >          htmlFile.append("\t\tnew ");
> >          htmlFile.append(projectName);
> > -        htmlFile.append("();\n");
> > +        htmlFile.append("()");
> > +        htmlFile.append(".start()\n");
> >          htmlFile.append("\t</script>\n");
> >          htmlFile.append("</body>\n");
> >          htmlFile.append("</html>");
> >
>
>
>
> --
> Ix Multimedia Software
>
> Jan Luykenstraat 27
> 3521 VB Utrecht
>
> T. 06-51952295
> I. www.ixsoftware.nl
>

Reply via email to