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 2016/04/21 13:35:44 UTC
[14/19] git commit: [flex-falcon]
[refs/heads/feature/maven-migration-test] - compiler: allow default as a
variable name
compiler: allow default as a variable name
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/5a6e32e0
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/5a6e32e0
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/5a6e32e0
Branch: refs/heads/feature/maven-migration-test
Commit: 5a6e32e095dbdb5ceb82bf74d2086ba61fd923db
Parents: b1bfa69
Author: Josh Tynjala <jo...@apache.org>
Authored: Wed Apr 20 11:11:43 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Wed Apr 20 11:11:43 2016 -0700
----------------------------------------------------------------------
.../feature-tests/as/ASKeywordTests.java | 21 ++++++++++++++++++++
.../parsing/as/StreamingASTokenizer.java | 13 ++++++++++++
2 files changed, 34 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5a6e32e0/compiler.tests/feature-tests/as/ASKeywordTests.java
----------------------------------------------------------------------
diff --git a/compiler.tests/feature-tests/as/ASKeywordTests.java b/compiler.tests/feature-tests/as/ASKeywordTests.java
index 1602b3c..8223620 100644
--- a/compiler.tests/feature-tests/as/ASKeywordTests.java
+++ b/compiler.tests/feature-tests/as/ASKeywordTests.java
@@ -292,6 +292,27 @@ public class ASKeywordTests extends ASFeatureTestsBase
}
@Test
+ public void ASKeyword_default_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 default:String;",
+ };
+ String[] testCode = new String[]
+ {
+ "default = 'bar';",
+ "assertEqual('variable named default', default, '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
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5a6e32e0/compiler/src/org/apache/flex/compiler/internal/parsing/as/StreamingASTokenizer.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/parsing/as/StreamingASTokenizer.java b/compiler/src/org/apache/flex/compiler/internal/parsing/as/StreamingASTokenizer.java
index 61b6e26..1c90e94 100644
--- a/compiler/src/org/apache/flex/compiler/internal/parsing/as/StreamingASTokenizer.java
+++ b/compiler/src/org/apache/flex/compiler/internal/parsing/as/StreamingASTokenizer.java
@@ -1025,6 +1025,19 @@ public class StreamingASTokenizer implements ASTokenTypes, IASTokenizer, Closeab
else if (maybeXML != null &&
maybeXML.getType() != TOKEN_COLON)
retVal.setType(TOKEN_IDENTIFIER);
+ else 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);
+ }
+ }
return retVal;
}
case TOKEN_KEYWORD_VOID: