You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/src/compiler/compile/nodes/Action.ts

25 lines
662 B

import Node from './shared/Node';
import Expression from './shared/Expression';
import Component from '../Component';
export default class Action extends Node {
type: 'Action';
name: string;
expression: Expression;
uses_context: boolean;
constructor(component: Component, parent, scope, info) {
super(component, parent, scope, info);
component.warn_if_undefined(info.name, info, scope);
this.name = info.name;
component.add_reference(info.name.split('.')[0]);
this.expression = info.expression
? new Expression(component, this, scope, info.expression)
: null;
this.uses_context = this.expression && this.expression.uses_context;
}
}