Return-Path: X-Original-To: apmail-flex-commits-archive@www.apache.org Delivered-To: apmail-flex-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6BECDF000 for ; Wed, 6 Mar 2013 20:23:48 +0000 (UTC) Received: (qmail 35893 invoked by uid 500); 6 Mar 2013 20:23:48 -0000 Delivered-To: apmail-flex-commits-archive@flex.apache.org Received: (qmail 35871 invoked by uid 500); 6 Mar 2013 20:23:48 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 35862 invoked by uid 99); 6 Mar 2013 20:23:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Mar 2013 20:23:48 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Mar 2013 20:23:42 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 0245823889E0; Wed, 6 Mar 2013 20:23:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1453534 - 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/visitor/as/ compiler.jx/src/org/apache/fl... Date: Wed, 06 Mar 2013 20:23:22 -0000 To: commits@flex.apache.org From: mschmalle@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130306202323.0245823889E0@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mschmalle Date: Wed Mar 6 20:23:22 2013 New Revision: 1453534 URL: http://svn.apache.org/r1453534 Log: Flex:Falcon - Added IVariableExpressionNode API FalconJx - Added visitVariableExpression() to switch, ASEmitter - Added visitFunctionObject() to switch, ASEmitter Added: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/tree/as/IVariableExpressionNode.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/visitor/as/ASNodeSwitch.java flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/as/IASBlockVisitor.java flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/as/codegen/ABCGeneratingReducer.java flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/as/VariableExpressionNode.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=1453534&r1=1453533&r2=1453534&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 20:23:22 2013 @@ -59,6 +59,7 @@ import org.apache.flex.compiler.tree.as. import org.apache.flex.compiler.tree.as.ITryNode; import org.apache.flex.compiler.tree.as.ITypedExpressionNode; import org.apache.flex.compiler.tree.as.IUnaryOperatorNode; +import org.apache.flex.compiler.tree.as.IVariableExpressionNode; import org.apache.flex.compiler.tree.as.IVariableNode; import org.apache.flex.compiler.tree.as.IWhileLoopNode; import org.apache.flex.compiler.tree.as.IWithNode; @@ -301,6 +302,8 @@ public interface IASEmitter extends IEmi void emitMemberAccessExpression(IMemberAccessExpressionNode node); + void emitVariableExpression(IVariableExpressionNode node); + void emitDynamicAccess(IDynamicAccessNode node); void emitTypedExpression(ITypedExpressionNode node); 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=1453534&r1=1453533&r2=1453534&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 20:23:22 2013 @@ -26,7 +26,6 @@ import org.apache.flex.compiler.definiti import org.apache.flex.compiler.internal.semantics.SemanticUtils; 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; import org.apache.flex.compiler.problems.ICompilerProblem; import org.apache.flex.compiler.projects.IASProject; import org.apache.flex.compiler.tree.ASTNodeID; @@ -35,7 +34,6 @@ import org.apache.flex.compiler.tree.as. 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.IContainerNode; import org.apache.flex.compiler.tree.as.IDefaultXMLNamespaceNode; import org.apache.flex.compiler.tree.as.IDynamicAccessNode; import org.apache.flex.compiler.tree.as.IEmbedNode; @@ -72,6 +70,7 @@ import org.apache.flex.compiler.tree.as. import org.apache.flex.compiler.tree.as.ITryNode; import org.apache.flex.compiler.tree.as.ITypedExpressionNode; import org.apache.flex.compiler.tree.as.IUnaryOperatorNode; +import org.apache.flex.compiler.tree.as.IVariableExpressionNode; import org.apache.flex.compiler.tree.as.IVariableNode; import org.apache.flex.compiler.tree.as.IWhileLoopNode; import org.apache.flex.compiler.tree.as.IWhileLoopNode.WhileLoopKind; @@ -501,20 +500,23 @@ public class ASBlockWalker implements IA } @Override + public void visitFunctionObject(IFunctionObjectNode node) + { + emitter.emitFunctionObject((IFunctionObjectNode) node); + } + + @Override + public void visitVariableExpression(IVariableExpressionNode node) + { + debug("visitVariableExpression()"); + emitter.emitVariableExpression(node); + } + + @Override public void visitExpression(IExpressionNode node) { debug("visitExpression()"); - // TODO (mschmalle) I think these placements are temp, I am sure a visit method - // should exist for FunctionObjectNode, there is no interface for it right now - if (node instanceof VariableExpressionNode) - { - VariableExpressionNode v = (VariableExpressionNode) node; - walk(v.getTargetVariable()); - } - else if (node instanceof IFunctionObjectNode) - { - emitter.emitFunctionObject((IFunctionObjectNode) node); - } + // XXX (mschmalle) anything getting past here? } @Override 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=1453534&r1=1453533&r2=1453534&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 20:23:22 2013 @@ -88,6 +88,7 @@ import org.apache.flex.compiler.tree.as. import org.apache.flex.compiler.tree.as.ITypeNode; import org.apache.flex.compiler.tree.as.ITypedExpressionNode; import org.apache.flex.compiler.tree.as.IUnaryOperatorNode; +import org.apache.flex.compiler.tree.as.IVariableExpressionNode; import org.apache.flex.compiler.tree.as.IVariableNode; import org.apache.flex.compiler.tree.as.IWhileLoopNode; import org.apache.flex.compiler.tree.as.IWithNode; @@ -1314,6 +1315,12 @@ public class ASEmitter implements IASEmi } @Override + public void emitVariableExpression(IVariableExpressionNode node) + { + getWalker().walk(node.getTargetVariable()); + } + + @Override public void emitTernaryOperator(ITernaryOperatorNode node) { getWalker().walk(node.getConditionalNode()); Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/visitor/as/ASNodeSwitch.java URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/visitor/as/ASNodeSwitch.java?rev=1453534&r1=1453533&r2=1453534&view=diff ============================================================================== --- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/visitor/as/ASNodeSwitch.java (original) +++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/internal/visitor/as/ASNodeSwitch.java Wed Mar 6 20:23:22 2013 @@ -37,6 +37,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; @@ -61,6 +62,7 @@ import org.apache.flex.compiler.tree.as. import org.apache.flex.compiler.tree.as.ITryNode; import org.apache.flex.compiler.tree.as.ITypedExpressionNode; import org.apache.flex.compiler.tree.as.IUnaryOperatorNode; +import org.apache.flex.compiler.tree.as.IVariableExpressionNode; import org.apache.flex.compiler.tree.as.IVariableNode; import org.apache.flex.compiler.tree.as.IWhileLoopNode; import org.apache.flex.compiler.tree.as.IWithNode; @@ -282,7 +284,14 @@ public class ASNodeSwitch implements IAS // case TODO: // visitor.visitKeyword((IKeywordNode) node); // break; - + case VariableExpressionID: + visitor.visitVariableExpression((IVariableExpressionNode) node); + return; + case FunctionObjectID: + case AnonymousFunctionID: + visitor.visitFunctionObject((IFunctionObjectNode) node); + return; + default: break; } Modified: flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/as/IASBlockVisitor.java URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/as/IASBlockVisitor.java?rev=1453534&r1=1453533&r2=1453534&view=diff ============================================================================== --- flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/as/IASBlockVisitor.java (original) +++ flex/falcon/trunk/compiler.jx/src/org/apache/flex/compiler/visitor/as/IASBlockVisitor.java Wed Mar 6 20:23:22 2013 @@ -35,6 +35,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; @@ -59,6 +60,7 @@ import org.apache.flex.compiler.tree.as. import org.apache.flex.compiler.tree.as.ITryNode; import org.apache.flex.compiler.tree.as.ITypedExpressionNode; import org.apache.flex.compiler.tree.as.IUnaryOperatorNode; +import org.apache.flex.compiler.tree.as.IVariableExpressionNode; import org.apache.flex.compiler.tree.as.IVariableNode; import org.apache.flex.compiler.tree.as.IWhileLoopNode; import org.apache.flex.compiler.tree.as.IWithNode; @@ -150,6 +152,8 @@ public interface IASBlockVisitor extends void visitMemberAccessExpression(IMemberAccessExpressionNode node); void visitNamespaceAccessExpression(NamespaceAccessExpressionNode node); + + void visitVariableExpression(IVariableExpressionNode node); void visitLanguageIdentifierNode(ILanguageIdentifierNode node); @@ -174,6 +178,8 @@ public interface IASBlockVisitor extends // Expression nodes //-------------------------------------------------------------------------- + void visitFunctionObject(IFunctionObjectNode node); + void visitFunctionCall(IFunctionCallNode node); void visitAsOperator(IBinaryOperatorNode node); Modified: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/as/codegen/ABCGeneratingReducer.java URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/as/codegen/ABCGeneratingReducer.java?rev=1453534&r1=1453533&r2=1453534&view=diff ============================================================================== --- flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/as/codegen/ABCGeneratingReducer.java (original) +++ flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/as/codegen/ABCGeneratingReducer.java Wed Mar 6 20:23:22 2013 @@ -6123,7 +6123,7 @@ public class ABCGeneratingReducer public Binding reduce_typedVariableExpression(IASNode iNode, Name var_name, Binding var_type) { VariableExpressionNode var_expr_node = (VariableExpressionNode)iNode; - BaseVariableNode var_node = var_expr_node.getTargetVariable(); + BaseVariableNode var_node = (BaseVariableNode) var_expr_node.getTargetVariable(); currentScope.getMethodBodySemanticChecker().checkVariableDeclaration(SemanticUtils.getNthChild(iNode, 0)); Binding var = currentScope.resolveName((IdentifierNode)var_node.getNameExpressionNode()); currentScope.makeVariable(var, var_type.getName(), var_node.getMetaInfos()); Modified: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/as/VariableExpressionNode.java URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/as/VariableExpressionNode.java?rev=1453534&r1=1453533&r2=1453534&view=diff ============================================================================== --- flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/as/VariableExpressionNode.java (original) +++ flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/as/VariableExpressionNode.java Wed Mar 6 20:23:22 2013 @@ -23,13 +23,15 @@ import org.apache.flex.compiler.constant 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.IVariableExpressionNode; +import org.apache.flex.compiler.tree.as.IVariableNode; /** * Expression that represents a variable contained within an iterative loop. * These loops can contain "in" statements, such as: * for(var x:* in myArray) */ -public class VariableExpressionNode extends ExpressionNodeBase +public class VariableExpressionNode extends ExpressionNodeBase implements IVariableExpressionNode { /** * Constructor. @@ -106,15 +108,19 @@ public class VariableExpressionNode exte } // - // Other methods + // IVariableExpressionNode implementation // - - // TODO Create IVariableExpressionNode with this method? - public VariableNode getTargetVariable() + + @Override + public IVariableNode getTargetVariable() { return variableNode; } + // + // Other methods + // + /** * Sets the target variable found within this expression. Used during * parsing Added: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/tree/as/IVariableExpressionNode.java URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/tree/as/IVariableExpressionNode.java?rev=1453534&view=auto ============================================================================== --- flex/falcon/trunk/compiler/src/org/apache/flex/compiler/tree/as/IVariableExpressionNode.java (added) +++ flex/falcon/trunk/compiler/src/org/apache/flex/compiler/tree/as/IVariableExpressionNode.java Wed Mar 6 20:23:22 2013 @@ -0,0 +1,33 @@ +/* + * + * 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; + +/** + * Expression that represents a variable contained within an iterative loop. + * These loops can contain "in" statements, such as: + * for(var x:* in myArray) + */ +public interface IVariableExpressionNode extends IExpressionNode +{ + /** + * @return The target's {@link IVariableNode} context. + */ + IVariableNode getTargetVariable(); +} Propchange: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/tree/as/IVariableExpressionNode.java ------------------------------------------------------------------------------ svn:eol-style = native