fix shadowing

pull/3945/head
Rich Harris 6 years ago
parent 904ca7d0b5
commit 3cd8f35e1a

@ -167,15 +167,23 @@ export default class Renderer {
const variable = this.component.var_lookup.get(head); const variable = this.component.var_lookup.get(head);
// TODO this feels woolly. might encounter false positive // // TODO this feels woolly. might encounter false positive
// if each context shadows top-level var // // if each context shadows top-level var
// if (variable) {
// this.component.add_reference(name); // TODO we can probably remove most other occurrences of this
// if (!variable.hoistable) {
// head = x`#ctx[${i}]`;
// }
// } else if (i !== undefined) {
// head = x`#ctx[${i}]`;
// }
if (variable) { if (variable) {
this.component.add_reference(name); // TODO we can probably remove most other occurrences of this this.component.add_reference(name); // TODO we can probably remove most other occurrences of this
if (!variable.hoistable) {
head = x`#ctx[${i}]`;
} }
} else if (i !== undefined) {
if (i !== undefined) {
head = x`#ctx[${i}]`; head = x`#ctx[${i}]`;
} }

@ -1,3 +1,3 @@
export default { export default {
html: '(alpaca)(baboon)(capybara)' html: '(alpaca)(baboon)(capybara) (lemur)'
}; };

@ -2,6 +2,8 @@
({animal}) ({animal})
{/each} {/each}
({animal})
<script> <script>
let animal = 'lemur'; let animal = 'lemur';
let animals = ['alpaca', 'baboon', 'capybara']; let animals = ['alpaca', 'baboon', 'capybara'];

Loading…
Cancel
Save