mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 20:28:58 +00:00
fix(parser): parse intrinsic TS keyword (#8627)
This commit is contained in:
parent
48717ab87c
commit
178c2322f5
4 changed files with 16 additions and 13 deletions
|
|
@ -124,7 +124,13 @@ impl<'a> ParserImpl<'a> {
|
|||
let params = self.parse_ts_type_parameters()?;
|
||||
self.expect(Kind::Eq)?;
|
||||
|
||||
let annotation = self.parse_ts_type()?;
|
||||
let annotation = if self.at(Kind::Intrinsic) && !self.peek_at(Kind::Dot) {
|
||||
let span = self.start_span();
|
||||
self.bump_any();
|
||||
self.ast.ts_type_intrinsic_keyword(self.end_span(span))
|
||||
} else {
|
||||
self.parse_ts_type()?
|
||||
};
|
||||
|
||||
self.asi()?;
|
||||
let span = self.end_span(span);
|
||||
|
|
|
|||
|
|
@ -433,10 +433,6 @@ impl<'a> ParserImpl<'a> {
|
|||
self.bump_any();
|
||||
self.ast.ts_type_boolean_keyword(self.end_span(span))
|
||||
}
|
||||
Kind::Intrinsic => {
|
||||
self.bump_any();
|
||||
self.ast.ts_type_intrinsic_keyword(self.end_span(span))
|
||||
}
|
||||
Kind::Never => {
|
||||
self.bump_any();
|
||||
self.ast.ts_type_never_keyword(self.end_span(span))
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ commit: acbc09a8
|
|||
parser_babel Summary:
|
||||
AST Parsed : 2277/2292 (99.35%)
|
||||
Positive Passed: 2256/2292 (98.43%)
|
||||
Negative Passed: 1541/1662 (92.72%)
|
||||
Negative Passed: 1542/1662 (92.78%)
|
||||
Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/annex-b/enabled/3.1-sloppy-labeled-functions-if-body/input.js
|
||||
Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-if/input.js
|
||||
Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop/input.js
|
||||
|
|
@ -121,7 +121,6 @@ Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/ty
|
|||
Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/types/import-type-declaration-error/input.ts
|
||||
Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/types/import-type-dynamic-errors/input.ts
|
||||
Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/types/import-type-dynamic-errors-babel-7/input.ts
|
||||
Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/types/intrinsic-keyword-error/input.ts
|
||||
Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/types/tuple-labeled-invalid-optional/input.ts
|
||||
Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/types/tuple-optional-invalid/input.ts
|
||||
Expect Syntax Error: tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/types/tuple-required-after-labeled-optional/input.ts
|
||||
|
|
@ -12756,6 +12755,14 @@ Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/typesc
|
|||
· ─────────
|
||||
╰────
|
||||
|
||||
× Expected a semicolon or an implicit semicolon after a statement, but found none
|
||||
╭─[babel/packages/babel-parser/test/fixtures/typescript/types/intrinsic-keyword-error/input.ts:1:21]
|
||||
1 │ type Foo = intrinsic["foo"];
|
||||
· ▲
|
||||
2 │
|
||||
╰────
|
||||
help: Try insert a semicolon here
|
||||
|
||||
× Unexpected token
|
||||
╭─[babel/packages/babel-parser/test/fixtures/typescript/types/literal-string-3/input.ts:1:19]
|
||||
1 │ let x: `foo-${bar + baz}`;
|
||||
|
|
|
|||
|
|
@ -2531,17 +2531,11 @@ tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/types/intrin
|
|||
semantic error: Scope children mismatch:
|
||||
after transform: ScopeId(0): [ScopeId(1), ScopeId(2)]
|
||||
rebuilt : ScopeId(0): []
|
||||
Unresolved references mismatch:
|
||||
after transform: ["intrinsic"]
|
||||
rebuilt : []
|
||||
|
||||
tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/types/intrinsic-keyword-babel-7/input.ts
|
||||
semantic error: Scope children mismatch:
|
||||
after transform: ScopeId(0): [ScopeId(1), ScopeId(2)]
|
||||
rebuilt : ScopeId(0): []
|
||||
Unresolved references mismatch:
|
||||
after transform: ["intrinsic"]
|
||||
rebuilt : []
|
||||
|
||||
tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/types/literal-string-2/input.ts
|
||||
semantic error: Unresolved references mismatch:
|
||||
|
|
|
|||
Loading…
Reference in a new issue