Skip to content

Commit 666c694

Browse files
committed
Resolve more ternary ambiguities
1 parent 537a7e5 commit 666c694

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

common/scanner.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ static bool scan_ternary_qmark(TSLexer *lexer) {
169169
advance(lexer);
170170

171171
if (lexer->lookahead == '?') return false;
172+
/* Optional chaining. */
173+
if (lexer->lookahead == '.') return false;
172174

173175
/* TypeScript optional arguments contain the ?: sequence, possibly
174176
with whitespace. */
@@ -177,6 +179,8 @@ static bool scan_ternary_qmark(TSLexer *lexer) {
177179
skip(lexer);
178180
}
179181
if (lexer->lookahead == ':') return false;
182+
if (lexer->lookahead == ')') return false;
183+
if (lexer->lookahead == ',') return false;
180184

181185
lexer->mark_end(lexer);
182186
lexer->result_symbol = TERNARY_QMARK;

script/known-failures.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
examples/redux/src/types/store.ts
22
examples/vscode/src/vs/platform/native/electron-main/nativeHostMainService.ts
3-
examples/vscode/src/vs/workbench/api/common/extHost.api.impl.ts
43
examples/vscode/src/vs/workbench/contrib/testing/browser/testingExplorerView.ts

0 commit comments

Comments
 (0)