From dd83d1b38a310d38c848603fd7af863fbf3ff0e8 Mon Sep 17 00:00:00 2001 From: Thomas Smith Date: Thu, 17 Sep 2020 11:15:50 -0400 Subject: [PATCH] [JavaScript] Fix scoping of called private method names. (#2487) --- JavaScript/JavaScript.sublime-syntax | 11 ++++++++--- JavaScript/tests/syntax_test_js.js | 6 ++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/JavaScript/JavaScript.sublime-syntax b/JavaScript/JavaScript.sublime-syntax index 5b7663ca483..d0a72b516c6 100644 --- a/JavaScript/JavaScript.sublime-syntax +++ b/JavaScript/JavaScript.sublime-syntax @@ -1909,7 +1909,7 @@ contexts: - function-call-arguments - literal-variable - - match: (?={{identifier}}\s*(?:{{dot_accessor}}\s*{{identifier}}\s*)+(?:{{dot_accessor}})?\() + - match: (?={{identifier}}\s*(?:{{dot_accessor}}\s*#?{{identifier}}\s*)+(?:{{dot_accessor}})?\() set: - call-method-meta - function-call-arguments @@ -1946,6 +1946,11 @@ contexts: - match: '{{identifier}}' scope: variable.function.js pop: true + - match: '(#){{identifier}}' + scope: variable.function.js + captures: + 1: punctuation.definition.js + pop: true - include: else-pop literal-variable: @@ -2372,7 +2377,7 @@ contexts: object-property: - match: |- (?x)(?= - {{identifier}} + \#?{{identifier}} \s* = \s* {{either_func_lookahead}} ) @@ -2383,7 +2388,7 @@ contexts: - include: support-property - - match: '(?={{identifier}}\s*(?:{{dot_accessor}})?\()' + - match: '(?=#?{{identifier}}\s*(?:{{dot_accessor}})?\()' set: call-method-name - include: object-property-base diff --git a/JavaScript/tests/syntax_test_js.js b/JavaScript/tests/syntax_test_js.js index 4b3d7ee093d..c03ad6aff85 100644 --- a/JavaScript/tests/syntax_test_js.js +++ b/JavaScript/tests/syntax_test_js.js @@ -1377,6 +1377,12 @@ sources.DOM .status() // ^ meta.function-call.method variable.function + foo.#bar(); +// ^^^^^^^^^^ meta.function-call.method.js +// ^^^^ variable.function.js +// ^ punctuation.definition.js +// ^^ meta.group.js + return new Promise(resolve => preferenceObject.set({value}, resolve)); // ^ meta.function-call.constructor punctuation.section.group.end