brighterscript 1.0.0-alpha.25 → 1.0.0-alpha.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/bsconfig.schema.json +5 -0
  3. package/dist/AstValidationSegmenter.d.ts +1 -1
  4. package/dist/AstValidationSegmenter.js +6 -7
  5. package/dist/AstValidationSegmenter.js.map +1 -1
  6. package/dist/BsConfig.d.ts +1 -0
  7. package/dist/DiagnosticMessages.d.ts +1 -3
  8. package/dist/DiagnosticMessages.js +5 -8
  9. package/dist/DiagnosticMessages.js.map +1 -1
  10. package/dist/Program.d.ts +1 -1
  11. package/dist/Program.js +40 -42
  12. package/dist/Program.js.map +1 -1
  13. package/dist/Scope.d.ts +2 -13
  14. package/dist/Scope.js +27 -35
  15. package/dist/Scope.js.map +1 -1
  16. package/dist/SymbolTable.d.ts +1 -8
  17. package/dist/SymbolTable.js +1 -10
  18. package/dist/SymbolTable.js.map +1 -1
  19. package/dist/SymbolTableFlag.d.ts +8 -0
  20. package/dist/SymbolTableFlag.js +13 -0
  21. package/dist/SymbolTableFlag.js.map +1 -0
  22. package/dist/XmlScope.d.ts +1 -6
  23. package/dist/XmlScope.js +6 -25
  24. package/dist/XmlScope.js.map +1 -1
  25. package/dist/astUtils/CachedLookups.d.ts +1 -2
  26. package/dist/astUtils/CachedLookups.js +3 -14
  27. package/dist/astUtils/CachedLookups.js.map +1 -1
  28. package/dist/astUtils/Editor.spec.js +1 -1
  29. package/dist/astUtils/Editor.spec.js.map +1 -1
  30. package/dist/astUtils/creators.js +77 -18
  31. package/dist/astUtils/creators.js.map +1 -1
  32. package/dist/astUtils/creators.spec.js +4 -4
  33. package/dist/astUtils/creators.spec.js.map +1 -1
  34. package/dist/astUtils/reflection.d.ts +3 -1
  35. package/dist/astUtils/reflection.js +12 -4
  36. package/dist/astUtils/reflection.js.map +1 -1
  37. package/dist/astUtils/reflection.spec.js +59 -42
  38. package/dist/astUtils/reflection.spec.js.map +1 -1
  39. package/dist/astUtils/visitors.spec.js +30 -19
  40. package/dist/astUtils/visitors.spec.js.map +1 -1
  41. package/dist/bscPlugin/BscPlugin.d.ts +2 -1
  42. package/dist/bscPlugin/BscPlugin.js +7 -3
  43. package/dist/bscPlugin/BscPlugin.js.map +1 -1
  44. package/dist/bscPlugin/CallExpressionInfo.js +7 -7
  45. package/dist/bscPlugin/CallExpressionInfo.js.map +1 -1
  46. package/dist/bscPlugin/SignatureHelpUtil.js +5 -4
  47. package/dist/bscPlugin/SignatureHelpUtil.js.map +1 -1
  48. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +2 -2
  49. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
  50. package/dist/bscPlugin/completions/CompletionsProcessor.js +23 -23
  51. package/dist/bscPlugin/completions/CompletionsProcessor.js.map +1 -1
  52. package/dist/bscPlugin/definition/DefinitionProvider.d.ts +13 -0
  53. package/dist/bscPlugin/definition/DefinitionProvider.js +210 -0
  54. package/dist/bscPlugin/definition/DefinitionProvider.js.map +1 -0
  55. package/dist/bscPlugin/definition/DefinitionProvider.spec.d.ts +1 -0
  56. package/dist/bscPlugin/definition/DefinitionProvider.spec.js +88 -0
  57. package/dist/bscPlugin/definition/DefinitionProvider.spec.js.map +1 -0
  58. package/dist/bscPlugin/hover/HoverProcessor.d.ts +1 -0
  59. package/dist/bscPlugin/hover/HoverProcessor.js +28 -8
  60. package/dist/bscPlugin/hover/HoverProcessor.js.map +1 -1
  61. package/dist/bscPlugin/hover/HoverProcessor.spec.js +74 -2
  62. package/dist/bscPlugin/hover/HoverProcessor.spec.js.map +1 -1
  63. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +2 -5
  64. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -1
  65. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js +8 -6
  66. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js.map +1 -1
  67. package/dist/bscPlugin/validation/BrsFileValidator.js +46 -47
  68. package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -1
  69. package/dist/bscPlugin/validation/ScopeValidator.d.ts +10 -0
  70. package/dist/bscPlugin/validation/ScopeValidator.js +120 -39
  71. package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -1
  72. package/dist/bscPlugin/validation/ScopeValidator.spec.js +165 -10
  73. package/dist/bscPlugin/validation/ScopeValidator.spec.js.map +1 -1
  74. package/dist/diagnosticUtils.d.ts +1 -1
  75. package/dist/files/BrsFile.Class.spec.js +7 -6
  76. package/dist/files/BrsFile.Class.spec.js.map +1 -1
  77. package/dist/files/BrsFile.d.ts +7 -15
  78. package/dist/files/BrsFile.js +49 -309
  79. package/dist/files/BrsFile.js.map +1 -1
  80. package/dist/files/BrsFile.spec.js +111 -157
  81. package/dist/files/BrsFile.spec.js.map +1 -1
  82. package/dist/files/XmlFile.d.ts +2 -3
  83. package/dist/files/XmlFile.js +0 -2
  84. package/dist/files/XmlFile.js.map +1 -1
  85. package/dist/interfaces.d.ts +109 -84
  86. package/dist/interfaces.js +9 -9
  87. package/dist/interfaces.js.map +1 -1
  88. package/dist/parser/AstNode.spec.js +6 -6
  89. package/dist/parser/AstNode.spec.js.map +1 -1
  90. package/dist/parser/Expression.d.ts +301 -164
  91. package/dist/parser/Expression.js +355 -294
  92. package/dist/parser/Expression.js.map +1 -1
  93. package/dist/parser/Parser.Class.spec.js +26 -27
  94. package/dist/parser/Parser.Class.spec.js.map +1 -1
  95. package/dist/parser/Parser.d.ts +6 -2
  96. package/dist/parser/Parser.js +361 -160
  97. package/dist/parser/Parser.js.map +1 -1
  98. package/dist/parser/Parser.spec.js +69 -213
  99. package/dist/parser/Parser.spec.js.map +1 -1
  100. package/dist/parser/SGParser.js +49 -35
  101. package/dist/parser/SGParser.js.map +1 -1
  102. package/dist/parser/SGTypes.d.ts +36 -24
  103. package/dist/parser/SGTypes.js +26 -55
  104. package/dist/parser/SGTypes.js.map +1 -1
  105. package/dist/parser/Statement.d.ts +381 -238
  106. package/dist/parser/Statement.js +510 -386
  107. package/dist/parser/Statement.js.map +1 -1
  108. package/dist/parser/Statement.spec.js +2 -2
  109. package/dist/parser/Statement.spec.js.map +1 -1
  110. package/dist/parser/tests/controlFlow/For.spec.js +1 -1
  111. package/dist/parser/tests/controlFlow/For.spec.js.map +1 -1
  112. package/dist/parser/tests/controlFlow/ForEach.spec.js +2 -2
  113. package/dist/parser/tests/controlFlow/ForEach.spec.js.map +1 -1
  114. package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js +1 -1
  115. package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js.map +1 -1
  116. package/dist/parser/tests/expression/Call.spec.js +11 -11
  117. package/dist/parser/tests/expression/Call.spec.js.map +1 -1
  118. package/dist/parser/tests/expression/Indexing.spec.js +30 -5
  119. package/dist/parser/tests/expression/Indexing.spec.js.map +1 -1
  120. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +2 -2
  121. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +1 -1
  122. package/dist/parser/tests/expression/TernaryExpression.spec.js +2 -2
  123. package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
  124. package/dist/parser/tests/expression/TypeExpression.spec.js +8 -9
  125. package/dist/parser/tests/expression/TypeExpression.spec.js.map +1 -1
  126. package/dist/parser/tests/statement/ConstStatement.spec.js +1 -1
  127. package/dist/parser/tests/statement/ConstStatement.spec.js.map +1 -1
  128. package/dist/parser/tests/statement/Dim.spec.js +8 -8
  129. package/dist/parser/tests/statement/Dim.spec.js.map +1 -1
  130. package/dist/parser/tests/statement/Enum.spec.js +2 -2
  131. package/dist/parser/tests/statement/Enum.spec.js.map +1 -1
  132. package/dist/parser/tests/statement/LibraryStatement.spec.js +2 -2
  133. package/dist/parser/tests/statement/LibraryStatement.spec.js.map +1 -1
  134. package/dist/parser/tests/statement/Misc.spec.js +2 -2
  135. package/dist/parser/tests/statement/Misc.spec.js.map +1 -1
  136. package/dist/parser/tests/statement/PrintStatement.spec.js +1 -1
  137. package/dist/parser/tests/statement/TryCatch.spec.js +10 -3
  138. package/dist/parser/tests/statement/TryCatch.spec.js.map +1 -1
  139. package/dist/roku-types/data.json +70 -52
  140. package/dist/roku-types/index.d.ts +43 -21
  141. package/dist/types/ArrayType.js +1 -2
  142. package/dist/types/ArrayType.js.map +1 -1
  143. package/dist/types/ArrayType.spec.js +7 -8
  144. package/dist/types/ArrayType.spec.js.map +1 -1
  145. package/dist/types/AssociativeArrayType.js +2 -3
  146. package/dist/types/AssociativeArrayType.js.map +1 -1
  147. package/dist/types/BscType.d.ts +1 -1
  148. package/dist/types/BscType.js +2 -3
  149. package/dist/types/BscType.js.map +1 -1
  150. package/dist/types/BuiltInInterfaceAdder.js +15 -9
  151. package/dist/types/BuiltInInterfaceAdder.js.map +1 -1
  152. package/dist/types/BuiltInInterfaceAdder.spec.js +31 -32
  153. package/dist/types/BuiltInInterfaceAdder.spec.js.map +1 -1
  154. package/dist/types/ClassType.spec.js +10 -11
  155. package/dist/types/ClassType.spec.js.map +1 -1
  156. package/dist/types/ComponentType.d.ts +2 -1
  157. package/dist/types/ComponentType.js.map +1 -1
  158. package/dist/types/EnumType.js +2 -3
  159. package/dist/types/EnumType.js.map +1 -1
  160. package/dist/types/InheritableType.js +3 -4
  161. package/dist/types/InheritableType.js.map +1 -1
  162. package/dist/types/InterfaceType.js +2 -3
  163. package/dist/types/InterfaceType.js.map +1 -1
  164. package/dist/types/InterfaceType.spec.js +3 -4
  165. package/dist/types/InterfaceType.spec.js.map +1 -1
  166. package/dist/types/ObjectType.js +1 -2
  167. package/dist/types/ObjectType.js.map +1 -1
  168. package/dist/types/ReferenceType.d.ts +1 -1
  169. package/dist/types/ReferenceType.spec.js +21 -22
  170. package/dist/types/ReferenceType.spec.js.map +1 -1
  171. package/dist/types/UnionType.js +3 -3
  172. package/dist/types/UnionType.js.map +1 -1
  173. package/dist/types/UnionType.spec.js +37 -38
  174. package/dist/types/UnionType.spec.js.map +1 -1
  175. package/dist/types/helper.spec.js +4 -5
  176. package/dist/types/helper.spec.js.map +1 -1
  177. package/dist/util.d.ts +16 -7
  178. package/dist/util.js +89 -43
  179. package/dist/util.js.map +1 -1
  180. package/dist/validators/ClassValidator.d.ts +0 -9
  181. package/dist/validators/ClassValidator.js +9 -52
  182. package/dist/validators/ClassValidator.js.map +1 -1
  183. package/package.json +1 -1
