You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cd...@apache.org on 2014/10/31 09:28:36 UTC
[14/23] git commit: [flex-falcon]
[refs/heads/feature/flexmojos-tests] - Various E4X "bypass" measures ...
Various E4X "bypass" measures ...
Signed-off-by: Erik de Bruin <er...@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/7822c332
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/7822c332
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/7822c332
Branch: refs/heads/feature/flexmojos-tests
Commit: 7822c332c3d91a227b6120ffab226a048da073b5
Parents: 68a7c9e
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Tue Oct 21 13:20:30 2014 +0200
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Thu Oct 23 19:42:52 2014 +0200
----------------------------------------------------------------------
.../flex/compiler/codegen/as/IASEmitter.java | 2 +
.../internal/codegen/as/ASBlockWalker.java | 7 +++
.../compiler/internal/codegen/as/ASEmitter.java | 4 ++
.../codegen/js/flexjs/JSFlexJSEmitter.java | 45 +++++++++++++++++++-
.../internal/visitor/as/ASNodeSwitch.java | 4 ++
.../compiler/visitor/as/IASBlockVisitor.java | 2 +
6 files changed, 62 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7822c332/compiler.jx/src/org/apache/flex/compiler/codegen/as/IASEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/codegen/as/IASEmitter.java b/compiler.jx/src/org/apache/flex/compiler/codegen/as/IASEmitter.java
index 9bf4aa5..e1c0e01 100644
--- a/compiler.jx/src/org/apache/flex/compiler/codegen/as/IASEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/codegen/as/IASEmitter.java
@@ -354,4 +354,6 @@ public interface IASEmitter extends IEmitter
void emitMetaTag(IMetaTagNode node);
+ void emitE4XFilter(IMemberAccessExpressionNode node);
+
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7822c332/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 d8b68f6..069e934 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
@@ -556,6 +556,13 @@ public class ASBlockWalker implements IASBlockVisitor, IASBlockWalker
}
@Override
+ public void visitE4XFilter(IMemberAccessExpressionNode node)
+ {
+ debug("visitE4XFilter()");
+ emitter.emitE4XFilter(node);
+ }
+
+ @Override
public void visitReturn(IReturnNode node)
{
debug("visitReturn()");
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7822c332/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
index 379e86e..cd08e22 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
@@ -1448,6 +1448,10 @@ public class ASEmitter implements IASEmitter, IEmitter
{
}
+ public void emitE4XFilter(IMemberAccessExpressionNode node)
+ {
+ }
+
public String stringifyNode(IASNode node)
{
setBufferWrite(true);
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7822c332/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 454bae6..49e8192 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
@@ -1100,6 +1100,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
public void emitMemberAccessExpression(IMemberAccessExpressionNode node)
{
IASNode leftNode = node.getLeftOperandNode();
+ IASNode rightNode = node.getRightOperandNode();
if (project == null)
project = getWalker().getProject();
@@ -1109,12 +1110,41 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
if (def != null && def.isStatic())
isStatic = true;
+ boolean continueWalk = true;
if (!isStatic)
{
if (!(leftNode instanceof ILanguageIdentifierNode && ((ILanguageIdentifierNode) leftNode)
.getKind() == ILanguageIdentifierNode.LanguageIdentifierKind.THIS))
{
- if (leftNode.getNodeID() != ASTNodeID.SuperID)
+ if (rightNode instanceof UnaryOperatorAtNode)
+ {
+ // ToDo (erikdebruin): properly handle E4X
+
+ write(ASEmitterTokens.THIS);
+ write(ASEmitterTokens.MEMBER_ACCESS);
+ getWalker().walk(node.getLeftOperandNode());
+ write(ASEmitterTokens.SQUARE_OPEN);
+ write(ASEmitterTokens.SINGLE_QUOTE);
+ write("E4XOperator");
+ write(ASEmitterTokens.SINGLE_QUOTE);
+ write(ASEmitterTokens.SQUARE_CLOSE);
+ continueWalk = false;
+ }
+ else if (node.getNodeID() == ASTNodeID.Op_DescendantsID)
+ {
+ // ToDo (erikdebruin): properly handle E4X
+
+ write(ASEmitterTokens.THIS);
+ write(ASEmitterTokens.MEMBER_ACCESS);
+ getWalker().walk(node.getLeftOperandNode());
+ write(ASEmitterTokens.SQUARE_OPEN);
+ write(ASEmitterTokens.SINGLE_QUOTE);
+ write("E4XSelector");
+ write(ASEmitterTokens.SINGLE_QUOTE);
+ write(ASEmitterTokens.SQUARE_CLOSE);
+ continueWalk = false;
+ }
+ else if (leftNode.getNodeID() != ASTNodeID.SuperID)
{
getWalker().walk(node.getLeftOperandNode());
write(node.getOperator().getOperatorText());
@@ -1128,7 +1158,8 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
}
- getWalker().walk(node.getRightOperandNode());
+ if (continueWalk)
+ getWalker().walk(node.getRightOperandNode());
}
private static ITypeDefinition getTypeDefinition(IDefinitionNode node)
@@ -1587,4 +1618,14 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
write(s);
}
}
+
+ @Override
+ public void emitE4XFilter(IMemberAccessExpressionNode node)
+ {
+ // ToDo (erikdebruin): implement E4X replacement !?!
+ write(ASEmitterTokens.SINGLE_QUOTE);
+ write("E4XFilter");
+ write(ASEmitterTokens.SINGLE_QUOTE);
+ }
+
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7822c332/compiler.jx/src/org/apache/flex/compiler/internal/visitor/as/ASNodeSwitch.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/visitor/as/ASNodeSwitch.java b/compiler.jx/src/org/apache/flex/compiler/internal/visitor/as/ASNodeSwitch.java
index 04b98ef..a64b599 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/visitor/as/ASNodeSwitch.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/visitor/as/ASNodeSwitch.java
@@ -116,6 +116,10 @@ public class ASNodeSwitch implements IASNodeStrategy
// ToDo (erikdebruin): implement handler
return;
+ case E4XFilterID:
+ visitor.visitE4XFilter((IMemberAccessExpressionNode) node);
+ return;
+
case FileID:
visitor.visitFile((IFileNode) node);
return;
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7822c332/compiler.jx/src/org/apache/flex/compiler/visitor/as/IASBlockVisitor.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/visitor/as/IASBlockVisitor.java b/compiler.jx/src/org/apache/flex/compiler/visitor/as/IASBlockVisitor.java
index 9510ef8..0376dba 100644
--- a/compiler.jx/src/org/apache/flex/compiler/visitor/as/IASBlockVisitor.java
+++ b/compiler.jx/src/org/apache/flex/compiler/visitor/as/IASBlockVisitor.java
@@ -218,4 +218,6 @@ public interface IASBlockVisitor extends IBlockVisitor
void visitEmbed(IEmbedNode node);
+ void visitE4XFilter(IMemberAccessExpressionNode node);
+
}