From commits-return-6510-archive-asf-public=cust-asf.ponee.io@royale.apache.org Mon Oct 22 07:44:00 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 8CCC918064A for ; Mon, 22 Oct 2018 07:43:59 +0200 (CEST) Received: (qmail 15702 invoked by uid 500); 22 Oct 2018 05:43:58 -0000 Mailing-List: contact commits-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 commits@royale.apache.org Received: (qmail 15680 invoked by uid 99); 22 Oct 2018 05:43:58 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Oct 2018 05:43:58 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 1719F8291E; Mon, 22 Oct 2018 05:43:58 +0000 (UTC) Date: Mon, 22 Oct 2018 05:43:59 +0000 To: "commits@royale.apache.org" Subject: [royale-compiler] 01/02: let local classes (classes in the same file but outside the package) win over global classes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: aharui@apache.org In-Reply-To: <154018703801.27867.11374872271896581526@gitbox.apache.org> References: <154018703801.27867.11374872271896581526@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: royale-compiler X-Git-Refname: refs/heads/develop X-Git-Reftype: branch X-Git-Rev: 4cc22a09dbcc9110183e672f32852c0343a1fbf1 X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20181022054358.1719F8291E@gitbox.apache.org> 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 commit 4cc22a09dbcc9110183e672f32852c0343a1fbf1 Author: Alex Harui AuthorDate: Sun Oct 21 22:43:09 2018 -0700 let local classes (classes in the same file but outside the package) win over global classes --- .../royale/compiler/internal/projects/RoyaleProject.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 55f336d..903889d 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 @@ -2169,6 +2169,10 @@ public class RoyaleProject extends ASProject implements IRoyaleProject, ICompile String thisPackage = null; if (scopeDef != null) thisPackage = scopeDef.getPackageName(); + else if (scope instanceof ASFileScope) + { + thisPackage = ""; + } else { while (!(scope instanceof PackageScope)) @@ -2208,6 +2212,18 @@ public class RoyaleProject extends ASProject implements IRoyaleProject, ICompile // that they meant the one they did import if (!usingWindow) { + // but if no packages at all first see if it is a local class + if (package1.length() == 0 && package2.length() == 0) + { + if (pkgScope instanceof PackageScope) + pkgScope = pkgScope.getContainingScope(); + if (pkgScope.getAllLocalNames().contains(name)) + { + IDefinitionSet defSet = pkgScope.getLocalDefinitionSetByName(name); + if (defSet.getSize() == 1) + return defSet.getDefinition(0); + } + } return package1.length() == 0 ? def2 : def1; } // otherwise fall through to ambiguous because they need to qualify