You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2019/11/20 22:37:25 UTC

[royale-compiler] 01/02: added strict-identifier-names compiler option

This is an automated email from the ASF dual-hosted git repository.

joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

View the commit online:
https://github.com/apache/royale-compiler/commit/e395861e17280f74e9dd1b878b13ef812194df65

commit e395861e17280f74e9dd1b878b13ef812194df65
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Wed Nov 20 13:56:52 2019 -0800

    added strict-identifier-names compiler option
    
    If set to true, the compiler will treat keywords and reserved words used as identifier names as errors, similar to other ActionScript compilers, like the one in the Flex SDK. We previously made this name parsing more lenient without adding an option to make it strict again.
---
 .../royale/compiler/config/Configuration.java      |  23 +++
 .../royale/compiler/projects/ICompilerProject.java |   5 +
 .../compiler/internal/parsing/as/BaseASParser.java |  11 +-
 .../internal/parsing/as/ConfigProcessor.java       |   6 +
 .../internal/parsing/as/StreamingASTokenizer.java  |  37 ++--
 .../compiler/internal/projects/ASCProject.java     |   6 +
 .../compiler/internal/projects/RoyaleProject.java  |  15 ++
 .../projects/RoyaleProjectConfigurator.java        |   2 +
 .../compiler/internal/units/ASCompilationUnit.java |   1 +
 compiler/src/test/java/as/ASKeywordTests.java      | 188 +++++++++++++++++----
 ...n_andStrictIdentifierNamesDisabled_swfdump.xml} |   0
 ...e_andStrictIdentifierNamesDisabled_swfdump.xml} |   0
 ...e_andStrictIdentifierNamesDisabled_swfdump.xml} |   0
 ...e_andStrictIdentifierNamesDisabled_swfdump.xml} |  26 +--
 ...e_andStrictIdentifierNamesDisabled_swfdump.xml} |   0
 ...e_andStrictIdentifierNamesDisabled_swfdump.xml} |  16 +-
 ...e_andStrictIdentifierNamesDisabled_swfdump.xml} |   0
 ...e_andStrictIdentifierNamesDisabled_swfdump.xml} |   0
 ...n_andStrictIdentifierNamesDisabled_swfdump.xml} |   0
 ...e_andStrictIdentifierNamesDisabled_swfdump.xml} |   0
 ...e_andStrictIdentifierNamesDisabled_swfdump.xml} |   0
 ...e_andStrictIdentifierNamesDisabled_swfdump.xml} |   0
 .../tools/debugger/expression/DebuggerUtil.java    |   2 +-
 23 files changed, 265 insertions(+), 73 deletions(-)

diff --git a/compiler-common/src/main/java/org/apache/royale/compiler/config/Configuration.java b/compiler-common/src/main/java/org/apache/royale/compiler/config/Configuration.java
index 3817b3e..857d43b 100644
--- a/compiler-common/src/main/java/org/apache/royale/compiler/config/Configuration.java
+++ b/compiler-common/src/main/java/org/apache/royale/compiler/config/Configuration.java
@@ -1552,6 +1552,29 @@ public class Configuration
     }
 
     //
+    // 'compiler.strict-identifier-names' option
+    //
+
+    private boolean strictIdentifierNames = false;
+
+    public boolean getCompilerStrictIdentifierNames()
+    {
+        return strictIdentifierNames;
+    }
+
+    /**
+     * Whether the compiler will enforce strict identifier naming. If enabled,
+     * certain keywords and reserved words cannot be used as identifier names.
+     */
+    @Config
+    @Mapping({ "compiler", "strict-identifier-names" })
+    @RoyaleOnly
+    public void setCompilerStrictIdentifierNames(ConfigurationValue cv, boolean allow)
+    {
+        this.strictIdentifierNames = allow;
+    }
+
+    //
     // 'compiler.actionscript-file-encoding' option
     //
 
diff --git a/compiler-common/src/main/java/org/apache/royale/compiler/projects/ICompilerProject.java b/compiler-common/src/main/java/org/apache/royale/compiler/projects/ICompilerProject.java
index 00042f9..0cbd0b5 100644
--- a/compiler-common/src/main/java/org/apache/royale/compiler/projects/ICompilerProject.java
+++ b/compiler-common/src/main/java/org/apache/royale/compiler/projects/ICompilerProject.java
@@ -281,5 +281,10 @@ public interface ICompilerProject
       * @return True if private constructors are allowed.
       */
      boolean getAllowPrivateConstructors();
