mirror of https://github.com/sveltejs/svelte
parent
eb599ce778
commit
4e43deb42a
@ -1,64 +1,82 @@
|
|||||||
import Node from './shared/Node';
|
import Node from './shared/Node.js';
|
||||||
import PendingBlock from './PendingBlock';
|
import PendingBlock from './PendingBlock.js';
|
||||||
import ThenBlock from './ThenBlock';
|
import ThenBlock from './ThenBlock.js';
|
||||||
import CatchBlock from './CatchBlock';
|
import CatchBlock from './CatchBlock.js';
|
||||||
import Expression from './shared/Expression';
|
import Expression from './shared/Expression.js';
|
||||||
import Component from '../Component';
|
import { unpack_destructuring } from './shared/Context.js';
|
||||||
import TemplateScope from './shared/TemplateScope';
|
|
||||||
import { TemplateNode } from '../../interfaces';
|
|
||||||
import { Context, unpack_destructuring } from './shared/Context';
|
|
||||||
import { Node as ESTreeNode } from 'estree';
|
|
||||||
|
|
||||||
|
/** @extends Node */
|
||||||
export default class AwaitBlock extends Node {
|
export default class AwaitBlock extends Node {
|
||||||
type: 'AwaitBlock';
|
|
||||||
expression: Expression;
|
/** @type {'AwaitBlock'} */
|
||||||
|
type;
|
||||||
then_contexts: Context[];
|
|
||||||
catch_contexts: Context[];
|
/** @type {import('./shared/Expression.js').default} */
|
||||||
|
expression;
|
||||||
then_node: ESTreeNode | null;
|
|
||||||
catch_node: ESTreeNode | null;
|
/** @type {import('./shared/Context.js').Context[]} */
|
||||||
|
then_contexts;
|
||||||
pending: PendingBlock;
|
|
||||||
then: ThenBlock;
|
/** @type {import('./shared/Context.js').Context[]} */
|
||||||
catch: CatchBlock;
|
catch_contexts;
|
||||||
|
|
||||||
context_rest_properties: Map<string, ESTreeNode> = new Map();
|
/** @type {ESTreeNode | null} */
|
||||||
|
then_node;
|
||||||
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode) {
|
|
||||||
super(component, parent, scope, info);
|
/** @type {ESTreeNode | null} */
|
||||||
this.cannot_use_innerhtml();
|
catch_node;
|
||||||
this.not_static_content();
|
|
||||||
|
/** @type {import('./PendingBlock.js').default} */
|
||||||
this.expression = new Expression(component, this, scope, info.expression);
|
pending;
|
||||||
|
|
||||||
this.then_node = info.value;
|
/** @type {import('./ThenBlock.js').default} */
|
||||||
this.catch_node = info.error;
|
then;
|
||||||
|
|
||||||
if (this.then_node) {
|
/** @type {import('./CatchBlock.js').default} */
|
||||||
this.then_contexts = [];
|
catch;
|
||||||
unpack_destructuring({
|
|
||||||
contexts: this.then_contexts,
|
/** @type {Map<string, ESTreeNode>} */
|
||||||
node: info.value,
|
context_rest_properties = new Map();
|
||||||
scope,
|
|
||||||
component,
|
/**
|
||||||
context_rest_properties: this.context_rest_properties
|
* @param {import('../Component.js').default} component *
|
||||||
});
|
* @param {import('./shared/Node.js').default} parent *
|
||||||
}
|
* @param {import('./shared/TemplateScope.js').default} scope *
|
||||||
|
* @param {import('../../interfaces.js').TemplateNode} info undefined
|
||||||
if (this.catch_node) {
|
*/
|
||||||
this.catch_contexts = [];
|
constructor(component, parent, scope, info) {
|
||||||
unpack_destructuring({
|
super(component, parent, scope, info);
|
||||||
contexts: this.catch_contexts,
|
this.cannot_use_innerhtml();
|
||||||
node: info.error,
|
this.not_static_content();
|
||||||
scope,
|
this.expression = new Expression(component, this, scope, info.expression);
|
||||||
component,
|
this.then_node = info.value;
|
||||||
context_rest_properties: this.context_rest_properties
|
this.catch_node = info.error;
|
||||||
});
|
if (this.then_node) {
|
||||||
}
|
this.then_contexts = [];
|
||||||
|
unpack_destructuring({
|
||||||
this.pending = new PendingBlock(component, this, scope, info.pending);
|
contexts: this.then_contexts,
|
||||||
this.then = new ThenBlock(component, this, scope, info.then);
|
node: info.value,
|
||||||
this.catch = new CatchBlock(component, this, scope, info.catch);
|
scope,
|
||||||
}
|
component,
|
||||||
|
context_rest_properties: this.context_rest_properties
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (this.catch_node) {
|
||||||
|
this.catch_contexts = [];
|
||||||
|
unpack_destructuring({
|
||||||
|
contexts: this.catch_contexts,
|
||||||
|
node: info.error,
|
||||||
|
scope,
|
||||||
|
component,
|
||||||
|
context_rest_properties: this.context_rest_properties
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.pending = new PendingBlock(component, this, scope, info.pending);
|
||||||
|
this.then = new ThenBlock(component, this, scope, info.then);
|
||||||
|
this.catch = new CatchBlock(component, this, scope, info.catch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in new issue