|
|
|
@ -214,13 +214,12 @@ function update_reference(
|
|
|
|
const find_from_context = (node: Identifier) => {
|
|
|
|
const find_from_context = (node: Identifier) => {
|
|
|
|
for (let i = n; i < contexts.length; i++) {
|
|
|
|
for (let i = n; i < contexts.length; i++) {
|
|
|
|
const cur_context = contexts[i];
|
|
|
|
const cur_context = contexts[i];
|
|
|
|
if (cur_context.type === 'DestructuredVariable') {
|
|
|
|
if (cur_context.type !== 'DestructuredVariable') continue;
|
|
|
|
const { key } = cur_context;
|
|
|
|
const { key } = cur_context;
|
|
|
|
if (node.name === key.name) {
|
|
|
|
if (node.name === key.name) {
|
|
|
|
throw new Error(`Cannot access '${node.name}' before initialization`);
|
|
|
|
throw new Error(`Cannot access '${node.name}' before initialization`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return to_ctx(node.name);
|
|
|
|
return to_ctx(node.name);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|