flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject git commit: [flex-falcon] [refs/heads/develop] - monkey with literal emitter for these simple test cases
Date Wed, 07 Sep 2016 20:09:18 GMT
Repository: flex-falcon
Updated Branches:
  refs/heads/develop 9c58af2e2 -> ce39ed085


monkey with literal emitter for these simple test cases


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/ce39ed08
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/ce39ed08
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/ce39ed08

Branch: refs/heads/develop
Commit: ce39ed08592465230be2879c9d6261d21d261330
Parents: 9c58af2
Author: Alex Harui <aharui@apache.org>
Authored: Wed Sep 7 13:09:04 2016 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Wed Sep 7 13:09:04 2016 -0700

----------------------------------------------------------------------
 .../internal/codegen/js/jx/LiteralEmitter.java  |  4 +-
 .../js/flexjs/TestFlexJSExpressions.java        | 50 ++++++++++++++++++++
 2 files changed, 52 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ce39ed08/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
index 854614e..6b7cfb8 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
@@ -100,11 +100,11 @@ public class LiteralEmitter extends JSSubEmitter implements
             s = s.replaceAll("\t", "__TAB_PLACEHOLDER__");
             s = s.replaceAll("\f", "__FORMFEED_PLACEHOLDER__");
             s = s.replaceAll("\b", "__BACKSPACE_PLACEHOLDER__");
-            s = s.replaceAll("\\\\\"", "__QUOTE_PLACEHOLDER__");
             s = s.replaceAll("\\\\", "__ESCAPE_PLACEHOLDER__");
+            s = s.replaceAll("\\\\\"", "__QUOTE_PLACEHOLDER__");
             //s = "\'" + s.replaceAll("\'", "\\\\\'") + "\'";
-            s = s.replaceAll("__ESCAPE_PLACEHOLDER__", "\\\\\\\\");
             s = s.replaceAll("__QUOTE_PLACEHOLDER__", "\\\\\"");
+            s = s.replaceAll("__ESCAPE_PLACEHOLDER__", "\\\\\\\\");
             s = s.replaceAll("__BACKSPACE_PLACEHOLDER__", "\\\\b");
             s = s.replaceAll("__FORMFEED_PLACEHOLDER__", "\\\\f");
             s = s.replaceAll("__TAB_PLACEHOLDER__", "\\\\t");

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ce39ed08/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
index 559c1ae..aef3e26 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
@@ -1015,6 +1015,56 @@ public class TestFlexJSExpressions extends TestGoogExpressions
     }
 
     @Test
+    public void testVisitStringLiteralSingleEscapedBackslash()
+    {
+    	// a = "\\";
+        LiteralNode node = (LiteralNode) getExpressionNode(
+                "a = \"\\\\\"", LiteralNode.class);
+        asBlockWalker.visitLiteral(node);
+        assertOut("\"\\\\\"");
+    }
+
+    @Test
+    public void testVisitStringLiteralSingleEscapedBackslashInParens()
+    {
+    	// a = a.indexOf("\\");
+        LiteralNode node = (LiteralNode) getExpressionNode(
+                "a = a.indexOf(\"\\\\\")", LiteralNode.class);
+        asBlockWalker.visitLiteral(node);
+        assertOut("\"\\\\\"");
+    }
+    
+    @Test
+    public void testVisitStringLiteralSingleEscapedBackslashSingleQuote()
+    {
+    	// a = "\\";
+        LiteralNode node = (LiteralNode) getExpressionNode(
+                "a = '\\\\'", LiteralNode.class);
+        asBlockWalker.visitLiteral(node);
+        assertOut("'\\\\'");
+    }
+
+    @Test
+    public void testVisitStringLiteralSlashN()
+    {
+    	// a = "\n";
+        LiteralNode node = (LiteralNode) getExpressionNode(
+                "a = \"\\n\"", LiteralNode.class);
+        asBlockWalker.visitLiteral(node);
+        assertOut("\"\\n\"");
+    }
+
+    @Test
+    public void testVisitStringLiteralSlashB()
+    {
+    	// a = "\n";
+        LiteralNode node = (LiteralNode) getExpressionNode(
+                "a = \"\\b\"", LiteralNode.class);
+        asBlockWalker.visitLiteral(node);
+        assertOut("\"\\b\"");
+    }
+
+    @Test
     public void testVisitStringLiteralEmbeddedDoubleQuote()
     {
     	// a = " ' \" ";


Mime
View raw message