|
|
@ -428,6 +428,13 @@ export default class Component {
|
|
|
|
imports.push(node);
|
|
|
|
imports.push(node);
|
|
|
|
|
|
|
|
|
|
|
|
node.specifiers.forEach((specifier: Node) => {
|
|
|
|
node.specifiers.forEach((specifier: Node) => {
|
|
|
|
|
|
|
|
if (specifier.local.name[0] === '$') {
|
|
|
|
|
|
|
|
this.error(specifier.local, {
|
|
|
|
|
|
|
|
code: 'illegal-declaration',
|
|
|
|
|
|
|
|
message: `The $ prefix is reserved, and cannot be used for variable and import names`
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.userVars.add(specifier.local.name);
|
|
|
|
this.userVars.add(specifier.local.name);
|
|
|
|
this.imported_declarations.add(specifier.local.name);
|
|
|
|
this.imported_declarations.add(specifier.local.name);
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -481,7 +488,14 @@ export default class Component {
|
|
|
|
let { scope } = createScopes(script.content);
|
|
|
|
let { scope } = createScopes(script.content);
|
|
|
|
this.module_scope = scope;
|
|
|
|
this.module_scope = scope;
|
|
|
|
|
|
|
|
|
|
|
|
// TODO unindent
|
|
|
|
scope.declarations.forEach((node, name) => {
|
|
|
|
|
|
|
|
if (name[0] === '$') {
|
|
|
|
|
|
|
|
this.error(node, {
|
|
|
|
|
|
|
|
code: 'illegal-declaration',
|
|
|
|
|
|
|
|
message: `The $ prefix is reserved, and cannot be used for variable and import names`
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.extract_imports_and_exports(script.content, this.imports, this.module_exports);
|
|
|
|
this.extract_imports_and_exports(script.content, this.imports, this.module_exports);
|
|
|
|
remove_indentation(this.code, script.content);
|
|
|
|
remove_indentation(this.code, script.content);
|
|
|
@ -498,6 +512,15 @@ export default class Component {
|
|
|
|
this.instance_scope = instance_scope;
|
|
|
|
this.instance_scope = instance_scope;
|
|
|
|
this.instance_scope_map = map;
|
|
|
|
this.instance_scope_map = map;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
instance_scope.declarations.forEach((node, name) => {
|
|
|
|
|
|
|
|
if (name[0] === '$') {
|
|
|
|
|
|
|
|
this.error(node, {
|
|
|
|
|
|
|
|
code: 'illegal-declaration',
|
|
|
|
|
|
|
|
message: `The $ prefix is reserved, and cannot be used for variable and import names`
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
instance_scope.declarations.forEach((node, name) => {
|
|
|
|
instance_scope.declarations.forEach((node, name) => {
|
|
|
|
this.userVars.add(name);
|
|
|
|
this.userVars.add(name);
|
|
|
|
this.declarations.push(name);
|
|
|
|
this.declarations.push(name);
|
|
|
|