@@ -5,20 +5,26 @@ import type { BrsTranspileState } from './BrsTranspileState';
5
5
  import { ParseMode } from './Parser';
6
6
  import type { WalkOptions, WalkVisitor } from '../astUtils/visitors';
7
7
  import type { GetTypeOptions, TranspileResult, TypedefProvider } from '../interfaces';
8
+ import { VoidType } from '../types/VoidType';
9
+ import { DynamicType } from '../types/DynamicType';
8
10
  import type { BscType } from '../types/BscType';
9
11
  import { TypedFunctionType } from '../types/TypedFunctionType';
10
12
  import { AstNodeKind, Expression } from './AstNode';
11
13
  import { SourceNode } from 'source-map';
12
14
  import type { TranspileState } from './TranspileState';
13
15
  import { StringType } from '../types/StringType';
14
- import { DynamicType } from '../types/DynamicType';
15
- import { VoidType } from '../types/VoidType';
16
16
  export declare type ExpressionVisitor = (expression: Expression, parent: Expression) => void;
17
17
  export declare class BinaryExpression extends Expression {
18
- left: Expression;
19
- operator: Token;
20
- right: Expression;
21
- constructor(left: Expression, operator: Token, right: Expression);
18
+ constructor(options: {
19
+ left: Expression;
20
+ operator: Token;
21
+ right: Expression;
22
+ });
23
+ readonly tokens: {
24
+ readonly operator: Token;
25
+ };
26
+ readonly left: Expression;
27
+ readonly right: Expression;
22
28
  readonly kind = AstNodeKind.BinaryExpression;
23
29
  readonly range: Range;
24
30
  transpile(state: BrsTranspileState): (string | SourceNode)[];
@@ -26,19 +32,22 @@ export declare class BinaryExpression extends Expression {
26
32
  getType(options: GetTypeOptions): BscType;
27
33
  }
28
34
  export declare class CallExpression extends Expression {
35
+ static MaximumArguments: number;
36
+ constructor(options: {
37
+ callee: Expression;
38
+ openingParen: Token;
39
+ args?: Expression[];
40
+ closingParen: Token;
41
+ });
29
42
  readonly callee: Expression;
30
- /**
31
- * Can either be `(`, or `?(` for optional chaining
32
- */
33
- readonly openingParen: Token;
34
- readonly closingParen: Token;
35
43
  readonly args: Expression[];
36
- static MaximumArguments: number;
37
- constructor(callee: Expression,
38
- /**
39
- * Can either be `(`, or `?(` for optional chaining
40
- */
41
- openingParen: Token, closingParen: Token, args: Expression[], unused?: any);
44
+ readonly tokens: {
45
+ /**
46
+ * Can either be `(`, or `?(` for optional chaining - defaults to '('
47
+ */
48
+ readonly openingParen?: Token;
49
+ readonly closingParen?: Token;
50
+ };
42
51
  readonly kind = AstNodeKind.CallExpression;
43
52
  readonly range: Range;
44
53
  transpile(state: BrsTranspileState, nameOverride?: string): (string | SourceNode)[];
@@ -46,21 +55,27 @@ export declare class CallExpression extends Expression {
46
55
  getType(options: GetTypeOptions): any;
47
56
  }
48
57
  export declare class FunctionExpression extends Expression implements TypedefProvider {
49
- readonly parameters: FunctionParameterExpression[];
50
- body: Block;
51
- readonly functionType: Token | null;
52
- end: Token;
53
- readonly leftParen: Token;
54
- readonly rightParen: Token;
55
- readonly asToken?: Token;
56
- returnTypeExpression?: TypeExpression;
57
- constructor(parameters: FunctionParameterExpression[], body: Block, functionType: Token | null, end: Token, leftParen: Token, rightParen: Token, asToken?: Token, returnTypeExpression?: TypeExpression);
58
+ constructor(options: {
59
+ functionType?: Token;
60
+ leftParen?: Token;
61
+ parameters?: FunctionParameterExpression[];
62
+ rightParen?: Token;
63
+ as?: Token;
64
+ returnTypeExpression?: TypeExpression;
65
+ body: Block;
66
+ endFunctionType?: Token;
67
+ });
58
68
  readonly kind = AstNodeKind.FunctionExpression;
59
- /**
60
- * The list of function calls that are declared within this function scope. This excludes CallExpressions
61
- * declared in child functions
62
- */
63
- callExpressions: CallExpression[];
69
+ readonly parameters: FunctionParameterExpression[];
70
+ readonly body: Block;
71
+ readonly returnTypeExpression?: TypeExpression;
72
+ readonly tokens: {
73
+ readonly functionType?: Token;
74
+ readonly endFunctionType?: Token;
75
+ readonly leftParen?: Token;
76
+ readonly rightParen?: Token;
77
+ readonly as?: Token;
78
+ };
64
79
  /**
65
80
  * If this function is part of a FunctionStatement, this will be set. Otherwise this will be undefined
66
81
  */
@@ -77,13 +92,21 @@ export declare class FunctionExpression extends Expression implements TypedefPro
77
92
  getType(options: GetTypeOptions): TypedFunctionType;
78
93
  }
79
94
  export declare class FunctionParameterExpression extends Expression {
80
- name: Identifier;
81
- equalToken?: Token;
82
- defaultValue?: Expression;
83
- asToken?: Token;
84
- typeExpression?: TypeExpression;
85
- constructor(name: Identifier, equalToken?: Token, defaultValue?: Expression, asToken?: Token, typeExpression?: TypeExpression);
95
+ constructor(options: {
96
+ name: Identifier;
97
+ equals?: Token;
98
+ defaultValue?: Expression;
99
+ as?: Token;
100
+ typeExpression?: TypeExpression;
101
+ });
86
102
  readonly kind = AstNodeKind.FunctionParameterExpression;
103
+ readonly tokens: {
104
+ readonly name: Identifier;
105
+ readonly equals?: Token;
106
+ readonly as?: Token;
107
+ };
108
+ readonly defaultValue?: Expression;
109
+ readonly typeExpression?: TypeExpression;
87
110
  getType(options: GetTypeOptions): BscType;
88
111
  get range(): Range;
89
112
  transpile(state: BrsTranspileState): any[];
@@ -91,17 +114,19 @@ export declare class FunctionParameterExpression extends Expression {
91
114
  walk(visitor: WalkVisitor, options: WalkOptions): void;
92
115
  }
93
116
  export declare class DottedGetExpression extends Expression {
117
+ constructor(options: {
118
+ obj: Expression;
119
+ name: Identifier;
120
+ /**
121
+ * Can either be `.`, or `?.` for optional chaining - defaults in transpile to '.'
122
+ */
123
+ dot?: Token;
124
+ });
125
+ readonly tokens: {
126
+ readonly name: Identifier;
127
+ readonly dot?: Token;
128
+ };
94
129
  readonly obj: Expression;
95
- readonly name: Identifier;
96
- /**
97
- * Can either be `.`, or `?.` for optional chaining
98
- */
99
- readonly dot: Token;
100
- constructor(obj: Expression, name: Identifier,
101
- /**
102
- * Can either be `.`, or `?.` for optional chaining
103
- */
104
- dot: Token);
105
130
  readonly kind = AstNodeKind.DottedGetExpression;
106
131
  readonly range: Range;
107
132
  transpile(state: BrsTranspileState): (string | SourceNode)[];
@@ -110,52 +135,62 @@ export declare class DottedGetExpression extends Expression {
110
135
  getName(parseMode: ParseMode): string;
111
136
  }
112
137
  export declare class XmlAttributeGetExpression extends Expression {
113
- readonly obj: Expression;
114
- readonly name: Identifier;
115
- /**
116
- * Can either be `@`, or `?@` for optional chaining
117
- */
118
- readonly at: Token;
119
- constructor(obj: Expression, name: Identifier,
120
- /**
121
- * Can either be `@`, or `?@` for optional chaining
122
- */
123
- at: Token);
138
+ constructor(options: {
139
+ obj: Expression;
140
+ /**
141
+ * Can either be `@`, or `?@` for optional chaining - defaults to '@'
142
+ */
143
+ at?: Token;
144
+ name: Identifier;
145
+ });
124
146
  readonly kind = AstNodeKind.XmlAttributeGetExpression;
147
+ readonly tokens: {
148
+ name: Identifier;
149
+ at?: Token;
150
+ };
151
+ readonly obj: Expression;
125
152
  readonly range: Range;
126
153
  transpile(state: BrsTranspileState): (string | SourceNode)[];
127
154
  walk(visitor: WalkVisitor, options: WalkOptions): void;
128
155
  }
129
156
  export declare class IndexedGetExpression extends Expression {
130
- obj: Expression;
131
- index: Expression;
132
- /**
133
- * Can either be `[` or `?[`. If `?.[` is used, this will be `[` and `optionalChainingToken` will be `?.`
134
- */
135
- openingSquare: Token;
136
- closingSquare: Token;
137
- questionDotToken?: Token;
138
- constructor(obj: Expression, index: Expression,
139
- /**
140
- * Can either be `[` or `?[`. If `?.[` is used, this will be `[` and `optionalChainingToken` will be `?.`
141
- */
142
- openingSquare: Token, closingSquare: Token, questionDotToken?: Token);
157
+ constructor(options: {
158
+ obj: Expression;
159
+ indexes: Expression[];
160
+ /**
161
+ * Can either be `[` or `?[`. If `?.[` is used, this will be `[` and `optionalChainingToken` will be `?.` - defaults to '[' in transpile
162
+ */
163
+ openingSquare?: Token;
164
+ closingSquare?: Token;
165
+ questionDot?: Token;
166
+ });
143
167
  readonly kind = AstNodeKind.IndexedGetExpression;
168
+ readonly obj: Expression;
169
+ readonly indexes: Expression[];
170
+ readonly tokens: {
171
+ /**
172
+ * Can either be `[` or `?[`. If `?.[` is used, this will be `[` and `optionalChainingToken` will be `?.` - defaults to '[' in transpile
173
+ */
174
+ readonly openingSquare?: Token;
175
+ readonly closingSquare?: Token;
176
+ readonly questionDot?: Token;
177
+ };
144
178
  readonly range: Range;
145
- transpile(state: BrsTranspileState): (string | SourceNode)[];
179
+ transpile(state: BrsTranspileState): any[];
146
180
  walk(visitor: WalkVisitor, options: WalkOptions): void;
147
181
  getType(options: GetTypeOptions): BscType;
148
182
  }
149
183
  export declare class GroupingExpression extends Expression {
184
+ constructor(options: {
185
+ leftParen?: Token;
186
+ rightParen?: Token;
187
+ expression: Expression;
188
+ });
150
189
  readonly tokens: {
151
- left: Token;
152
- right: Token;
190
+ readonly leftParen?: Token;
191
+ readonly rightParen?: Token;
153
192
  };
154
- expression: Expression;
155
- constructor(tokens: {
156
- left: Token;
157
- right: Token;
158
- }, expression: Expression);
193
+ readonly expression: Expression;
159
194
  readonly kind = AstNodeKind.GroupingExpression;
160
195
  readonly range: Range;
161
196
  transpile(state: BrsTranspileState): TranspileResult;
@@ -163,11 +198,15 @@ export declare class GroupingExpression extends Expression {
163
198
  getType(options: GetTypeOptions): BscType;
164
199
  }
165
200
  export declare class LiteralExpression extends Expression {
166
- token: Token;
167
- constructor(token: Token);
201
+ constructor(options: {
202
+ value: Token;
203
+ });
204
+ readonly tokens: {
205
+ readonly value: Token;
206
+ };
168
207
  readonly kind = AstNodeKind.LiteralExpression;
169
208
  get range(): Range;
170
- getType(options?: GetTypeOptions): DynamicType | import("../types").ObjectType | StringType | import("../types").IntegerType | import("../types").BooleanType | import("../types").FloatType | import("../types").DoubleType | import("../types").LongIntegerType | VoidType | import("../types/FunctionType").FunctionType;
209
+ getType(options?: GetTypeOptions): DynamicType | import("..").ObjectType | StringType | import("..").IntegerType | import("..").BooleanType | import("..").FloatType | import("..").DoubleType | import("..").LongIntegerType | VoidType | import("../types/FunctionType").FunctionType;
171
210
  transpile(state: BrsTranspileState): SourceNode[];
172
211
  walk(visitor: WalkVisitor, options: WalkOptions): void;
173
212
  }
@@ -176,23 +215,32 @@ export declare class LiteralExpression extends Expression {
176
215
  * during template string transpile by identifying these expressions explicitly and skipping the bslib_toString around them
177
216
  */
178
217
  export declare class EscapedCharCodeLiteralExpression extends Expression {
179
- readonly token: Token & {
180
- charCode: number;
181
- };
182
- constructor(token: Token & {
183
- charCode: number;
218
+ constructor(options: {
219
+ value: Token & {
220
+ charCode: number;
221
+ };
184
222
  });
185
223
  readonly kind = AstNodeKind.EscapedCharCodeLiteralExpression;
224
+ readonly tokens: {
225
+ readonly value: Token & {
226
+ charCode: number;
227
+ };
228
+ };
186
229
  readonly range: Range;
187
230
  transpile(state: BrsTranspileState): SourceNode[];
188
231
  walk(visitor: WalkVisitor, options: WalkOptions): void;
189
232
  }
190
233
  export declare class ArrayLiteralExpression extends Expression {
234
+ constructor(options: {
235
+ elements: Array<Expression | CommentStatement>;
236
+ open?: Token;
237
+ close?: Token;
238
+ });
191
239
  readonly elements: Array<Expression | CommentStatement>;
192
- readonly open: Token;
193
- readonly close: Token;
194
- readonly hasSpread: boolean;
195
- constructor(elements: Array<Expression | CommentStatement>, open: Token, close: Token, hasSpread?: boolean);
240
+ readonly tokens: {
241
+ readonly open?: Token;
242
+ readonly close?: Token;
243
+ };
196
244
  readonly kind = AstNodeKind.ArrayLiteralExpression;
197
245
  readonly range: Range;
198
246
  transpile(state: BrsTranspileState): any[];
@@ -200,25 +248,37 @@ export declare class ArrayLiteralExpression extends Expression {
200
248
  getType(options: GetTypeOptions): BscType;
201
249
  }
202
250
  export declare class AAMemberExpression extends Expression {
203
- keyToken: Token;
204
- colonToken: Token;
205
- /** The expression evaluated to determine the member's initial value. */
206
- value: Expression;
207
- constructor(keyToken: Token, colonToken: Token,
208
- /** The expression evaluated to determine the member's initial value. */
209
- value: Expression);
251
+ constructor(options: {
252
+ key: Token;
253
+ colon?: Token;
254
+ /** The expression evaluated to determine the member's initial value. */
255
+ value: Expression;
256
+ comma?: Token;
257
+ });
210
258
  readonly kind = AstNodeKind.AAMemberExpression;
211
- range: Range;
212
- commaToken?: Token;
259
+ readonly range: Range;
260
+ readonly tokens: {
261
+ readonly key: Token;
262
+ readonly colon?: Token;
263
+ readonly comma?: Token;
264
+ };
265
+ /** The expression evaluated to determine the member's initial value. */
266
+ readonly value: Expression;
213
267
  transpile(state: BrsTranspileState): any[];
214
268
  walk(visitor: WalkVisitor, options: WalkOptions): void;
215
269
  getType(options: GetTypeOptions): BscType;
216
270
  }
217
271
  export declare class AALiteralExpression extends Expression {
272
+ constructor(options: {
273
+ elements: Array<AAMemberExpression | CommentStatement>;
274
+ open?: Token;
275
+ close?: Token;
276
+ });
218
277
  readonly elements: Array<AAMemberExpression | CommentStatement>;
219
- readonly open: Token;
220
- readonly close: Token;
221
- constructor(elements: Array<AAMemberExpression | CommentStatement>, open: Token, close: Token);
278
+ readonly tokens: {
279
+ readonly open?: Token;
280
+ readonly close?: Token;
281
+ };
222
282
  readonly kind = AstNodeKind.AALiteralExpression;
223
283
  readonly range: Range;
224
284
  transpile(state: BrsTranspileState): any[];
@@ -226,30 +286,43 @@ export declare class AALiteralExpression extends Expression {
226
286
  getType(options: GetTypeOptions): BscType;
227
287
  }
228
288
  export declare class UnaryExpression extends Expression {
229
- operator: Token;
230
- right: Expression;
231
- constructor(operator: Token, right: Expression);
289
+ constructor(options: {
290
+ operator: Token;
291
+ right: Expression;
292
+ });
232
293
  readonly kind = AstNodeKind.UnaryExpression;
233
294
  readonly range: Range;
295
+ readonly tokens: {
296
+ readonly operator: Token;
297
+ };
298
+ readonly right: Expression;
234
299
  transpile(state: BrsTranspileState): (string | SourceNode)[];
235
300
  walk(visitor: WalkVisitor, options: WalkOptions): void;
236
301
  getType(options: GetTypeOptions): BscType;
237
302
  }
238
303
  export declare class VariableExpression extends Expression {
239
- readonly name: Identifier;
240
- constructor(name: Identifier);
304
+ constructor(options: {
305
+ name: Identifier;
306
+ });
307
+ readonly tokens: {
308
+ readonly name: Identifier;
309
+ };
241
310
  readonly kind = AstNodeKind.VariableExpression;
242
311
  readonly range: Range;
243
- getName(parseMode: ParseMode): string;
312
+ getName(parseMode?: ParseMode): string;
244
313
  transpile(state: BrsTranspileState): any[];
245
314
  walk(visitor: WalkVisitor, options: WalkOptions): void;
246
315
  getType(options: GetTypeOptions): BscType;
247
316
  }
248
317
  export declare class SourceLiteralExpression extends Expression {
249
- readonly token: Token;
250
- constructor(token: Token);
318
+ constructor(options: {
319
+ value: Token;
320
+ });
251
321
  readonly range: Range;
252
322
  readonly kind = AstNodeKind.SourceLiteralExpression;
323
+ readonly tokens: {
324
+ readonly value: Token;
325
+ };
253
326
  /**
254
327
  * Find the index of the function in its parent
255
328
  */
@@ -264,11 +337,16 @@ export declare class SourceLiteralExpression extends Expression {
264
337
  * do more type checking.
265
338
  */
266
339
  export declare class NewExpression extends Expression {
267
- readonly newKeyword: Token;
268
- readonly call: CallExpression;
269
- constructor(newKeyword: Token, call: CallExpression);
340
+ constructor(options: {
341
+ new?: Token;
342
+ call: CallExpression;
343
+ });
270
344
  readonly kind = AstNodeKind.NewExpression;
271
345
  readonly range: Range;
346
+ readonly tokens: {
347
+ readonly new?: Token;
348
+ };
349
+ readonly call: CallExpression;
272
350
  /**
273
351
  * The name of the class to initialize (with optional namespace prefixed)
274
352
  */
@@ -278,13 +356,22 @@ export declare class NewExpression extends Expression {
278
356
  getType(options: GetTypeOptions): any;
279
357
  }
280
358
  export declare class CallfuncExpression extends Expression {
359
+ constructor(options: {
360
+ callee: Expression;
361
+ operator?: Token;
362
+ methodName: Identifier;
363
+ openingParen?: Token;
364
+ args?: Expression[];
365
+ closingParen?: Token;
366
+ });
281
367
  readonly callee: Expression;
282
- readonly operator: Token;
283
- readonly methodName: Identifier;
284
- readonly openingParen: Token;
285
368
  readonly args: Expression[];
286
- readonly closingParen: Token;
287
- constructor(callee: Expression, operator: Token, methodName: Identifier, openingParen: Token, args: Expression[], closingParen: Token);
369
+ readonly tokens: {
370
+ readonly operator: Token;
371
+ readonly methodName: Identifier;
372
+ readonly openingParen?: Token;
373
+ readonly closingParen?: Token;
374
+ };
288
375
  readonly kind = AstNodeKind.CallfuncExpression;
289
376
  readonly range: Range;
290
377
  transpile(state: BrsTranspileState): any[];
@@ -296,44 +383,67 @@ export declare class CallfuncExpression extends Expression {
296
383
  * This is a single expression that represents the string contatenation of all parts of a single quasi.
297
384
  */
298
385
  export declare class TemplateStringQuasiExpression extends Expression {
386
+ constructor(options: {
387
+ expressions: Array<LiteralExpression | EscapedCharCodeLiteralExpression>;
388
+ });
299
389
  readonly expressions: Array<LiteralExpression | EscapedCharCodeLiteralExpression>;
300
- constructor(expressions: Array<LiteralExpression | EscapedCharCodeLiteralExpression>);
301
390
  readonly kind = AstNodeKind.TemplateStringQuasiExpression;
302
391
  readonly range: Range;
303
392
  transpile(state: BrsTranspileState, skipEmptyStrings?: boolean): any[];
304
393
  walk(visitor: WalkVisitor, options: WalkOptions): void;
305
394
  }
306
395
  export declare class TemplateStringExpression extends Expression {
307
- readonly openingBacktick: Token;
396
+ constructor(options: {
397
+ openingBacktick?: Token;
398
+ quasis: TemplateStringQuasiExpression[];
399
+ expressions: Expression[];
400
+ closingBacktick?: Token;
401
+ });
402
+ readonly kind = AstNodeKind.TemplateStringExpression;
403
+ readonly tokens: {
404
+ readonly openingBacktick?: Token;
405
+ readonly closingBacktick?: Token;
406
+ };
308
407
  readonly quasis: TemplateStringQuasiExpression[];
309
408
  readonly expressions: Expression[];
310
- readonly closingBacktick: Token;
311
- constructor(openingBacktick: Token, quasis: TemplateStringQuasiExpression[], expressions: Expression[], closingBacktick: Token);
312
- readonly kind = AstNodeKind.TemplateStringExpression;
313
409
  readonly range: Range;
314
410
  getType(options: GetTypeOptions): StringType;
315
411
  transpile(state: BrsTranspileState): any[];
316
412
  walk(visitor: WalkVisitor, options: WalkOptions): void;
317
413
  }
318
414
  export declare class TaggedTemplateStringExpression extends Expression {
319
- readonly tagName: Identifier;
320
- readonly openingBacktick: Token;
415
+ constructor(options: {
416
+ tagName: Identifier;
417
+ openingBacktick?: Token;
418
+ quasis: TemplateStringQuasiExpression[];
419
+ expressions: Expression[];
420
+ closingBacktick?: Token;
421
+ });
422
+ readonly kind = AstNodeKind.TaggedTemplateStringExpression;
423
+ readonly tokens: {
424
+ readonly tagName: Identifier;
425
+ readonly openingBacktick?: Token;
426
+ readonly closingBacktick?: Token;
427
+ };
321
428
  readonly quasis: TemplateStringQuasiExpression[];
322
429
  readonly expressions: Expression[];
323
- readonly closingBacktick: Token;
324
- constructor(tagName: Identifier, openingBacktick: Token, quasis: TemplateStringQuasiExpression[], expressions: Expression[], closingBacktick: Token);
325
- readonly kind = AstNodeKind.TaggedTemplateStringExpression;
326
430
  readonly range: Range;
327
431
  transpile(state: BrsTranspileState): any[];
328
432
  walk(visitor: WalkVisitor, options: WalkOptions): void;
329
433
  }
330
434
  export declare class AnnotationExpression extends Expression {
331
- readonly atToken: Token;
332
- readonly nameToken: Token;
333
- constructor(atToken: Token, nameToken: Token);
435
+ constructor(options: {
436
+ at?: Token;
437
+ name: Token;
438
+ call?: CallExpression;
439
+ });
334
440
  readonly kind = AstNodeKind.AnnotationExpression;
441
+ readonly tokens: {
442
+ readonly at: Token;
443
+ readonly name: Token;
444
+ };
335
445
  get range(): Range;
336
- name: string;
446
+ readonly name: string;
337
447
  call: CallExpression;
338
448
  /**
339
449
  * Convert annotation arguments to JavaScript types
@@ -346,35 +456,49 @@ export declare class AnnotationExpression extends Expression {
346
456
  getTypedef(state: BrsTranspileState): (string | SourceNode)[];
347
457
  }
348
458
  export declare class TernaryExpression extends Expression {
459
+ constructor(options: {
460
+ test: Expression;
461
+ questionMark?: Token;
462
+ consequent?: Expression;
463
+ colon?: Token;
464
+ alternate?: Expression;
465
+ });
466
+ readonly kind = AstNodeKind.TernaryExpression;
467
+ readonly range: Range;
468
+ readonly tokens: {
469
+ readonly questionMark?: Token;
470
+ readonly colon?: Token;
471
+ };
349
472
  readonly test: Expression;
350
- readonly questionMarkToken: Token;
351
473
  readonly consequent?: Expression;
352
- readonly colonToken?: Token;
353
474
  readonly alternate?: Expression;
354
- constructor(test: Expression, questionMarkToken: Token, consequent?: Expression, colonToken?: Token, alternate?: Expression);
355
- readonly kind = AstNodeKind.TernaryExpression;
356
- range: Range;
357
475
  transpile(state: BrsTranspileState): any[];
358
476
  walk(visitor: WalkVisitor, options: WalkOptions): void;
359
477
  }
360
478
  export declare class NullCoalescingExpression extends Expression {
361
- consequent: Expression;
362
- questionQuestionToken: Token;
363
- alternate: Expression;
364
- constructor(consequent: Expression, questionQuestionToken: Token, alternate: Expression);
479
+ constructor(options: {
480
+ consequent: Expression;
481
+ questionQuestion?: Token;
482
+ alternate: Expression;
483
+ });
365
484
  readonly kind = AstNodeKind.NullCoalescingExpression;
366
485
  readonly range: Range;
486
+ readonly tokens: {
487
+ readonly questionQuestion?: Token;
488
+ };
489
+ readonly consequent: Expression;
490
+ readonly alternate: Expression;
367
491
  transpile(state: BrsTranspileState): any[];
368
492
  walk(visitor: WalkVisitor, options: WalkOptions): void;
369
493
  }
370
494
  export declare class RegexLiteralExpression extends Expression {
371
- tokens: {
372
- regexLiteral: Token;
373
- };
374
- constructor(tokens: {
495
+ constructor(options: {
375
496
  regexLiteral: Token;
376
497
  });
377
498
  readonly kind = AstNodeKind.RegexLiteralExpression;
499
+ readonly tokens: {
500
+ readonly regexLiteral: Token;
501
+ };
378
502
  get range(): Range;
379
503
  transpile(state: BrsTranspileState): TranspileResult;
380
504
  walk(visitor: WalkVisitor, options: WalkOptions): void;
@@ -383,17 +507,18 @@ declare type ExpressionValue = string | number | boolean | Expression | Expressi
383
507
  [key: string]: ExpressionValue;
384
508
  };
385
509
  export declare class TypeExpression extends Expression implements TypedefProvider {
510
+ constructor(options: {
511
+ /**
512
+ * The standard AST expression that represents the type for this TypeExpression.
513
+ */
514
+ expression: Expression;
515
+ });
516
+ readonly kind = AstNodeKind.TypeExpression;
386
517
  /**
387
518
  * The standard AST expression that represents the type for this TypeExpression.
388
519
  */
389
- expression: Expression;
390
- constructor(
391
- /**
392
- * The standard AST expression that represents the type for this TypeExpression.
393
- */
394
- expression: Expression);
395
- readonly kind = AstNodeKind.TypeExpression;
396
- range: Range;
520
+ readonly expression: Expression;
521
+ readonly range: Range;
397
522
  transpile(state: BrsTranspileState): TranspileResult;
398
523
  walk(visitor: WalkVisitor, options: WalkOptions): void;
399
524
  getType(options: GetTypeOptions): BscType;
@@ -402,23 +527,35 @@ export declare class TypeExpression extends Expression implements TypedefProvide
402
527
  getNameParts(): string[];
403
528
  }
404
529
  export declare class TypeCastExpression extends Expression {
405
- obj: Expression;
406
- asToken?: Token;
407
- typeExpression?: TypeExpression;
408
- constructor(obj: Expression, asToken?: Token, typeExpression?: TypeExpression);
530
+ constructor(options: {
531
+ obj: Expression;
532
+ as?: Token;
533
+ typeExpression?: TypeExpression;
534
+ });
409
535
  readonly kind = AstNodeKind.TypeCastExpression;
410
- range: Range;
536
+ readonly obj: Expression;
537
+ readonly tokens: {
538
+ readonly as?: Token;
539
+ };
540
+ typeExpression?: TypeExpression;
541
+ readonly range: Range;
411
542
  transpile(state: BrsTranspileState): TranspileResult;
412
543
  walk(visitor: WalkVisitor, options: WalkOptions): void;
413
544
  getType(options: GetTypeOptions): BscType;
414
545
  }
415
546
  export declare class TypedArrayExpression extends Expression {
416
- innerType: Expression;
417
- leftBracket: Token;
418
- rightBracket: Token;
419
- constructor(innerType: Expression, leftBracket: Token, rightBracket: Token);
547
+ constructor(options: {
548
+ innerType: Expression;
549
+ leftBracket?: Token;
550
+ rightBracket?: Token;
551
+ });
552
+ readonly tokens: {
553
+ readonly leftBracket?: Token;
554
+ readonly rightBracket?: Token;
555
+ };
556
+ readonly innerType: Expression;
420
557
  readonly kind = AstNodeKind.TypedArrayExpression;
421
- range: Range;
558
+ readonly range: Range;
422
559
  transpile(state: BrsTranspileState): TranspileResult;
423
560
  walk(visitor: WalkVisitor, options: WalkOptions): void;
424
561
  getType(options: GetTypeOptions): BscType;