8000 ES private field check by acutmore · Pull Request #44648 · microsoft/TypeScript · GitHub
[go: up one dir, main page]

Skip to content

ES private field check #44648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 45 commits into from
Sep 24, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
f04f22c
es private fields in in (#52)
acutmore Jun 17, 2021
30dde52
[fixup] include inToken when walking forEachChild(node, cb)
acutmore Jun 18, 2021
31fa02b
Merge remote-tracking branch 'origin/main' into bb-private-field-in-in
acutmore Jun 18, 2021
307247c
Merge remote-tracking branch 'origin/main' into bb-private-field-in-in
acutmore Jun 30, 2021
61c677b
[squash] re-accept lib definition baseline changes
acutmore Jun 30, 2021
8292ee2
[squash] reduce if/else to ternary
acutmore Sep 15, 2021
4723380
[squash] drop 'originalName' and rename parameter instead
acutmore Sep 15, 2021
9f1c176
[squash] extend spelling suggestion to all privateIdentifiers
acutmore Sep 15, 2021
511ac22
[squash] revert the added lexical spelling suggestions logic
acutmore Sep 16, 2021
337f7e8
[squash] update baseline
acutmore Sep 16, 2021
d059c15
[squash] inline variable as per PR suggestion
acutmore Sep 16, 2021
79eeebe
[squash] test targets both esnext and es2020 as per PR comment
acutmore Sep 16, 2021
125df93
switch to using a binary expression
acutmore Sep 17, 2021
c6b2a21
Merge remote-tracking branch 'origin/main' into private-field-in-in
acutmore Sep 17, 2021
320bc00
[squash] PrivateIdentifier now extends PrimaryExpression
acutmore Sep 17, 2021
cc80c7d
[squash] accept public api baseline changes
acutmore Sep 17, 2021
ebbb063
[squash] classPrivateFieldInHelper now has documentation
acutmore Sep 17, 2021
ea4fd4b
[squash] type-check now follows existing in-expression path
acutmore Sep 20, 2021
8b78f01
[squash] parser now follows existing binaryExpression path
acutmore Sep 20, 2021
01c7042
[squash] correct typo in comment
acutmore Sep 21, 2021
fc2b262
[squash] no longer use esNext flag
acutmore Sep 21, 2021
c007a12
[squash] swap 'reciever, state' helper params
acutmore Sep 21, 2021
40bd336
[squash] remove change to parenthesizerRules
acutmore Sep 21, 2021
7982164
[squash] apply suggested changes to checker
acutmore Sep 21, 2021
1cd313f
[squash] remove need for assertion in fixSpelling
acutmore Sep 21, 2021
97f7d30
[squash] improve comment hint in test
acutmore Sep 21, 2021
e672957
[squash] fix comment typos
acutmore Sep 22, 2021
2b7425d
[squash] add flow-test for Foo | FooSub | Bar
acutmore Sep 22, 2021
52b9f2a
[squash] add checkExternalEmitHelpers call and new test case
acutmore Sep 22, 2021
476bf24
[squash] simplify and correct parser
acutmore Sep 22, 2021
be26d0a
[squash] move most of the added checker logic to expression level
acutmore Sep 22, 2021
f7ddce5
[squash] always error when privateId could not be resolved
acutmore Sep 22, 2021
01e0e60
[squash] reword comment
acutmore Sep 22, 2021
913d044
[squash] fix codeFixSpelling test
acutmore Sep 22, 2021
7c49552
[squash] do less work
acutmore Sep 22, 2021
c6b039f
store symbol by priateId not binaryExpression
acutmore Sep 23, 2021
6f56c6a
moved parsePrivateIdentifier into parsePrimaryExpression
acutmore Sep 23, 2021
c3b6c2a
[squash] checkInExpressionn bails out early on silentNeverType
acutmore Sep 23, 2021
5fbb2da
[squash] more detailed error messages
acutmore Sep 23, 2021
c924a51
[squash] resolves conflict in diagnosticMessages.json
acutmore Sep 23, 2021
27d494d
Merge remote-tracking branch 'origin/main' into private-field-in-in-b…
acutmore Sep 23, 2021
33c3b55
[squash] update baseline for importHelpersES6
acutmore Sep 23, 2021
e3c25c9
[squash] remove redundent if and comment from parser
acutmore Sep 23, 2021
74e56a6
[squash] split up grammar/check/symbolLookup
acutmore Sep 23, 2021
8447934
[squash] reword message for existing left side of in-expression error
acutmore Sep 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
moved parsePrivateIdentifier into parsePrimaryExpression
Signed-off-by: Ashley Claymore <acutmore@users.noreply.github.com>
  • Loading branch information
acutmore committed Sep 23, 2021
commit 6f56c6afdb18c34d6c36ac39b2cd39e3b872bfb3
17 changes: 9 additions & 8 deletions src/compiler/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4737,14 +4737,6 @@ namespace ts {
*
*/
function parseUnaryExpressionOrHigher(): UnaryExpression | BinaryExpression {
/**
* If we have a PrivateIdentifier, parse this unconditionally.
* A privateIdentifier is only valid on its own in the RelationalExpression: `#field in expr`.
* The checker will emit an error if this is not the case.
*/
if (token() === SyntaxKind.PrivateIdentifier) {
return parsePrivateIdentifier();
}
/**
* ES7 UpdateExpression:
* 1) LeftHandSideExpression[?Yield]
Expand Down Expand Up @@ -5611,6 +5603,15 @@ namespace ts {
break;
case SyntaxKind.TemplateHead:
return parseTemplateExpression(/* isTaggedTemplate */ false);
case SyntaxKind.PrivateIdentifier:
/**
* If we have a PrivateIdentifier, parse this unconditionally. Even though a privateIdentifier is
* only syntactically valid here when it in in the BinaryExpression: `#field in expr`.
* The checker will emit an error for invalid cases.
*/
if (token() === SyntaxKind.PrivateIdentifier) {
return parsePrivateIdentifier();
}
}

return parseIdentifier(Diagnostics.Expression_expected);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export class Foo {
>this : Symbol(Foo, Decl(main.ts, 0, 0))

#field in this;
>#field : Symbol(Foo.#field, Decl(main.ts, 0, 18))
>this : Symbol(Foo, Decl(main.ts, 0, 0))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class Foo {

#field in this;
>#field in this : boolean
>#field : any
>this : this
}
}
Expand Down
0