flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mschma...@apache.org
Subject svn commit: r1448284 - in /flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler: common/ common/ASNodeUtils.java internal/as/codegen/ASEmitter.java utils/NativeUtils.java
Date Wed, 20 Feb 2013 16:41:20 GMT
Author: mschmalle
Date: Wed Feb 20 16:41:20 2013
New Revision: 1448284

URL: http://svn.apache.org/r1448284
Log:
Flex:FalconJx
- added ASNodeUtils.java
- moved switch methods out of ASEmitter into the until until the bug gets fixed

Added:
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/common/
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/common/ASNodeUtils.java   (with
props)
Modified:
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java
    flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/utils/NativeUtils.java

Added: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/common/ASNodeUtils.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/common/ASNodeUtils.java?rev=1448284&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/common/ASNodeUtils.java (added)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/common/ASNodeUtils.java Wed
Feb 20 16:41:20 2013
@@ -0,0 +1,71 @@
+/*
+ *
+ *  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.common;
+
+import java.util.ArrayList;
+
+import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.as.IBlockNode;
+import org.apache.flex.compiler.tree.as.IConditionalNode;
+import org.apache.flex.compiler.tree.as.ISwitchNode;
+import org.apache.flex.compiler.tree.as.ITerminalNode;
+
+/**
+ * @author Michael Schmalle
+ */
+public class ASNodeUtils
+{
+    //--------------------------------------------------------------------------
+    // Temp: These need JIRA tickets
+    //--------------------------------------------------------------------------
+
+    // there seems to be a bug in the ISwitchNode.getCaseNodes(), need to file a bug
+    public static final IConditionalNode[] getCaseNodes(ISwitchNode node)
+    {
+        IBlockNode block = (IBlockNode) node.getChild(1);
+        int childCount = block.getChildCount();
+        ArrayList<IConditionalNode> retVal = new ArrayList<IConditionalNode>(
+                childCount);
+
+        for (int i = 0; i < childCount; i++)
+        {
+            IASNode child = block.getChild(i);
+            if (child instanceof IConditionalNode)
+                retVal.add((IConditionalNode) child);
+        }
+
+        return retVal.toArray(new IConditionalNode[0]);
+    }
+
+    // there seems to be a bug in the ISwitchNode.getDefaultNode(), need to file a bug
+    public static final ITerminalNode getDefaultNode(ISwitchNode node)
+    {
+        IBlockNode block = (IBlockNode) node.getChild(1);
+        int childCount = block.getChildCount();
+        for (int i = childCount - 1; i >= 0; i--)
+        {
+            IASNode child = block.getChild(i);
+            if (child instanceof ITerminalNode)
+                return (ITerminalNode) child;
+        }
+
+        return null;
+    }
+}

Propchange: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/common/ASNodeUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java?rev=1448284&r1=1448283&r2=1448284&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java
(original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/as/codegen/ASEmitter.java
Wed Feb 20 16:41:20 2013
@@ -29,6 +29,7 @@ import org.apache.flex.compiler.as.codeg
 import org.apache.flex.compiler.as.codegen.IASEmitter;
 import org.apache.flex.compiler.as.codegen.IDocEmitter;
 import org.apache.flex.compiler.common.ASModifier;
+import org.apache.flex.compiler.common.ASNodeUtils;
 import org.apache.flex.compiler.common.IImportTarget;
 import org.apache.flex.compiler.common.ModifiersSet;
 import org.apache.flex.compiler.constants.IASKeywordConstants;
@@ -48,7 +49,6 @@ import org.apache.flex.compiler.tree.AST
 import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.tree.as.IAccessorNode;
 import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
-import org.apache.flex.compiler.tree.as.IBlockNode;
 import org.apache.flex.compiler.tree.as.ICatchNode;
 import org.apache.flex.compiler.tree.as.IClassNode;
 import org.apache.flex.compiler.tree.as.IConditionalNode;
@@ -919,8 +919,8 @@ public class ASEmitter implements IASEmi
         indentPush();
         writeNewline();
 
-        IConditionalNode[] cnodes = getCaseNodes(node);
-        ITerminalNode dnode = getDefaultNode(node);
+        IConditionalNode[] cnodes = ASNodeUtils.getCaseNodes(node);
+        ITerminalNode dnode = ASNodeUtils.getDefaultNode(node);
 
         for (int i = 0; i < cnodes.length; i++)
         {
@@ -1214,43 +1214,6 @@ public class ASEmitter implements IASEmi
         }
     }
 
-    //--------------------------------------------------------------------------
-    // Temp: These need JIRA tickets
-    //--------------------------------------------------------------------------
-
-    // there seems to be a bug in the ISwitchNode.getCaseNodes(), need to file a bug
-    public IConditionalNode[] getCaseNodes(ISwitchNode node)
-    {
-        IBlockNode block = (IBlockNode) node.getChild(1);
-        int childCount = block.getChildCount();
-        ArrayList<IConditionalNode> retVal = new ArrayList<IConditionalNode>(
-                childCount);
-
-        for (int i = 0; i < childCount; i++)
-        {
-            IASNode child = block.getChild(i);
-            if (child instanceof IConditionalNode)
-                retVal.add((IConditionalNode) child);
-        }
-
-        return retVal.toArray(new IConditionalNode[0]);
-    }
-
-    // there seems to be a bug in the ISwitchNode.getDefaultNode(), need to file a bug
-    public ITerminalNode getDefaultNode(ISwitchNode node)
-    {
-        IBlockNode block = (IBlockNode) node.getChild(1);
-        int childCount = block.getChildCount();
-        for (int i = childCount - 1; i >= 0; i--)
-        {
-            IASNode child = block.getChild(i);
-            if (child instanceof ITerminalNode)
-                return (ITerminalNode) child;
-        }
-
-        return null;
-    }
-
     @Override
     public void emitLiteral(ILiteralNode node)
     {

Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/utils/NativeUtils.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/utils/NativeUtils.java?rev=1448284&r1=1448283&r2=1448284&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/utils/NativeUtils.java (original)
+++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/utils/NativeUtils.java Wed
Feb 20 16:41:20 2013
@@ -26,6 +26,8 @@ public class NativeUtils
 {
     public enum NativeType
     {
+        Any("*"), // not JS but use full in the context of native
+        
         Argument("Argument"),
         Array("Array"),
         Boolean("Boolean"),



Mime
View raw message