flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mschma...@apache.org
Subject svn commit: r1453333 - in /flex/falcon/trunk: compiler.jx/src/org/apache/flex/compiler/codegen/as/ compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/ compiler.jx/src/org/apache/fl...
Date Wed, 06 Mar 2013 13:59:55 GMT
Author: mschmalle
Date: Wed Mar  6 13:59:55 2013
New Revision: 1453333

URL: http://svn.apache.org/r1453333
Log:
Flex:Falcon/FalconJx
- Added IFunctionObjectNode API and implemented the changes in falcon.jx

Added:
    flex/falcon/trunk/compiler/src/org/apache/flex/compiler/tree/as/IFunctionObjectNode.java
  (with props)
Modified:
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/codegen/as/IASEmitter.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/visitor/mxml/MXMLNodeSwitch.java
    flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/as/FunctionObjectNode.java

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/codegen/as/IASEmitter.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/codegen/as/IASEmitter.java?rev=1453333&r1=1453332&r2=1453333&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/codegen/as/IASEmitter.java
(original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/codegen/as/IASEmitter.java
Wed Mar  6 13:59:55 2013
@@ -24,7 +24,6 @@ import java.io.Writer;
 import org.apache.flex.compiler.codegen.IDocEmitter;
 import org.apache.flex.compiler.codegen.IEmitter;
 import org.apache.flex.compiler.definitions.IPackageDefinition;
-import org.apache.flex.compiler.internal.tree.as.FunctionObjectNode;
 import org.apache.flex.compiler.internal.tree.as.LabeledStatementNode;
 import org.apache.flex.compiler.internal.tree.as.NamespaceAccessExpressionNode;
 import org.apache.flex.compiler.tree.as.IASNode;
@@ -34,10 +33,10 @@ import org.apache.flex.compiler.tree.as.
 import org.apache.flex.compiler.tree.as.IClassNode;
 import org.apache.flex.compiler.tree.as.IContainerNode;
 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;
 import org.apache.flex.compiler.tree.as.IFunctionNode;
+import org.apache.flex.compiler.tree.as.IFunctionObjectNode;
 import org.apache.flex.compiler.tree.as.IGetterNode;
 import org.apache.flex.compiler.tree.as.IIdentifierNode;
 import org.apache.flex.compiler.tree.as.IIfNode;
@@ -64,8 +63,8 @@ import org.apache.flex.compiler.tree.as.
 import org.apache.flex.compiler.tree.as.IWhileLoopNode;
 import org.apache.flex.compiler.tree.as.IWithNode;
 import org.apache.flex.compiler.tree.metadata.IMetaTagNode;
-import org.apache.flex.compiler.visitor.IBlockWalker;
 import org.apache.flex.compiler.visitor.IASNodeStrategy;
+import org.apache.flex.compiler.visitor.IBlockWalker;
 
 /**
  * The {@link IASEmitter} interface allows abstraction between the
@@ -275,13 +274,12 @@ public interface IASEmitter extends IEmi
      */
     void emitVarDeclaration(IVariableNode node);
 
-    // TODO (mschmalle) we need IFunctionObjectNode API for FunctionObjectNode
     /**
-     * Emit an anonymous {@link FunctionObjectNode}.
+     * Emit an anonymous {@link IFunctionObjectNode}.
      * 
-     * @param node The anonymous {@link FunctionObjectNode}.
+     * @param node The anonymous {@link IFunctionObjectNode}.
      */
-    void emitFunctionObject(IExpressionNode node);
+    void emitFunctionObject(IFunctionObjectNode node);
 
     /**
      * Emit a header at the start of a function block.

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java?rev=1453333&r1=1453332&r2=1453333&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java
(original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java
Wed Mar  6 13:59:55 2013
@@ -25,7 +25,6 @@ import org.apache.flex.compiler.codegen.
 import org.apache.flex.compiler.definitions.IPackageDefinition;
 import org.apache.flex.compiler.internal.semantics.SemanticUtils;
 import org.apache.flex.compiler.internal.tree.as.BaseLiteralContainerNode;
-import org.apache.flex.compiler.internal.tree.as.FunctionObjectNode;
 import org.apache.flex.compiler.internal.tree.as.LabeledStatementNode;
 import org.apache.flex.compiler.internal.tree.as.NamespaceAccessExpressionNode;
 import org.apache.flex.compiler.internal.tree.as.VariableExpressionNode;
@@ -47,6 +46,7 @@ import org.apache.flex.compiler.tree.as.
 import org.apache.flex.compiler.tree.as.IForLoopNode.ForLoopKind;
 import org.apache.flex.compiler.tree.as.IFunctionCallNode;
 import org.apache.flex.compiler.tree.as.IFunctionNode;
+import org.apache.flex.compiler.tree.as.IFunctionObjectNode;
 import org.apache.flex.compiler.tree.as.IGetterNode;
 import org.apache.flex.compiler.tree.as.IIdentifierNode;
 import org.apache.flex.compiler.tree.as.IIfNode;
@@ -511,9 +511,9 @@ public class ASBlockWalker implements IA
             VariableExpressionNode v = (VariableExpressionNode) node;
             walk(v.getTargetVariable());
         }
-        else if (node instanceof FunctionObjectNode)
+        else if (node instanceof IFunctionObjectNode)
         {
-            emitter.emitFunctionObject(node);
+            emitter.emitFunctionObject((IFunctionObjectNode) node);
         }
     }
 

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java?rev=1453333&r1=1453332&r2=1453333&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
(original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
Wed Mar  6 13:59:55 2013
@@ -40,7 +40,6 @@ import org.apache.flex.compiler.definiti
 import org.apache.flex.compiler.definitions.IVariableDefinition;
 import org.apache.flex.compiler.internal.tree.as.ChainedVariableNode;
 import org.apache.flex.compiler.internal.tree.as.FunctionNode;
-import org.apache.flex.compiler.internal.tree.as.FunctionObjectNode;
 import org.apache.flex.compiler.internal.tree.as.LabeledStatementNode;
 import org.apache.flex.compiler.internal.tree.as.NamespaceAccessExpressionNode;
 import org.apache.flex.compiler.problems.ICompilerProblem;
@@ -59,6 +58,7 @@ import org.apache.flex.compiler.tree.as.
 import org.apache.flex.compiler.tree.as.IForLoopNode;
 import org.apache.flex.compiler.tree.as.IFunctionCallNode;
 import org.apache.flex.compiler.tree.as.IFunctionNode;
+import org.apache.flex.compiler.tree.as.IFunctionObjectNode;
 import org.apache.flex.compiler.tree.as.IGetterNode;
 import org.apache.flex.compiler.tree.as.IIdentifierNode;
 import org.apache.flex.compiler.tree.as.IIfNode;
@@ -631,10 +631,9 @@ public class ASEmitter implements IASEmi
     }
 
     @Override
-    public void emitFunctionObject(IExpressionNode node)
+    public void emitFunctionObject(IFunctionObjectNode node)
     {
-        FunctionObjectNode f = (FunctionObjectNode) node;
-        FunctionNode fnode = f.getFunctionNode();
+        FunctionNode fnode = node.getFunctionNode();
         write(ASEmitterTokens.FUNCTION);
         emitParamters(fnode.getParameterNodes());
         emitType(fnode.getTypeNode());

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java?rev=1453333&r1=1453332&r2=1453333&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
(original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
Wed Mar  6 13:59:55 2013
@@ -25,8 +25,7 @@ import org.apache.flex.compiler.codegen.
 import org.apache.flex.compiler.internal.codegen.as.ASEmitter;
 import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
 import org.apache.flex.compiler.internal.tree.as.FunctionNode;
-import org.apache.flex.compiler.internal.tree.as.FunctionObjectNode;
-import org.apache.flex.compiler.tree.as.IExpressionNode;
+import org.apache.flex.compiler.tree.as.IFunctionObjectNode;
 
 /**
  * @author Michael Schmalle
@@ -40,16 +39,11 @@ public class JSEmitter extends ASEmitter
     }
 
     @Override
-    public void emitFunctionObject(IExpressionNode node)
+    public void emitFunctionObject(IFunctionObjectNode node)
     {
-        FunctionObjectNode f = (FunctionObjectNode) node;
-
-        FunctionNode fnode = f.getFunctionNode();
-
+        FunctionNode fnode = node.getFunctionNode();
         write(ASEmitterTokens.FUNCTION);
-
         emitParamters(fnode.getParameterNodes());
-
         emitFunctionScope(fnode.getScopedNode());
     }
 

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/visitor/mxml/MXMLNodeSwitch.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/visitor/mxml/MXMLNodeSwitch.java?rev=1453333&r1=1453332&r2=1453333&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/visitor/mxml/MXMLNodeSwitch.java
(original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/visitor/mxml/MXMLNodeSwitch.java
Wed Mar  6 13:59:55 2013
@@ -134,7 +134,7 @@ public class MXMLNodeSwitch implements I
         case MXMLRemoteObjectID:
         case MXMLRemoteObjectMethodID:
         case MXMLReparentID:
-        case MXMLRepeaterID:
+        //case MXMLRepeaterID:
         case MXMLResourceID:
         case MXMLStateID:
         case MXMLStyleID:

Modified: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/as/FunctionObjectNode.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/as/FunctionObjectNode.java?rev=1453333&r1=1453332&r2=1453333&view=diff
==============================================================================
--- flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/as/FunctionObjectNode.java
(original)
+++ flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/as/FunctionObjectNode.java
Wed Mar  6 13:59:55 2013
@@ -30,6 +30,7 @@ import org.apache.flex.compiler.problems
 import org.apache.flex.compiler.projects.ICompilerProject;
 import org.apache.flex.compiler.tree.ASTNodeID;
 import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.as.IFunctionObjectNode;
 
 /**
  * An anonymous function (e.g. function() {...}) is an expression, but acts like
@@ -37,7 +38,7 @@ import org.apache.flex.compiler.tree.as.
  * construct by wrapping a regular FunctionNode in an ExpressionNodeBase-based
  * wrapper.
  */
-public class FunctionObjectNode extends ExpressionNodeBase
+public class FunctionObjectNode extends ExpressionNodeBase implements IFunctionObjectNode
 {
     /**
      * Constructor.
@@ -133,15 +134,10 @@ public class FunctionObjectNode extends 
     }
     
     //
-    // Other methods
+    // IFunctionObjectNode implementations
     //
 
-    /**
-     * Get the associated function node
-     * 
-     * @return function node
-     */
-    // TODO Create IFunctionObjectNode with this?
+    @Override
     public FunctionNode getFunctionNode()
     {
         return functionNode;

Added: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/tree/as/IFunctionObjectNode.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/tree/as/IFunctionObjectNode.java?rev=1453333&view=auto
==============================================================================
--- flex/falcon/trunk/compiler/src/org/apache/flex/compiler/tree/as/IFunctionObjectNode.java
(added)
+++ flex/falcon/trunk/compiler/src/org/apache/flex/compiler/tree/as/IFunctionObjectNode.java
Wed Mar  6 13:59:55 2013
@@ -0,0 +1,36 @@
+/*
+ *
+ *  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.tree.as;
+
+import org.apache.flex.compiler.internal.tree.as.FunctionNode;
+
+/**
+ * An anonymous function (e.g. function() {...}) is an expression, but acts like
+ * a function definition where scopes are concerned.
+ */
+public interface IFunctionObjectNode extends IExpressionNode
+{
+    /**
+     * Get the associated function node
+     * 
+     * @return function node
+     */
+    FunctionNode getFunctionNode();
+}

Propchange: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/tree/as/IFunctionObjectNode.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message