Skip to content

Commit

Permalink
fix: enhance precompile blank for parser error workaround (#2173)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonlyu123 authored Oct 10, 2023
1 parent 582b76a commit 4424524
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/svelte2tsx/src/utils/htmlxparser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function blankPossiblyErrorOperatorOrPropertyAccess(htmlx: string) {
}
htmlx =
htmlx.substring(0, backwardIndex) + ' ' + htmlx.substring(backwardIndex + 1);
} else if (!/\s/.test(char)) {
} else if (!/\s/.test(char) && char !== ')' && char !== ']') {
break;
}
backwardIndex--;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "ParseError",
"code": "parse-error",
"start": {
"line": 1,
"column": 26,
"character": 26
},
"end": {
"line": 1,
"column": 26,
"character": 26
},
"pos": 26,
"frame": "1: {someRecord[anotherRecord.]}\n ^"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
someRecord[anotherRecord.];
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{someRecord[anotherRecord.]}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "ParseError",
"code": "parse-error",
"start": {
"line": 1,
"column": 16,
"character": 16
},
"end": {
"line": 1,
"column": 16,
"character": 16
},
"pos": 16,
"frame": "1: {console.log(''.)}\n ^\n2: \n3: {#await Promise.resolve(''.)}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
console.log(''.);

{

const $$_value = await (Promise.resolve(''.));{ const value = $$_value;

}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{console.log(''.)}

{#await Promise.resolve(''.)}

{:then value}

{/await}

0 comments on commit 4424524

Please sign in to comment.