Skip to content

Commit

Permalink
Fix broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
BillyLevin committed Aug 7, 2021
1 parent cf36c99 commit 2a4076e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/compiler/compile/nodes/shared/Expression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default class Expression {

// discover dependencies, but don't change the code yet
walk(info, {
enter(node: Node, parent: any, key: string) {
enter(node: any, parent: any, key: string) {
// don't manipulate shorthand props twice
if (key === 'key' && parent.shorthand) return;
// don't manipulate `import.meta`, `new.target`
Expand Down Expand Up @@ -162,13 +162,13 @@ export default class Expression {

if (declaration) {
if (declaration.kind === 'const' && !deep) {
component.error(node as any, {
component.error(node, {
code: 'assignment-to-const',
message: 'You are assigning to a const'
});
}
} else if (variable && variable.writable === false && !deep) {
component.error(node as any, {
component.error(node, {
code: 'assignment-to-const',
message: 'You are assigning to a const'
});
Expand Down
2 changes: 1 addition & 1 deletion test/js/samples/unchanged-expression/expected.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ let world1 = 'world';
let world2 = 'world';

function instance($$self, $$props, $$invalidate) {
const world3 = 'world';
let world3 = 'world';

function foo() {
$$invalidate(0, world3 = 'svelte');
Expand Down
2 changes: 1 addition & 1 deletion test/js/samples/unchanged-expression/input.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
let world1 = 'world';
let world2 = 'world';
const world3 = 'world';
let world3 = 'world';
function foo() {
world3 = 'svelte';
}
Expand Down

0 comments on commit 2a4076e

Please sign in to comment.