|
import Node from './shared/Node.js'; |
|
import PendingBlock from './PendingBlock.js'; |
|
import ThenBlock from './ThenBlock.js'; |
|
import CatchBlock from './CatchBlock.js'; |
|
import Expression from './shared/Expression.js'; |
|
import { unpack_destructuring } from './shared/Context.js'; |
|
|
|
|
|
export default class AwaitBlock extends Node { |
|
|
|
expression; |
|
|
|
|
|
then_contexts; |
|
|
|
|
|
catch_contexts; |
|
|
|
|
|
then_node; |
|
|
|
|
|
catch_node; |
|
|
|
|
|
pending; |
|
|
|
|
|
then; |
|
|
|
|
|
catch; |
|
|
|
|
|
context_rest_properties = new Map(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor(component, parent, scope, info) { |
|
super(component, parent, scope, info); |
|
this.cannot_use_innerhtml(); |
|
this.not_static_content(); |
|
this.expression = new Expression(component, this, scope, info.expression); |
|
this.then_node = info.value; |
|
this.catch_node = info.error; |
|
if (this.then_node) { |
|
this.then_contexts = []; |
|
unpack_destructuring({ |
|
contexts: this.then_contexts, |
|
node: info.value, |
|
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); |
|
} |
|
} |
|
|