Skip to content

Commit cce0e00

Browse files
committed
Scope length method correctly
Fixes #730
1 parent 95f5929 commit cce0e00

File tree

5 files changed

+31
-6
lines changed

5 files changed

+31
-6
lines changed

TypeScript.YAML-tmLanguage

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,9 +1805,9 @@ repository:
18051805
# DOM
18061806
- match: |-
18071807
(?x) {{propertyAccess}} \s* (?:
1808-
(constructor|length|prototype|__proto__)
1808+
(?:(constructor|length|prototype|__proto__)\b(?!\$|\s*{{typeParameters}}?\())
18091809
|
1810-
(EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY))\b(?!\$)
1810+
(?:(EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY)\b(?!\$)))
18111811
captures:
18121812
'1': { name: punctuation.accessor.ts }
18131813
'2': { name: punctuation.accessor.optional.ts }

TypeScript.tmLanguage

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5843,9 +5843,9 @@
58435843
<dict>
58445844
<key>match</key>
58455845
<string>(?x) (?:(\.)|(\?\.(?!\s*[[:digit:]]))) \s* (?:
5846-
(constructor|length|prototype|__proto__)
5846+
(?:(constructor|length|prototype|__proto__)\b(?!\$|\s*(&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?\())
58475847
|
5848-
(EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY))\b(?!\$)</string>
5848+
(?:(EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY)\b(?!\$)))</string>
58495849
<key>captures</key>
58505850
<dict>
58515851
<key>1</key>

TypeScriptReact.tmLanguage

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5765,9 +5765,9 @@
57655765
<dict>
57665766
<key>match</key>
57675767
<string>(?x) (?:(\.)|(\?\.(?!\s*[[:digit:]]))) \s* (?:
5768-
(constructor|length|prototype|__proto__)
5768+
(?:(constructor|length|prototype|__proto__)\b(?!\$|\s*(&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?\())
57695769
|
5770-
(EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY))\b(?!\$)</string>
5770+
(?:(EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY)\b(?!\$)))</string>
57715771
<key>captures</key>
57725772
<dict>
57735773
<key>1</key>

tests/baselines/Issue730.baseline.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
original file
2+
-----------------------------------
3+
object.length('it should be function type')
4+
-----------------------------------
5+
6+
Grammar: TypeScript.tmLanguage
7+
-----------------------------------
8+
>object.length('it should be function type')
9+
^^^^^^
10+
source.ts meta.function-call.ts variable.other.object.ts
11+
^
12+
source.ts meta.function-call.ts punctuation.accessor.ts
13+
^^^^^^
14+
source.ts meta.function-call.ts entity.name.function.ts
15+
^
16+
source.ts meta.brace.round.ts
17+
^
18+
source.ts string.quoted.single.ts punctuation.definition.string.begin.ts
19+
^^^^^^^^^^^^^^^^^^^^^^^^^^
20+
source.ts string.quoted.single.ts
21+
^
22+
source.ts string.quoted.single.ts punctuation.definition.string.end.ts
23+
^
24+
source.ts meta.brace.round.ts

tests/cases/Issue730.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
object.length('it should be function type')

0 commit comments

Comments
 (0)