Hi Alex, Just out of curious what is the scenario which is the results of that changes ? I'm trying to understand from the code, but cannot imagine.
Thanks, Piotr 2018-03-20 18:03 GMT+01:00 <[email protected]>: > This is an automated email from the ASF dual-hosted git repository. > > aharui pushed a commit to branch develop > in repository https://gitbox.apache.org/repos/asf/royale-compiler.git > > > The following commit(s) were added to refs/heads/develop by this push: > new 808fe2a allow override of the State class > 808fe2a is described below > > commit 808fe2ab3c28fa414c42ea55c7d388bab1cad6b9 > Author: Alex Harui <[email protected]> > AuthorDate: Tue Mar 20 10:03:13 2018 -0700 > > allow override of the State class > --- > .../compiler/internal/projects/RoyaleProject.java | 5 ++++ > .../internal/tree/mxml/MXMLInstanceNode.java | 30 > +++++++++++++++++++++- > 2 files changed, 34 insertions(+), 1 deletion(-) > > 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 a2dff6f..0d73440 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 > @@ -170,6 +170,11 @@ public class RoyaleProject extends ASProject > implements IRoyaleProject, ICompile > private String stateClass; > > /** > + * The resolved stateClass > + */ > + public ITypeDefinition stateClassType = null; > + > + /** > * The fully-qualified name of the runtime interface > * for a component with a <code>currentState</code> property. > * Currently this is "mx.core.IStateClient". > diff --git a/compiler/src/main/java/org/apache/royale/compiler/ > internal/tree/mxml/MXMLInstanceNode.java b/compiler/src/main/java/org/ > apache/royale/compiler/internal/tree/mxml/MXMLInstanceNode.java > index 72f87ce..1405b81 100644 > --- a/compiler/src/main/java/org/apache/royale/compiler/ > internal/tree/mxml/MXMLInstanceNode.java > +++ b/compiler/src/main/java/org/apache/royale/compiler/ > internal/tree/mxml/MXMLInstanceNode.java > @@ -34,7 +34,10 @@ import org.apache.royale.compiler. > common.DependencyType; > import org.apache.royale.compiler.constants.IASLanguageConstants; > import org.apache.royale.compiler.definitions.IClassDefinition; > import org.apache.royale.compiler.definitions.IDefinition; > +import org.apache.royale.compiler.definitions.ITypeDefinition; > import org.apache.royale.compiler.definitions.IVariableDefinition; > +import org.apache.royale.compiler.definitions.references. > IResolvedQualifiersReference; > +import org.apache.royale.compiler.definitions.references. > ReferenceFactory; > import org.apache.royale.compiler.internal.mxml.MXMLDialect; > import org.apache.royale.compiler.internal.projects.RoyaleProject; > import org.apache.royale.compiler.internal.scopes.ASScope; > @@ -56,6 +59,31 @@ import org.apache.royale.compiler. > tree.mxml.IMXMLInstanceNode; > > class MXMLInstanceNode extends MXMLClassReferenceNodeBase implements > IMXMLInstanceNode > { > + private static boolean isStateClass(String instanceType, > RoyaleProject project) > + { > + // we are going to require that all subclasses are also > named State > + // but just in different packages. That way we don't have > to keep resolving > + // instanceType > + if (!instanceType.endsWith(".State")) > + return false; > + > + if (instanceType.equals(project.getStateClass())) > + return true; > + > + IResolvedQualifiersReference instanceRef = ReferenceFactory. > packageQualifiedReference( > + project.getWorkspace(), instanceType); > + ITypeDefinition instanceTypeDef = (ITypeDefinition)instanceRef. > resolve(project); > + > + if (project.stateClassType == null) > + { > + IResolvedQualifiersReference stateRef = ReferenceFactory. > packageQualifiedReference( > + project.getWorkspace(), project.getStateClass()); > + project.stateClassType = (ITypeDefinition)stateRef. > resolve(project); > + } > + > + return (instanceTypeDef.isInstanceOf(project.stateClassType, > project)); > + } > + > protected static MXMLInstanceNode createInstanceNode(MXMLTreeBuilder > builder, > String > instanceType, > NodeBase parent) > @@ -89,7 +117,7 @@ class MXMLInstanceNode extends > MXMLClassReferenceNodeBase implements IMXMLInstan > else if (instanceType.equals(IASLanguageConstants.Vector_qname)) > return new MXMLVectorNode(parent); > > - else if (instanceType.equals(builder.getProject().getStateClass()) > && mxmlDialect != MXMLDialect.MXML_2006) > + else if (isStateClass(instanceType, builder.getProject()) && > mxmlDialect != MXMLDialect.MXML_2006) > return new MXMLStateNode(parent); > > else if (instanceType.equals(builder.getProject(). > getWebServiceQName())) > > -- > To stop receiving notification emails like this one, please contact > [email protected]. > -- Piotr Zarzycki Patreon: *https://www.patreon.com/piotrzarzycki <https://www.patreon.com/piotrzarzycki>*
