Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 4109D200B32 for ; Thu, 9 Jun 2016 00:53:35 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3FCBA160A35; Wed, 8 Jun 2016 22:53:35 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 87281160A2E for ; Thu, 9 Jun 2016 00:53:34 +0200 (CEST) Received: (qmail 98866 invoked by uid 500); 8 Jun 2016 22:53:33 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 98858 invoked by uid 99); 8 Jun 2016 22:53:33 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jun 2016 22:53:33 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6B435DFC71; Wed, 8 Jun 2016 22:53:33 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: joshtynjala@apache.org To: commits@flex.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: [flex-falcon] [refs/heads/develop] - compiler: include may be used as an identifier Date: Wed, 8 Jun 2016 22:53:33 +0000 (UTC) archived-at: Wed, 08 Jun 2016 22:53:35 -0000 Repository: flex-falcon Updated Branches: refs/heads/develop 9f308a1be -> cf3dd695a compiler: include may be used as an identifier Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/cf3dd695 Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/cf3dd695 Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/cf3dd695 Branch: refs/heads/develop Commit: cf3dd695a4225591047399febd4fbe33f255ca05 Parents: 9f308a1 Author: Josh Tynjala Authored: Wed Jun 8 15:53:30 2016 -0700 Committer: Josh Tynjala Committed: Wed Jun 8 15:53:30 2016 -0700 ---------------------------------------------------------------------- .../parsing/as/StreamingASTokenizer.java | 13 ++++++++++++ compiler/src/test/java/as/ASKeywordTests.java | 21 ++++++++++++++++++++ 2 files changed, 34 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/cf3dd695/compiler/src/main/java/org/apache/flex/compiler/internal/parsing/as/StreamingASTokenizer.java ---------------------------------------------------------------------- diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/parsing/as/StreamingASTokenizer.java b/compiler/src/main/java/org/apache/flex/compiler/internal/parsing/as/StreamingASTokenizer.java index 1c90e94..2db5d17 100644 --- a/compiler/src/main/java/org/apache/flex/compiler/internal/parsing/as/StreamingASTokenizer.java +++ b/compiler/src/main/java/org/apache/flex/compiler/internal/parsing/as/StreamingASTokenizer.java @@ -805,6 +805,19 @@ public class StreamingASTokenizer implements ASTokenTypes, IASTokenizer, Closeab return retVal; case TOKEN_KEYWORD_INCLUDE: { + if (lastToken != null) + { + int lastTokenType = lastToken.getType(); + switch (lastTokenType) + { + case TOKEN_KEYWORD_VAR: + case TOKEN_KEYWORD_FUNCTION: + case TOKEN_RESERVED_WORD_GET: + case TOKEN_RESERVED_WORD_SET: + case TOKEN_OPERATOR_MEMBER_ACCESS: + retVal.setType(TOKEN_IDENTIFIER); + } + } // "followIncludes=false" is usually used for code model // partitioner. They want the "include" token. if (!config.followIncludes) http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/cf3dd695/compiler/src/test/java/as/ASKeywordTests.java ---------------------------------------------------------------------- diff --git a/compiler/src/test/java/as/ASKeywordTests.java b/compiler/src/test/java/as/ASKeywordTests.java index 8223620..849cbce 100644 --- a/compiler/src/test/java/as/ASKeywordTests.java +++ b/compiler/src/test/java/as/ASKeywordTests.java @@ -313,6 +313,27 @@ public class ASKeywordTests extends ASFeatureTestsBase } @Test + public void ASKeyword_include_as_variable_name() + { + // all tests can assume that flash.display.Sprite + // flash.system.System and flash.events.Event have been imported + String[] imports = new String[] + { + }; + String[] declarations = new String[] + { + "public var include:String;", + }; + String[] testCode = new String[] + { + "this.include = 'bar';", + "assertEqual('variable named include', this.include, 'bar');", + }; + String source = getAS(imports, declarations, testCode, new String[0]); + compileAndRun(source); + } + + @Test public void ASKeyword_as_member_expression() { // all tests can assume that flash.display.Sprite