mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
Fix missing parsingContext restore at return in parseDelimitedList (#48999)
This commit is contained in:
parent
2ffe6864b1
commit
8d0393d227
@ -2745,6 +2745,7 @@ namespace ts {
|
||||
const startPos = scanner.getStartPos();
|
||||
const result = parseListElement(kind, parseElement);
|
||||
if (!result) {
|
||||
parsingContext = saveParsingContext;
|
||||
return undefined;
|
||||
}
|
||||
list.push(result as NonNullable<T>);
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
tests/cases/compiler/a.js(1,9): error TS1005: ')' expected.
|
||||
tests/cases/compiler/a.js(1,13): error TS1005: ';' expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.js (2 errors) ====
|
||||
( y = 1 ; 2 )
|
||||
~
|
||||
!!! error TS1005: ')' expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
|
||||
7
tests/baselines/reference/parserUnparsedTokenCrash1.js
Normal file
7
tests/baselines/reference/parserUnparsedTokenCrash1.js
Normal file
@ -0,0 +1,7 @@
|
||||
//// [a.js]
|
||||
( y = 1 ; 2 )
|
||||
|
||||
|
||||
//// [a.js]
|
||||
(y = 1);
|
||||
2;
|
||||
@ -0,0 +1,4 @@
|
||||
=== tests/cases/compiler/a.js ===
|
||||
( y = 1 ; 2 )
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
@ -0,0 +1,8 @@
|
||||
=== tests/cases/compiler/a.js ===
|
||||
( y = 1 ; 2 )
|
||||
>( y = 1 : 1
|
||||
>y = 1 : 1
|
||||
>y : any
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
tests/cases/compiler/parserUnparsedTokenCrash2.ts(1,10): error TS1109: Expression expected.
|
||||
tests/cases/compiler/parserUnparsedTokenCrash2.ts(1,12): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/compiler/parserUnparsedTokenCrash2.ts(1,16): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
|
||||
tests/cases/compiler/parserUnparsedTokenCrash2.ts(1,18): error TS2304: Cannot find name 'y'.
|
||||
tests/cases/compiler/parserUnparsedTokenCrash2.ts(1,22): error TS2304: Cannot find name 'z'.
|
||||
tests/cases/compiler/parserUnparsedTokenCrash2.ts(1,27): error TS1109: Expression expected.
|
||||
tests/cases/compiler/parserUnparsedTokenCrash2.ts(1,39): error TS1005: ';' expected.
|
||||
tests/cases/compiler/parserUnparsedTokenCrash2.ts(2,1): error TS1005: '}' expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/parserUnparsedTokenCrash2.ts (8 errors) ====
|
||||
export = } x = ( y = z ==== 'function') {
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'x'.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'y'.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'z'.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
|
||||
|
||||
!!! error TS1005: '}' expected.
|
||||
!!! related TS1007 tests/cases/compiler/parserUnparsedTokenCrash2.ts:1:41: The parser expected to find a '}' to match the '{' token here.
|
||||
10
tests/baselines/reference/parserUnparsedTokenCrash2.js
Normal file
10
tests/baselines/reference/parserUnparsedTokenCrash2.js
Normal file
@ -0,0 +1,10 @@
|
||||
//// [parserUnparsedTokenCrash2.ts]
|
||||
export = } x = ( y = z ==== 'function') {
|
||||
|
||||
|
||||
//// [parserUnparsedTokenCrash2.js]
|
||||
"use strict";
|
||||
x = (y = z === ) = 'function';
|
||||
{
|
||||
}
|
||||
module.exports = ;
|
||||
@ -0,0 +1,4 @@
|
||||
=== tests/cases/compiler/parserUnparsedTokenCrash2.ts ===
|
||||
export = } x = ( y = z ==== 'function') {
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
14
tests/baselines/reference/parserUnparsedTokenCrash2.types
Normal file
14
tests/baselines/reference/parserUnparsedTokenCrash2.types
Normal file
@ -0,0 +1,14 @@
|
||||
=== tests/cases/compiler/parserUnparsedTokenCrash2.ts ===
|
||||
export = } x = ( y = z ==== 'function') {
|
||||
> : any
|
||||
>x = ( y = z ==== 'function' : "function"
|
||||
>x : any
|
||||
>( y = z ==== 'function' : "function"
|
||||
>( y = z === : boolean
|
||||
>y = z === : boolean
|
||||
>y : any
|
||||
>z === : boolean
|
||||
>z : any
|
||||
> : any
|
||||
>'function' : "function"
|
||||
|
||||
4
tests/cases/compiler/parserUnparsedTokenCrash1.ts
Normal file
4
tests/cases/compiler/parserUnparsedTokenCrash1.ts
Normal file
@ -0,0 +1,4 @@
|
||||
// @allowJs: true
|
||||
// @outDir: ./out
|
||||
// @filename: a.js
|
||||
( y = 1 ; 2 )
|
||||
1
tests/cases/compiler/parserUnparsedTokenCrash2.ts
Normal file
1
tests/cases/compiler/parserUnparsedTokenCrash2.ts
Normal file
@ -0,0 +1 @@
|
||||
export = } x = ( y = z ==== 'function') {
|
||||
Loading…
x
Reference in New Issue
Block a user