Skip to content

Commit

Permalink
Merge pull request #2351 from jches/gh/2347
Browse files Browse the repository at this point in the history
Don't hoist non-renamed exports
  • Loading branch information
Rich-Harris authored Apr 6, 2019
2 parents 1f52938 + cfc1a40 commit c20ad22
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/compile/Component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ export default class Component {

const v = this.var_lookup.get(d.id.name)
if (v.reassigned) return false
if (v.export_name && v.export_name !== v.name) return false
if (v.export_name) return false

if (this.var_lookup.get(d.id.name).reassigned) return false;
if (this.vars.find(variable => variable.name === d.id.name && variable.module)) return false;
Expand Down
1 change: 1 addition & 0 deletions test/runtime/samples/prop-exports/_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default {
v2=4
vi1=4
$vs1=1
vl0=hello
vl1=test
$s3=29
loop...
Expand Down
5 changes: 5 additions & 0 deletions test/runtime/samples/prop-exports/main.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
let vs1 = v1
export { vs1 as a4 }
// literal initializer
let vl0 = 'hello'
export { vl0 }
// aliased with literal initializer
let vl1 = 'test'
export { vl1 as a5 }
Expand All @@ -41,6 +45,7 @@ $v1={$v1}
v2={v2}
vi1={vi1}
$vs1={$vs1}
vl0={vl0}
vl1={vl1}
$s3={$s3}
{k1}{k2}

0 comments on commit c20ad22

Please sign in to comment.