From dev-return-3598-archive-asf-public=cust-asf.ponee.io@royale.apache.org Tue Mar 20 18:09:23 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 4074918064A for ; Tue, 20 Mar 2018 18:09:23 +0100 (CET) Received: (qmail 7221 invoked by uid 500); 20 Mar 2018 17:09:22 -0000 Mailing-List: contact dev-help@royale.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@royale.apache.org Delivered-To: mailing list dev@royale.apache.org Received: (qmail 7198 invoked by uid 99); 20 Mar 2018 17:09:21 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Mar 2018 17:09:21 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 3798C1A0251 for ; Tue, 20 Mar 2018 17:09:21 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.129 X-Spam-Level: ** X-Spam-Status: No, score=2.129 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 9m8tiAhH0N2e for ; Tue, 20 Mar 2018 17:09:19 +0000 (UTC) Received: from mail-pl0-f41.google.com (mail-pl0-f41.google.com [209.85.160.41]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 83EA75F504 for ; Tue, 20 Mar 2018 17:09:18 +0000 (UTC) Received: by mail-pl0-f41.google.com with SMTP id p9-v6so1389668pls.2 for ; Tue, 20 Mar 2018 10:09:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=AT3UHyQ0o1JnoIf52zcNnh6dahi+byqnjOYjNTwXKpU=; b=HwlyefgH13zldKKD429Eme9iISNopYFf3I7WaZLYGdYd+hzBfw6tr+zV6+7Pj0f98j OeHKp1Kz7hZd/8OEvkET1hqDUtJC9WBUNGMtK9sOwDGSlNx2SqizW3sDdrUE10PzObT1 rPKtKdHttcYzhjWmObmy8hqHDPvqc49CVcAqLzPAxQCSVqqIH8wQZV2SM4Wlnfe+ZJ0E 141v+uQQVVMU6LmppHWSQFsK4juXfDFOLygOYG8OHdXIV19yjKhT6vaNOwMb5rHoKhRB dgzny1KQdoyV6vwHxNGuKlj3dHTAUxGtXCU5jssFxBgtuKRtHK2spbkD1Qmz73sgDTQs oAUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=AT3UHyQ0o1JnoIf52zcNnh6dahi+byqnjOYjNTwXKpU=; b=gJrMNTjNum9LD5/LOeptwlbiqnr9slzfKpLuviVP82pwV9YwdbDi6DDml+RyqI+1zN VtFtLhcsI4dUR3bLYdVwGsDpZRnhFug9hQSRMVcMobfRBKWAWLDzBHsABU2U25KHdOXS w9rXk6Tg6Dbw97+yR2bRMqYyPWrVpoFneh49Wjb7+vKBDCIJJOBFlvBS6EuFzvboIsJ3 R6Pur10oAjBkI9ErVd2q1YKn7o7PK+RTUsXonFUjKXr2GJO4ddjMKAz9Gtsp3kOnvHSJ izCWpcj7dKscVzFN8WVeHBl3NBFzOcnOtESDGYFTsL+iyEerKvof6evxoGVbOjFAaspW kZIw== X-Gm-Message-State: AElRT7Gc2TXiQkSPMHGATbYgSXDC+di31WYIQQQVqOcwvESXbluXhTwx hMCm5/WyD0Gu8Nn7HjF6fipTN7BuWsbO6CrHswM= X-Google-Smtp-Source: AG47ELtOfq3E42JOLKn72VLxYyc3TDfBWSuRVBJq1HeBU3m/XIylmmENamZuWUDJpKv5VtAWoA/IU+f+ZfI5rjLV9Yc= X-Received: by 2002:a17:902:56c:: with SMTP id 99-v6mr16911041plf.53.1521565757163; Tue, 20 Mar 2018 10:09:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.166.15 with HTTP; Tue, 20 Mar 2018 10:09:16 -0700 (PDT) In-Reply-To: <152156540367.23644.9941602873592201583@gitbox.apache.org> References: <152156540367.23644.9941602873592201583@gitbox.apache.org> From: Piotr Zarzycki Date: Tue, 20 Mar 2018 18:09:16 +0100 Message-ID: Subject: Re: [royale-compiler] branch develop updated: allow override of the State class To: dev@royale.apache.org Content-Type: multipart/alternative; boundary="000000000000754d450567db2237" --000000000000754d450567db2237 Content-Type: text/plain; charset="UTF-8" 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 : > 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 > 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 currentState 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 > aharui@apache.org. > -- Piotr Zarzycki Patreon: *https://www.patreon.com/piotrzarzycki * --000000000000754d450567db2237--