|
|
|
@ -239,7 +239,7 @@ export default class Component {
|
|
|
|
|
const program: any = { type: 'Program', body: result.js };
|
|
|
|
|
|
|
|
|
|
walk(program, {
|
|
|
|
|
enter: (node, parent, key) => {
|
|
|
|
|
enter: (node: Node, parent: Node, key) => {
|
|
|
|
|
if (node.type === 'Identifier') {
|
|
|
|
|
if (node.name[0] === '@') {
|
|
|
|
|
if (node.name[1] === '_') {
|
|
|
|
@ -526,7 +526,7 @@ export default class Component {
|
|
|
|
|
if (!script) return;
|
|
|
|
|
|
|
|
|
|
walk(script.content, {
|
|
|
|
|
enter(node) {
|
|
|
|
|
enter(node: Node) {
|
|
|
|
|
if (node.type === 'LabeledStatement' && node.label.name === '$') {
|
|
|
|
|
component.warn(node as any, {
|
|
|
|
|
code: 'module-script-reactive-declaration',
|
|
|
|
@ -715,7 +715,7 @@ export default class Component {
|
|
|
|
|
let scope_updated = false;
|
|
|
|
|
|
|
|
|
|
walk(content, {
|
|
|
|
|
enter(node, parent, prop, index) {
|
|
|
|
|
enter(node: Node, parent, prop, index) {
|
|
|
|
|
if (map.has(node)) {
|
|
|
|
|
scope = map.get(node);
|
|
|
|
|
}
|
|
|
|
@ -741,7 +741,7 @@ export default class Component {
|
|
|
|
|
component.warn_on_undefined_store_value_references(node, parent, scope);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
leave(node) {
|
|
|
|
|
leave(node: Node) {
|
|
|
|
|
// do it on leave, to prevent infinite loop
|
|
|
|
|
if (component.compile_options.dev && component.compile_options.loopGuardTimeout > 0) {
|
|
|
|
|
const to_replace_for_loop_protect = component.loop_protect(node, scope, component.compile_options.loopGuardTimeout);
|
|
|
|
@ -785,7 +785,7 @@ export default class Component {
|
|
|
|
|
let scope = instance_scope;
|
|
|
|
|
|
|
|
|
|
walk(content, {
|
|
|
|
|
enter(node, parent) {
|
|
|
|
|
enter(node: Node, parent: Node) {
|
|
|
|
|
if (map.has(node)) {
|
|
|
|
|
scope = map.get(node);
|
|
|
|
|
}
|
|
|
|
@ -818,7 +818,7 @@ export default class Component {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
leave(node) {
|
|
|
|
|
leave(node: Node) {
|
|
|
|
|
if (map.has(node)) {
|
|
|
|
|
scope = scope.parent;
|
|
|
|
|
}
|
|
|
|
@ -886,7 +886,7 @@ export default class Component {
|
|
|
|
|
let scope = instance_scope;
|
|
|
|
|
|
|
|
|
|
walk(this.ast.instance.content, {
|
|
|
|
|
enter(node, parent, key, index) {
|
|
|
|
|
enter(node: Node, parent, key, index) {
|
|
|
|
|
if (/Function/.test(node.type)) {
|
|
|
|
|
return this.skip();
|
|
|
|
|
}
|
|
|
|
@ -963,7 +963,7 @@ export default class Component {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
leave(node, parent, _key, index) {
|
|
|
|
|
leave(node: Node, parent, _key, index) {
|
|
|
|
|
if (map.has(node)) {
|
|
|
|
|
scope = scope.parent;
|
|
|
|
|
}
|
|
|
|
@ -1064,7 +1064,7 @@ export default class Component {
|
|
|
|
|
walking.add(fn_declaration);
|
|
|
|
|
|
|
|
|
|
walk(fn_declaration, {
|
|
|
|
|
enter(node, parent) {
|
|
|
|
|
enter(node: Node, parent) {
|
|
|
|
|
if (!hoistable) return this.skip();
|
|
|
|
|
|
|
|
|
|
if (map.has(node)) {
|
|
|
|
@ -1112,7 +1112,7 @@ export default class Component {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
leave(node) {
|
|
|
|
|
leave(node: Node) {
|
|
|
|
|
if (map.has(node)) {
|
|
|
|
|
scope = scope.parent;
|
|
|
|
|
}
|
|
|
|
@ -1155,7 +1155,7 @@ export default class Component {
|
|
|
|
|
const map = this.instance_scope_map;
|
|
|
|
|
|
|
|
|
|
walk(node.body, {
|
|
|
|
|
enter(node, parent) {
|
|
|
|
|
enter(node: Node, parent) {
|
|
|
|
|
if (map.has(node)) {
|
|
|
|
|
scope = map.get(node);
|
|
|
|
|
}
|
|
|
|
@ -1195,7 +1195,7 @@ export default class Component {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
leave(node) {
|
|
|
|
|
leave(node: Node) {
|
|
|
|
|
if (map.has(node)) {
|
|
|
|
|
scope = scope.parent;
|
|
|
|
|
}
|
|
|
|
|