+     
+     /**
+      * @return True if strict identifier naming is enforced.
+      */
+     boolean getStrictIdentifierNames();
 
 }
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/BaseASParser.java b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/BaseASParser.java
index 62bdaee..de180fb 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/BaseASParser.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/BaseASParser.java
@@ -191,7 +191,7 @@ abstract class BaseASParser extends LLkParser implements IProblemReporter
      */
     public static FileNode parseFile(IFileSpecification spec, IFileSpecificationGetter fileSpecGetter)
     {
-        return parseFile(spec, fileSpecGetter, EnumSet.of(PostProcessStep.CALCULATE_OFFSETS), EMPTY_CONFIGURATION, true);
+        return parseFile(spec, fileSpecGetter, EnumSet.of(PostProcessStep.CALCULATE_OFFSETS), EMPTY_CONFIGURATION, true, false);
     }
 
     /**
@@ -214,9 +214,10 @@ abstract class BaseASParser extends LLkParser implements IProblemReporter
             IFileSpecificationGetter fileSpecGetter,
             EnumSet<PostProcessStep> postProcess,
             IProjectConfigVariables variables,
-            boolean followIncludes)
+            boolean followIncludes,
+            boolean strictIdentifierNames)
     {
-        return parseFile(spec, fileSpecGetter, postProcess, variables, followIncludes, true, Collections.<String> emptyList(), DeferFunctionBody.DISABLED, null, null);
+        return parseFile(spec, fileSpecGetter, postProcess, variables, followIncludes, true, strictIdentifierNames, Collections.<String> emptyList(), DeferFunctionBody.DISABLED, null, null);
     }
 
     /**
@@ -247,6 +248,7 @@ abstract class BaseASParser extends LLkParser implements IProblemReporter
             IProjectConfigVariables variables,
             boolean followIncludes,
             boolean allowEmbeds,
+            boolean strictIdentifierNames,
             List<String> includedFiles,
             DeferFunctionBody deferFunctionBody,
             IASProject flashProject,
@@ -267,7 +269,8 @@ abstract class BaseASParser extends LLkParser implements IProblemReporter
                     spec,
                     includeHandler,
                     followIncludes,
-                    includedFiles);
+                    includedFiles,
+                    strictIdentifierNames);
 
             final IRepairingTokenBuffer buffer = new StreamingTokenBuffer(tokenizer);
 
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/ConfigProcessor.java b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/ConfigProcessor.java
index 89fcd51..ada8f94 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/ConfigProcessor.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/ConfigProcessor.java
@@ -176,6 +176,12 @@ public class ConfigProcessor
             // TODO Auto-generated method stub
             return false;
         }
+
+        @Override
+        public boolean getStrictIdentifierNames() {
+            // TODO Auto-generated method stub
+            return false;
+        }
     }
 
     /**
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/StreamingASTokenizer.java b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/StreamingASTokenizer.java
index abd84c7..93b67f5 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/StreamingASTokenizer.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/StreamingASTokenizer.java
@@ -183,6 +183,13 @@ public class StreamingASTokenizer implements ASTokenTypes, IASTokenizer, Closeab
          * Flag indicating we follow include statements, including their tokens
          */
         public boolean followIncludes = true;
+
+        /**
+         * Flag indicating if identifier naming is strictly enforced to consider
+         * keywords or reserved words invalid, or if it's more lenient, like
+         * newer ECMAScript versions introduced after ActionScript 3.
+         */
+        public boolean strictIdentifierNames = false;
     }
 
     private Reader reader;
