diff --git a/src/compiler/compile/render_dom/index.ts b/src/compiler/compile/render_dom/index.ts index 504b5ffe05..66f2219ddf 100644 --- a/src/compiler/compile/render_dom/index.ts +++ b/src/compiler/compile/render_dom/index.ts @@ -81,10 +81,10 @@ export default function dom( ${$$props} => { ${uses_props && component.invalidate('$$props', `$$props = @assign(@assign({}, $$props), $$new_props)`)} ${writable_props.map(prop => - `if ('${prop.export_name}' in ${$$props}) ${component.invalidate(prop.name, `${prop.name} = ${$$props}.${prop.export_name}`)};` - )} + `if ('${prop.export_name}' in ${$$props}) ${component.invalidate(prop.name, `${prop.name} = ${$$props}.${prop.export_name}`)};` + )} ${component.slots.size > 0 && - `if ('$$scope' in ${$$props}) ${component.invalidate('$$scope', `$$scope = ${$$props}.$$scope`)};`} + `if ('$$scope' in ${$$props}) ${component.invalidate('$$scope', `$$scope = ${$$props}.$$scope`)};`} } ` : null; @@ -243,7 +243,11 @@ export default function dom( const filtered_declarations = component.vars .filter(v => ((v.referenced || v.export_name) && !v.hoistable)) - .map(v => v.name); + .map(v => + v.export_name && v.export_name !== v.name + ? ` ${v.export_name} : ${v.name}, ${v.name}` + : v.name + ); if (uses_props) filtered_declarations.push(`$$props: $$props = ${component.helper('exclude_internal_props')}($$props)`); diff --git a/test/runtime/samples/binding-with-inner-alias/_config.js b/test/runtime/samples/binding-with-inner-alias/_config.js new file mode 100644 index 0000000000..1f99eba40e --- /dev/null +++ b/test/runtime/samples/binding-with-inner-alias/_config.js @@ -0,0 +1,7 @@ +export default { + html: ` +
my name is john
+my color is blue
+bound name is john
+bound color is blue
`, +}; diff --git a/test/runtime/samples/binding-with-inner-alias/component.svelte b/test/runtime/samples/binding-with-inner-alias/component.svelte new file mode 100644 index 0000000000..c9d55f9b53 --- /dev/null +++ b/test/runtime/samples/binding-with-inner-alias/component.svelte @@ -0,0 +1,8 @@ + + +my name is {alias}
+my color is {color}
diff --git a/test/runtime/samples/binding-with-inner-alias/main.svelte b/test/runtime/samples/binding-with-inner-alias/main.svelte new file mode 100644 index 0000000000..1f10cccb1a --- /dev/null +++ b/test/runtime/samples/binding-with-inner-alias/main.svelte @@ -0,0 +1,10 @@ + + +bound name is {name}
+bound color is {color}