fix: support es2022 class features (#8355)

Follow up to #8349. We also have to bump the parsing ECMAScript version here. Fixes #6900, fixes #6592.
pull/8371/head
Lyu, Wei-Da 2 years ago committed by GitHub
parent e2fe8ab469
commit 5c14bc5f01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,12 +3,12 @@ import * as code_red from 'code-red';
export const parse = (source: string): Node => code_red.parse(source, { export const parse = (source: string): Node => code_red.parse(source, {
sourceType: 'module', sourceType: 'module',
ecmaVersion: 12, ecmaVersion: 13,
locations: true locations: true
}); });
export const parse_expression_at = (source: string, index: number): Node => code_red.parseExpressionAt(source, index, { export const parse_expression_at = (source: string, index: number): Node => code_red.parseExpressionAt(source, index, {
sourceType: 'module', sourceType: 'module',
ecmaVersion: 12, ecmaVersion: 13,
locations: true locations: true
}); });

@ -0,0 +1,25 @@
/* generated by Svelte vX.Y.Z */
import { SvelteComponent, init, safe_not_equal } from "svelte/internal";
function instance($$self) {
class A {
p1;
p2 = 1;
#p3 = 2;
#getP3() {
return this.#p3;
}
}
return [];
}
class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, null, safe_not_equal, {});
}
}
export default Component;

@ -0,0 +1,12 @@
<script>
class A {
p1;
p2 = 1;
#p3 = 2;
#getP3() {
return this.#p3;
}
}
</script>
Loading…
Cancel
Save