@@ -259,13 +266,6 @@ public class StreamingASTokenizer implements ASTokenTypes, IASTokenizer, Closeab
     private final HashMap<String, String> stringPool;
 
     /**
-     * Indicates if identifier naming is strictly enforced to exclude keywords
-     * or reserved words, or if it's more lenient, like newer ECMAScript
-     * versions introduced after ActionScript 3.
-     */
-    public boolean strictIdentifiers = false;
-
-    /**
      * You should probably not use this constructor. There is a lot of code that
      * uses this constructor, but that code should be updated to use one of the
      * static create methods below.
@@ -362,11 +362,13 @@ public class StreamingASTokenizer implements ASTokenTypes, IASTokenizer, Closeab
             final IFileSpecification fileSpec,
             final IncludeHandler includeHandler,
             final boolean followIncludes,
-            final List<String> includedFiles)
+            final List<String> includedFiles,
+            final boolean strictIdentifierNames)
             throws FileNotFoundException
     {
         final StreamingASTokenizer tokenizer = create(fileSpec, includeHandler);
         tokenizer.setFollowIncludes(followIncludes);
+        tokenizer.setStrictIdentifierNames(strictIdentifierNames);
 
         final ImmutableList.Builder<ASToken> imaginaryTokensBuilder =
                 new ImmutableList.Builder<ASToken>();
@@ -557,6 +559,11 @@ public class StreamingASTokenizer implements ASTokenTypes, IASTokenizer, Closeab
         config.followIncludes = followIncludes;
     }
 
+    public void setStrictIdentifierNames(boolean value)
+    {
+        config.strictIdentifierNames = value;
+    }
+
     /**
      * Closes the underlying reader
      */
