UNPKG

2.07 kBTypeScriptView Raw
1import type { CompilableTemplate } from '../template.js';
2import type { SymbolTable } from '../tier1/symbol-table.js';
3import type * as WireFormat from './wire-format/api.js';
4
5export type LabelOperandType = 1;
6export type IsStrictModeOperandType = 2;
7export type DebugSymbolsOperandType = 3;
8export type BlockOperandType = 4;
9export type StdLibOperandType = 5;
10export type NonSmallIntOperandType = 6;
11export type SymbolTableOperandType = 7;
12export type LayoutOperandType = 8;
13
14export type OperandType =
15 | LabelOperandType
16 | IsStrictModeOperandType
17 | DebugSymbolsOperandType
18 | BlockOperandType
19 | StdLibOperandType
20 | NonSmallIntOperandType
21 | SymbolTableOperandType
22 | LayoutOperandType;
23
24export interface LabelOperand {
25 type: LabelOperandType;
26 value: string;
27}
28
29export interface IsStrictModeOperand {
30 type: IsStrictModeOperandType;
31 value: undefined;
32}
33
34export interface DebugSymbolsOperand {
35 type: DebugSymbolsOperandType;
36 value: undefined;
37}
38
39export interface BlockOperand {
40 type: BlockOperandType;
41 value: WireFormat.SerializedInlineBlock | WireFormat.SerializedBlock;
42}
43
44export interface StdLibOperand {
45 type: StdLibOperandType;
46 value:
47 | 'main'
48 | 'trusting-append'
49 | 'cautious-append'
50 | 'trusting-non-dynamic-append'
51 | 'cautious-non-dynamic-append';
52}
53
54export interface NonSmallIntOperand {
55 type: NonSmallIntOperandType;
56 value: number;
57}
58
59export interface SymbolTableOperand {
60 type: SymbolTableOperandType;
61 value: SymbolTable;
62}
63
64export interface LayoutOperand {
65 type: LayoutOperandType;
66 value: CompilableTemplate;
67}
68
69export type HighLevelBuilderOperand =
70 | LabelOperand
71 | IsStrictModeOperand
72 | DebugSymbolsOperand
73 | StdLibOperand
74 | BlockOperand
75 | NonSmallIntOperand
76 | SymbolTableOperand
77 | LayoutOperand;
78
79export type SingleBuilderOperand =
80 | HighLevelBuilderOperand
81 | number
82 | string
83 | boolean
84 | undefined
85 | null
86 | number[]
87 | string[];
88
89export type Operand = number;
90
91export type EncoderOperands = [] | [Operand] | [Operand, Operand] | [Operand, Operand, Operand];