Repository: flex-falcon Updated Branches: refs/heads/develop 3fd7d0e53 -> abc4acca2
don't use global to override variable name prefixes Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/abc4acca Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/abc4acca Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/abc4acca Branch: refs/heads/develop Commit: abc4acca2d9209cea2040108e947b2bc887d579f Parents: f36ceb2 Author: Alex Harui <[email protected]> Authored: Thu Jun 23 14:23:45 2016 -0700 Committer: Alex Harui <[email protected]> Committed: Thu Jun 23 14:23:59 2016 -0700 ---------------------------------------------------------------------- .../internal/projects/FlexJSProject.java | 8 +++++- .../compiler/internal/projects/FlexProject.java | 18 +++++++++++++ .../tree/mxml/MXMLClassDefinitionNode.java | 27 +++++++------------- 3 files changed, 34 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/abc4acca/compiler-jx/src/main/java/org/apache/flex/compiler/internal/projects/FlexJSProject.java ---------------------------------------------------------------------- diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/projects/FlexJSProject.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/projects/FlexJSProject.java index bc6ffe7..bbc3c0e 100644 --- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/projects/FlexJSProject.java +++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/projects/FlexJSProject.java @@ -58,7 +58,6 @@ public class FlexJSProject extends FlexProject public FlexJSProject(Workspace workspace) { super(workspace); - MXMLClassDefinitionNode.GENERATED_ID_BASE = MXMLFlexJSEmitterTokens.ID_PREFIX.getToken(); } private HashMap<ICompilationUnit, HashMap<String, String>> interfaces = new HashMap<ICompilationUnit, HashMap<String, String>>(); @@ -325,4 +324,11 @@ public class FlexJSProject extends FlexProject e.printStackTrace(); } } + + @Override + public String getGeneratedIDBase() + { + return MXMLFlexJSEmitterTokens.ID_PREFIX.getToken(); + } + } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/abc4acca/compiler/src/main/java/org/apache/flex/compiler/internal/projects/FlexProject.java ---------------------------------------------------------------------- diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/projects/FlexProject.java b/compiler/src/main/java/org/apache/flex/compiler/internal/projects/FlexProject.java index ee7fd5c..fcabf87 100644 --- a/compiler/src/main/java/org/apache/flex/compiler/internal/projects/FlexProject.java +++ b/compiler/src/main/java/org/apache/flex/compiler/internal/projects/FlexProject.java @@ -2178,6 +2178,24 @@ public class FlexProject extends ASProject implements IFlexProject return this.strictXML = strictXML; } + /** + * The base for compiler-generated id's on instance tags that need an id but + * don't have one specified in MXML. Compiler-generated ids for instance + * tags have the form #0, #1, etc. The old compiler generated an id of the + * form "_MyComponent_Button3", but we prefer short names that are the same + * in all classes, because these create smaller SWFs. Also, the compiler can + * be simpler and faster if it doesn't have to track how many instances of + * each type it has seen in a class. Rather than using some weird Unicode + * character, we've chosen # as a normal ASCII character that will look OK + * in the debugger but not conflict with any developer-specified id, since + * it isn't allowed in an ActionScript identifier or MXML id. It also can't + * conflict with any dynamic properties, because MXML classes are sealed. + */ + public String getGeneratedIDBase() + { + return "#"; + } + @Override public boolean isCompatibleOverrideReturnType(ITypeDefinition overrideDefinition, ITypeDefinition baseDefinition) { http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/abc4acca/compiler/src/main/java/org/apache/flex/compiler/internal/tree/mxml/MXMLClassDefinitionNode.java ---------------------------------------------------------------------- diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/tree/mxml/MXMLClassDefinitionNode.java b/compiler/src/main/java/org/apache/flex/compiler/internal/tree/mxml/MXMLClassDefinitionNode.java index 7c3c9a6..8f73fc5 100644 --- a/compiler/src/main/java/org/apache/flex/compiler/internal/tree/mxml/MXMLClassDefinitionNode.java +++ b/compiler/src/main/java/org/apache/flex/compiler/internal/tree/mxml/MXMLClassDefinitionNode.java @@ -81,20 +81,6 @@ import static org.apache.flex.compiler.mxml.IMXMLLanguageConstants.*; public class MXMLClassDefinitionNode extends MXMLClassReferenceNodeBase implements IMXMLClassDefinitionNode, IScopedNode { - /** - * The base for compiler-generated id's on instance tags that need an id but - * don't have one specified in MXML. Compiler-generated ids for instance - * tags have the form #0, #1, etc. The old compiler generated an id of the - * form "_MyComponent_Button3", but we prefer short names that are the same - * in all classes, because these create smaller SWFs. Also, the compiler can - * be simpler and faster if it doesn't have to track how many instances of - * each type it has seen in a class. Rather than using some weird Unicode - * character, we've chosen # as a normal ASCII character that will look OK - * in the debugger but not conflict with any developer-specified id, since - * it isn't allowed in an ActionScript identifier or MXML id. It also can't - * conflict with any dynamic properties, because MXML classes are sealed. - */ - public static String GENERATED_ID_BASE = "#"; /** * Constructor @@ -124,6 +110,11 @@ public class MXMLClassDefinitionNode extends MXMLClassReferenceNodeBase private IASScope scope; /** + * The project for this class. + */ + private FlexProject project; + + /** * A map mapping an id to the instance node with that id. */ private Map<String, IMXMLInstanceNode> idMap; @@ -226,7 +217,7 @@ public class MXMLClassDefinitionNode extends MXMLClassReferenceNodeBase // Add the dependency between the class this node defines and its superclass, // as expressed by this tag that created this node. - FlexProject project = builder.getProject(); + project = builder.getProject(); IClassDefinition classReference = getClassReference(project); String qname = classReference.getQualifiedName(); builder.addDependency(qname, DependencyType.INHERITANCE); @@ -267,6 +258,7 @@ public class MXMLClassDefinitionNode extends MXMLClassReferenceNodeBase MXMLNodeInfo info) { MXMLFileScope fileScope = builder.getFileScope(); + project = builder.getProject(); MXMLNodeBase childNode = null; @@ -762,7 +754,7 @@ public class MXMLClassDefinitionNode extends MXMLClassReferenceNodeBase { if (generatedIDMap.containsKey(instanceNode)) return; - String id = GENERATED_ID_BASE + generatedIDCounter++; + String id = project.getGeneratedIDBase() + generatedIDCounter++; generatedIDMap.put(instanceNode, id); } } @@ -798,7 +790,7 @@ public class MXMLClassDefinitionNode extends MXMLClassReferenceNodeBase { if (stateDependentNodeMap == null) stateDependentNodeMap = ArrayListMultimap.create(); - + stateDependentNodeMap.put(state, node); } @@ -824,7 +816,6 @@ public class MXMLClassDefinitionNode extends MXMLClassReferenceNodeBase // TODO Should it be the first one in the 'states' property? initialState = node.getStateName(); } - StateDefinition oldState = stateMap.put(node.getStateName(), (StateDefinition)node.getDefinition());