@@ -813,7 +820,7 @@ public class StreamingASTokenizer implements ASTokenTypes, IASTokenizer, Closeab
                     return retVal;
                 case TOKEN_KEYWORD_INCLUDE:
                 {
-                    if (!strictIdentifiers && lastToken != null)
+                    if (!config.strictIdentifierNames && lastToken != null)
                     {
                         int lastTokenType = lastToken.getType();
                         switch (lastTokenType)
@@ -1004,7 +1011,7 @@ public class StreamingASTokenizer implements ASTokenTypes, IASTokenizer, Closeab
                         consume(1);
                         return retVal;
                     }
-                    if (!strictIdentifiers && lastToken != null)
+                    if (!config.strictIdentifierNames && lastToken != null)
                     {
                         int lastTokenType = lastToken.getType();
                         switch (lastTokenType)
@@ -1048,11 +1055,11 @@ public class StreamingASTokenizer implements ASTokenTypes, IASTokenizer, Closeab
                     // if this isn't "default xml namespace" then
                     // see if it is the default case in a switch
                     // otherwise, assume it is an identiferName
-                    else if (!strictIdentifiers &&
+                    else if (!config.strictIdentifierNames &&
                             maybeXML != null && 
                             maybeXML.getType() != TOKEN_COLON)
                         retVal.setType(TOKEN_IDENTIFIER);
-                    else if (!strictIdentifiers && lastToken != null)
+                    else if (!config.strictIdentifierNames && lastToken != null)
                     {
                         int lastTokenType = lastToken.getType();
                         switch (lastTokenType)
@@ -1207,7 +1214,7 @@ public class StreamingASTokenizer implements ASTokenTypes, IASTokenizer, Closeab
                 case TOKEN_KEYWORD_AS:
                 case TOKEN_KEYWORD_IN:
                 case TOKEN_KEYWORD_IS:
-                    if(!strictIdentifiers)
+                    if(!config.strictIdentifierNames)
                     {
                         if (lastToken != null)
                         {
@@ -1230,7 +1237,7 @@ public class StreamingASTokenizer implements ASTokenTypes, IASTokenizer, Closeab
                     }
                     // and fall through
                 case TOKEN_KEYWORD_DELETE:
-                    if(!strictIdentifiers)
+                    if(!config.strictIdentifierNames)
                     {
                         ASToken nextToken = LT(1);
                         if (nextToken != null)
@@ -1280,7 +1287,7 @@ public class StreamingASTokenizer implements ASTokenTypes, IASTokenizer, Closeab
                 case TOKEN_KEYWORD_RETURN:
                 case TOKEN_KEYWORD_THROW:
                 case TOKEN_KEYWORD_NEW:
-                    if (!strictIdentifiers && lastToken != null)
+                    if (!config.strictIdentifierNames && lastToken != null)
                     {
                         int lastTokenType = lastToken.getType();
                         switch (lastTokenType)
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/projects/ASCProject.java b/compiler/src/main/java/org/apache/royale/compiler/internal/projects/ASCProject.java
index f542cf3..f37c32d 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/projects/ASCProject.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/projects/ASCProject.java
@@ -98,4 +98,10 @@ public class ASCProject extends CompilerProject implements IASCProject
 		// TODO Auto-generated method stub
 		return false;
 	}
+
+	@Override
+	public boolean getStrictIdentifierNames() {
+		// TODO Auto-generated method stub
+		return false;
+	}
 }
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleProject.java b/compiler/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleProject.java
index 3db86f5..1c8dd1c 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleProject.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleProject.java
@@ -2499,6 +2499,21 @@ public class RoyaleProject extends ASProject implements IRoyaleProject, ICompile
     	allowPrivateConstructors = allow;
     }
 
+    private boolean strictIdentifierNames = false;
+    
+    /**
+     * Indicates if strict identifier names are enforced.
+     */
+    @Override
+    public boolean getStrictIdentifierNames()
+    {
+    	return strictIdentifierNames;
+    }
+    public void setStrictIdentifierNames(boolean enabled)
+    {
+    	strictIdentifierNames = enabled;
+    }
+
 	@Override
 	public boolean isPlatformRule(ICSSRule rule) {
 		return true;
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleProjectConfigurator.java b/compiler/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleProjectConfigurator.java
index b8a34be..56d2265 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleProjectConfigurator.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleProjectConfigurator.java
@@ -267,6 +267,8 @@ public class RoyaleProjectConfigurator extends Configurator
             project.setAllowImportAliases(configuration.getCompilerAllowImportAliases());
             project.setAllowAbstractClasses(configuration.getCompilerAllowAbstractClasses());
             project.setAllowPrivateConstructors(configuration.getCompilerAllowPrivateConstructors());
+
+            project.setStrictIdentifierNames(configuration.getCompilerStrictIdentifierNames());
             
             project.setSwfDebugfileAlias(configuration.getSwfDebugfileAlias());
             if (configuration.getSwfDebugfileAlias() != null)
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/units/ASCompilationUnit.java b/compiler/src/main/java/org/apache/royale/compiler/internal/units/ASCompilationUnit.java
index b8266a1..31465ef 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/units/ASCompilationUnit.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/units/ASCompilationUnit.java
@@ -309,6 +309,7 @@ public class ASCompilationUnit extends CompilationUnitBase
                 this.getProject().getProjectConfigVariables(),
                 true,
                 this.getProject().isAssetEmbeddingSupported(),
+                this.getProject().getStrictIdentifierNames(),
                 includedFiles,
                 deferFunctionBody,
                 flashProject,
diff --git a/compiler/src/test/java/as/ASKeywordTests.java b/compiler/src/test/java/as/ASKeywordTests.java
index a325d89..b6914c6 100644
--- a/compiler/src/test/java/as/ASKeywordTests.java
+++ b/compiler/src/test/java/as/ASKeywordTests.java
@@ -19,6 +19,7 @@
 
 package as;
 
+import org.junit.Assert;
 import org.junit.Test;
 
 /**
@@ -60,7 +61,7 @@ public class ASKeywordTests extends ASFeatureTestsBase
     }
 
     @Test
-    public void ASKeyword_Namespace_as_method_name()
+    public void ASKeyword_Namespace_asMethodName_andStrictIdentifierNamesDisabled()
     {
         String[] imports = new String[]
         {
@@ -80,11 +81,62 @@ public class ASKeywordTests extends ASFeatureTestsBase
             "assertEqual('method named namespace', foo, 'as');",
         };
         String source = getAS(imports, declarations, testCode, new String[0]);
-        compileAndRun(source);
+        String[] options = new String[]
+        {
+            "-strict-identifier-names=false"
+        };
+        compileAndRun(source, false, false, false, options);
+    }
+
+    @Test
+    public void ASKeyword_Default_asVariableName_andStrictIdentifierNamesDisabled()
+    {
+        String[] imports = new String[]
+        {
+        };
+        String[] declarations = new String[]
+        {
+                "public var default:String;",
+        };
+        String[] testCode = new String[]
+        {
+                "this.default = 'bar';",
+                "assertEqual('variable named default', this.default, 'bar');",
+        };
+        String source = getAS(imports, declarations, testCode, new String[0]);
+        String[] options = new String[]
+        {
+            "-strict-identifier-names=false"
+        };
+        compileAndRun(source, false, false, false, options);
+    }
+
+    @Test
+    public void ASKeyword_Default_asVariableName_andStrictIdentifierNamesEnabled()
+    {
+        String[] imports = new String[]
+        {
+        };
+        String[] declarations = new String[]
+        {
+                "public var default:String;",
+        };
+        String[] testCode = new String[]
+        {
+                "this.default = 'bar';",
+                "assertEqual('variable named default', this.default, 'bar');",
+        };
+        String source = getAS(imports, declarations, testCode, new String[0]);
+        String[] options = new String[]
+        {
+            "-strict-identifier-names=true"
+        };
+        compileAndExpectErrors(source, false, false, false, options,
+            "Expected IDENTIFIER but got 'default'\n");
     }
 
     @Test
-    public void ASKeyword_Default_as_method_name()
+    public void ASKeyword_Default_asMethodName_andStrictIdentifierNamesDisabled()
     {
         String[] imports = new String[]
         {
@@ -104,11 +156,15 @@ public class ASKeywordTests extends ASFeatureTestsBase
             "assertEqual('method named default', foo, 'as');",
         };
         String source = getAS(imports, declarations, testCode, new String[0]);
-        compileAndRun(source);
+        String[] options = new String[]
+        {
+            "-strict-identifier-names=false"
+        };
+        compileAndRun(source, false, false, false, options);
     }
 
     @Test
-    public void ASKeyword_for_as_method_name()
+    public void ASKeyword_For_asMethodName_andStrictIdentifierNamesDisabled()
     {
         String[] imports = new String[]
         {
@@ -128,11 +184,15 @@ public class ASKeywordTests extends ASFeatureTestsBase
                 "assertEqual('method named default', foo, 'as');",
         };
         String source = getAS(imports, declarations, testCode, new String[0]);
-        compileAndRun(source);
+        String[] options = new String[]
+        {
+            "-strict-identifier-names=false"
+        };
+        compileAndRun(source, false, false, false, options);
     }
 
     @Test
-    public void ASKeyword_Get_as_method_name()
+    public void ASKeyword_Get_asMethodName_andStrictIdentifierNamesDisabled()
     {
         String[] imports = new String[]
         {
@@ -152,11 +212,15 @@ public class ASKeywordTests extends ASFeatureTestsBase
             "assertEqual('method named get', foo, 'as');",
         };
         String source = getAS(imports, declarations, testCode, new String[0]);
-        compileAndRun(source);
+        String[] options = new String[]
+        {
+            "-strict-identifier-names=false"
+        };
+        compileAndRun(source, false, false, false, options);
     }
 
     @Test
-    public void ASKeyword_Get_as_getter_name()
+    public void ASKeyword_Get_asGetterName_andStrictIdentifierNamesDisabled()
     {
         String[] imports = new String[]
         {
@@ -176,11 +240,15 @@ public class ASKeywordTests extends ASFeatureTestsBase
             "assertEqual('getter named get', foo, 'as');",
         };
         String source = getAS(imports, declarations, testCode, new String[0]);
-        compileAndRun(source);
+        String[] options = new String[]
+        {
+            "-strict-identifier-names=false"
+        };
+        compileAndRun(source, false, false, false, options);
     }
 
     @Test
-    public void ASKeyword_Get_as_member_expression_name()
+    public void ASKeyword_Get_asMemberExpression_andStrictIdentifierNamesDisabled()
     {
         String[] imports = new String[]
         {
@@ -200,11 +268,15 @@ public class ASKeywordTests extends ASFeatureTestsBase
             "assertEqual('getter named get', foo, 'as');",
         };
         String source = getAS(imports, declarations, testCode, new String[0]);
-        compileAndRun(source);
+        String[] options = new String[]
+        {
+            "-strict-identifier-names=false"
+        };
+        compileAndRun(source, false, false, false, options);
     }
 
     @Test
-    public void ASKeyword_as_method_name()
+    public void ASKeyword_As_asMethodName_andStrictIdentifierNamesDisabled()
     {
         String[] imports = new String[]
         {
@@ -224,11 +296,15 @@ public class ASKeywordTests extends ASFeatureTestsBase
             "assertEqual('method named as', foo, 'as');",
         };
         String source = getAS(imports, declarations, testCode, new String[0]);
-        compileAndRun(source);
+        String[] options = new String[]
+        {
+            "-strict-identifier-names=false"
+        };
+        compileAndRun(source, false, false, false, options);
     }
 
     @Test
-    public void ASKeyword_as_property_name()
+    public void ASKeyword_As_asPropertyName_andStrictIdentifierNamesDisabled()
     {
         String[] imports = new String[]
         {
@@ -249,11 +325,15 @@ public class ASKeywordTests extends ASFeatureTestsBase
             "assertEqual('property named as', as, 'bar');",
         };
         String source = getAS(imports, declarations, testCode, new String[0]);
-        compileAndRun(source);
+        String[] options = new String[]
+        {
+            "-strict-identifier-names=false"
+        };
+        compileAndRun(source, false, false, false, options);
     }
     
     @Test
-    public void ASKeyword_as_variable_name()
+    public void ASKeyword_As_asVariableName_andStrictIdentifierNamesDisabled()
     {
         String[] imports = new String[]
         {
@@ -264,34 +344,66 @@ public class ASKeywordTests extends ASFeatureTestsBase
         };
         String[] testCode = new String[]
         {
-        	"as = 'bar';",
-            "assertEqual('variable named as', as, 'bar');",
+        	"this.as = 'bar';",
+            "assertEqual('variable named as', this.as, 'bar');",
         };
         String source = getAS(imports, declarations, testCode, new String[0]);
-        compileAndRun(source);
+        String[] options = new String[]
+        {
+            "-strict-identifier-names=false"
+        };
+        compileAndRun(source, false, false, false, options);
     }
 
     @Test
-    public void ASKeyword_default_as_variable_name()
+    public void ASKeyword_As_asVariableName_andStrictIdentifierNamesEnabled()
     {
         String[] imports = new String[]
         {
         };
         String[] declarations = new String[]
         {
-                "public var default:String;",
+                "public var as:String;",
         };
         String[] testCode = new String[]
         {
-                "default = 'bar';",
-                "assertEqual('variable named default', default, 'bar');",
+                "this.as = 'bar';",
+                "assertEqual('variable named as', this.as, 'bar');",
         };
         String source = getAS(imports, declarations, testCode, new String[0]);
-        compileAndRun(source);
+        String[] options = new String[]
+        {
+            "-strict-identifier-names=true"
+        };
+        compileAndExpectErrors(source, false, false, false, options,
+            "Expected IDENTIFIER but got 'as'\n");
     }
 
     @Test
-    public void ASKeyword_include_as_variable_name()
+    public void ASKeyword_As_asMemberExpression_andStrictIdentifierNamesDisabled()
+    {
+        String[] imports = new String[]
+        {
+        };
+        String[] declarations = new String[]
+        {
+            "public var as:String;",
+        };
+        String[] testCode = new String[]
+        {
+        	"this.as = 'bar';",
+            "assertEqual('variable named as', this.as, 'bar');",
+        };
+        String source = getAS(imports, declarations, testCode, new String[0]);
+        String[] options = new String[]
+        {
+            "-strict-identifier-names=false"
+        };
+        compileAndRun(source, false, false, false, options);
+    }
+
+    @Test
+    public void ASKeyword_Include_asVariableName_andStrictIdentifierNamesDisabled()
     {
         String[] imports = new String[]
         {
@@ -306,26 +418,38 @@ public class ASKeywordTests extends ASFeatureTestsBase
                 "assertEqual('variable named include', this.include, 'bar');",
         };
         String source = getAS(imports, declarations, testCode, new String[0]);
-        compileAndRun(source);
+        String[] options = new String[]
+        {
+            "-strict-identifier-names=false"
+        };
+        compileAndRun(source, false, false, false, options);
     }
 
     @Test
-    public void ASKeyword_as_member_expression()
+    public void ASKeyword_Include_asVariableName_andStrictIdentifierNamesEnabled()
     {
         String[] imports = new String[]
         {
         };
         String[] declarations = new String[]
         {
-            "public var as:String;",
+                "public var include:String;",
         };
         String[] testCode = new String[]
         {
-        	"this.as = 'bar';",
-            "assertEqual('variable named as', this.as, 'bar');",
+                "this.include = 'bar';",
+                "assertEqual('variable named include', this.include, 'bar');",
         };
         String source = getAS(imports, declarations, testCode, new String[0]);
-        compileAndRun(source);
+        String[] options = new String[]
+        {
+            "-strict-identifier-names=true"
+        };
+        compileAndExpectErrors(source, false, false, false, options,
+            //not sure why there are three errors here, but not on others, like default and as
+            "Expected IDENTIFIER but got 'include'\n" +
+            "Expected IDENTIFIER but got 'include'\n" +
+            "Expected IDENTIFIER but got 'include'\n");
     }
 
     @Test
diff --git a/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_as_member_expression_swfdump.xml b/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_As_asMemberExpression_andStrictIdentifierNamesDisabled_swfdump.xml
similarity index 100%
rename from compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_as_member_expression_swfdump.xml
rename to compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_As_asMemberExpression_andStrictIdentifierNamesDisabled_swfdump.xml
diff --git a/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_as_method_name_swfdump.xml b/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_As_asMethodName_andStrictIdentifierNamesDisabled_swfdump.xml
similarity index 100%
rename from compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_as_method_name_swfdump.xml
rename to compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_As_asMethodName_andStrictIdentifierNamesDisabled_swfdump.xml
diff --git a/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_as_property_name_swfdump.xml b/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_As_asPropertyName_andStrictIdentifierNamesDisabled_swfdump.xml
similarity index 100%
rename from compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_as_property_name_swfdump.xml
rename to compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_As_asPropertyName_andStrictIdentifierNamesDisabled_swfdump.xml
diff --git a/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_as_variable_name_swfdump.xml b/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_As_asVariableName_andStrictIdentifierNamesDisabled_swfdump.xml
similarity index 85%
rename from compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_as_variable_name_swfdump.xml
rename to compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_As_asVariableName_andStrictIdentifierNamesDisabled_swfdump.xml
index 4269b0c..2636ecf 100644
--- a/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_as_variable_name_swfdump.xml
+++ b/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_As_asVariableName_andStrictIdentifierNamesDisabled_swfdump.xml
@@ -69,21 +69,21 @@ public class %0 extends Object
     //  max_regs     2            
     //  scope_depth  0            
     //  max_scope    1            
-    //  code_length  21           
+    //  code_length  20           
     bb0
       succs=[]
-      0       getlocal0                              
-      1       pushscope                              
-      2       pushstring      "bar"                  
-      3       findproperty    as                     
-      4       swap                                   
-      5       setproperty     as                     
-      6       findpropstrict  assertEqual            
-      7       pushstring      "variable named as"    
-      8       getlex          as                     
-      9       pushstring      "bar"                  
-      10      callpropvoid                           
-      11      returnvoid                             
+      0       getlocal0                                   
+      1       pushscope                                   
+      2       getlocal0                                   
+      3       pushstring      "bar"                       
+      4       setproperty     as                          
+      5       findpropstrict  assertEqual                 
+      6       pushstring      "variable named as"         
+      7       getlocal0                                   
+      8       getproperty     as                          
+      9       pushstring      "bar"                       
+      10      callpropvoid                                
+      11      returnvoid                                  
   }
 
   private function assertEqual(String,*,*):void
diff --git a/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Default_as_method_name_swfdump.xml b/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Default_asMethodName_andStrictIdentifierNamesDisabled_swfdump.xml
similarity index 100%
rename from compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Default_as_method_name_swfdump.xml
rename to compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Default_asMethodName_andStrictIdentifierNamesDisabled_swfdump.xml
diff --git a/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_default_as_variable_name_swfdump.xml b/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Default_asVariableName_andStrictIdentifierNamesDisabled_swfdump.xml
similarity index 91%
rename from compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_default_as_variable_name_swfdump.xml
rename to compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Default_asVariableName_andStrictIdentifierNamesDisabled_swfdump.xml
index 1b2f154..2e94dc3 100644
--- a/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_default_as_variable_name_swfdump.xml
+++ b/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Default_asVariableName_andStrictIdentifierNamesDisabled_swfdump.xml
@@ -69,18 +69,18 @@ public class %0 extends Object
     //  max_regs     2            
     //  scope_depth  0            
     //  max_scope    1            
-    //  code_length  21           
+    //  code_length  20           
     bb0
       succs=[]
       0       getlocal0                                   
       1       pushscope                                   
-      2       pushstring      "bar"                       
-      3       findproperty    default                     
-      4       swap                                        
-      5       setproperty     default                     
-      6       findpropstrict  assertEqual                 
-      7       pushstring      "variable named default"    
-      8       getlex          default                     
+      2       getlocal0                                   
+      3       pushstring      "bar"                       
+      4       setproperty     default                     
+      5       findpropstrict  assertEqual                 
+      6       pushstring      "variable named default"    
+      7       getlocal0                                   
+      8       getproperty     default                     
       9       pushstring      "bar"                       
       10      callpropvoid                                
       11      returnvoid                                  
diff --git a/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_for_as_method_name_swfdump.xml b/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_For_asMethodName_andStrictIdentifierNamesDisabled_swfdump.xml
similarity index 100%
rename from compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_for_as_method_name_swfdump.xml
rename to compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_For_asMethodName_andStrictIdentifierNamesDisabled_swfdump.xml
diff --git a/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Get_as_getter_name_swfdump.xml b/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Get_asGetterName_andStrictIdentifierNamesDisabled_swfdump.xml
similarity index 100%
rename from compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Get_as_getter_name_swfdump.xml
rename to compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Get_asGetterName_andStrictIdentifierNamesDisabled_swfdump.xml
diff --git a/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Get_as_member_expression_name_swfdump.xml b/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Get_asMemberExpression_andStrictIdentifierNamesDisabled_swfdump.xml
similarity index 100%
rename from compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Get_as_member_expression_name_swfdump.xml
rename to compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Get_asMemberExpression_andStrictIdentifierNamesDisabled_swfdump.xml
diff --git a/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Get_as_method_name_swfdump.xml b/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Get_asMethodName_andStrictIdentifierNamesDisabled_swfdump.xml
similarity index 100%
rename from compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Get_as_method_name_swfdump.xml
rename to compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Get_asMethodName_andStrictIdentifierNamesDisabled_swfdump.xml
diff --git a/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_include_as_variable_name_swfdump.xml b/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Include_asVariableName_andStrictIdentifierNamesDisabled_swfdump.xml
similarity index 100%
rename from compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_include_as_variable_name_swfdump.xml
rename to compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Include_asVariableName_andStrictIdentifierNamesDisabled_swfdump.xml
diff --git a/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Namespace_as_method_name_swfdump.xml b/compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Namespace_asMethodName_andStrictIdentifierNamesDisabled_swfdump.xml
similarity index 100%
rename from compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Namespace_as_method_name_swfdump.xml
rename to compiler/src/test/resources/swfdumps/as_ASKeywordTests_ASKeyword_Namespace_asMethodName_andStrictIdentifierNamesDisabled_swfdump.xml
diff --git a/debugger/src/main/java/flash/tools/debugger/expression/DebuggerUtil.java b/debugger/src/main/java/flash/tools/debugger/expression/DebuggerUtil.java
index 6c07e10..319ba43 100644
--- a/debugger/src/main/java/flash/tools/debugger/expression/DebuggerUtil.java
+++ b/debugger/src/main/java/flash/tools/debugger/expression/DebuggerUtil.java
@@ -55,7 +55,7 @@ public class DebuggerUtil
     	IWorkspace workspace = new Workspace();
         DebuggerUtil.InMemoryFileSpecification imfs = new DebuggerUtil.InMemoryFileSpecification(code);
         EnumSet<PostProcessStep> empty = EnumSet.noneOf(PostProcessStep.class);
-        IASNode exprAST = ASParser.parseFile(imfs, workspace, empty, null, false, false, new ArrayList<String>(), null, null, null);
+        IASNode exprAST = ASParser.parseFile(imfs, workspace, empty, null, false, false, false, new ArrayList<String>(), null, null, null);
 
         // Have to create a fake ScopedBlockNode so the expression can do things
         // like resolve, which means it has to be able to find a scope.