flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joshtynj...@apache.org
Subject git commit: [flex-falcon] [refs/heads/develop] - compiler: include may be used as an identifier
Date Wed, 08 Jun 2016 22:53:33 GMT
Repository: flex-falcon
Updated Branches:
  refs/heads/develop 9f308a1be -> cf3dd695a


compiler: include may be used as an identifier


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

Branch: refs/heads/develop
Commit: cf3dd695a4225591047399febd4fbe33f255ca05
Parents: 9f308a1
Author: Josh Tynjala <joshtynjala@gmail.com>
Authored: Wed Jun 8 15:53:30 2016 -0700
Committer: Josh Tynjala <joshtynjala@gmail.com>
Committed: Wed Jun 8 15:53:30 2016 -0700

----------------------------------------------------------------------
 .../parsing/as/StreamingASTokenizer.java        | 13 ++++++++++++
 compiler/src/test/java/as/ASKeywordTests.java   | 21 ++++++++++++++++++++
 2 files changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/cf3dd695/compiler/src/main/java/org/apache/flex/compiler/internal/parsing/as/StreamingASTokenizer.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/parsing/as/StreamingASTokenizer.java
b/compiler/src/main/java/org/apache/flex/compiler/internal/parsing/as/StreamingASTokenizer.java
index 1c90e94..2db5d17 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/parsing/as/StreamingASTokenizer.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/parsing/as/StreamingASTokenizer.java
@@ -805,6 +805,19 @@ public class StreamingASTokenizer implements ASTokenTypes, IASTokenizer,
Closeab
                     return retVal;
                 case TOKEN_KEYWORD_INCLUDE:
                 {
+                    if (lastToken != null)
+                    {
+                        int lastTokenType = lastToken.getType();
+                        switch (lastTokenType)
+                        {
+                            case TOKEN_KEYWORD_VAR:
+                            case TOKEN_KEYWORD_FUNCTION:
+                            case TOKEN_RESERVED_WORD_GET:
+                            case TOKEN_RESERVED_WORD_SET:
+                            case TOKEN_OPERATOR_MEMBER_ACCESS:
+                                retVal.setType(TOKEN_IDENTIFIER);
+                        }
+                    }
                     // "followIncludes=false" is usually used for code model
                     // partitioner. They want the "include" token.
                     if (!config.followIncludes)

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/cf3dd695/compiler/src/test/java/as/ASKeywordTests.java
----------------------------------------------------------------------
diff --git a/compiler/src/test/java/as/ASKeywordTests.java b/compiler/src/test/java/as/ASKeywordTests.java
index 8223620..849cbce 100644
--- a/compiler/src/test/java/as/ASKeywordTests.java
+++ b/compiler/src/test/java/as/ASKeywordTests.java
@@ -313,6 +313,27 @@ public class ASKeywordTests extends ASFeatureTestsBase
     }
 
     @Test
+    public void ASKeyword_include_as_variable_name()
+    {
+        // all tests can assume that flash.display.Sprite
+        // flash.system.System and flash.events.Event have been imported
+        String[] imports = new String[]
+        {
+        };
+        String[] declarations = new String[]
+        {
+                "public var include:String;",
+        };
+        String[] testCode = new String[]
+        {
+                "this.include = 'bar';",
+                "assertEqual('variable named include', this.include, 'bar');",
+        };
+        String source = getAS(imports, declarations, testCode, new String[0]);
+        compileAndRun(source);
+    }
+
+    @Test
     public void ASKeyword_as_member_expression()
     {
     	// all tests can assume that flash.display.Sprite


Mime
View raw message