brighterscript 1.0.0-alpha.32 → 1.0.0-alpha.34

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 (186) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +2 -2
  3. package/bsconfig.schema.json +3 -1
  4. package/dist/CrossScopeValidator.js +11 -11
  5. package/dist/CrossScopeValidator.js.map +1 -1
  6. package/dist/DiagnosticManager.js +3 -3
  7. package/dist/DiagnosticManager.js.map +1 -1
  8. package/dist/DiagnosticMessages.js +6 -4
  9. package/dist/DiagnosticMessages.js.map +1 -1
  10. package/dist/FunctionScope.js +2 -2
  11. package/dist/FunctionScope.js.map +1 -1
  12. package/dist/Program.js +4 -3
  13. package/dist/Program.js.map +1 -1
  14. package/dist/astUtils/creators.d.ts +13 -19
  15. package/dist/astUtils/creators.js +27 -42
  16. package/dist/astUtils/creators.js.map +1 -1
  17. package/dist/astUtils/reflection.spec.js +1 -1
  18. package/dist/astUtils/reflection.spec.js.map +1 -1
  19. package/dist/astUtils/visitors.spec.js +4 -6
  20. package/dist/astUtils/visitors.spec.js.map +1 -1
  21. package/dist/bscPlugin/CallExpressionInfo.js +9 -5
  22. package/dist/bscPlugin/CallExpressionInfo.js.map +1 -1
  23. package/dist/bscPlugin/SignatureHelpUtil.js +5 -5
  24. package/dist/bscPlugin/SignatureHelpUtil.js.map +1 -1
  25. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +4 -4
  26. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
  27. package/dist/bscPlugin/completions/CompletionsProcessor.d.ts +5 -1
  28. package/dist/bscPlugin/completions/CompletionsProcessor.js +94 -70
  29. package/dist/bscPlugin/completions/CompletionsProcessor.js.map +1 -1
  30. package/dist/bscPlugin/completions/CompletionsProcessor.spec.js +24 -3
  31. package/dist/bscPlugin/completions/CompletionsProcessor.spec.js.map +1 -1
  32. package/dist/bscPlugin/definition/DefinitionProvider.js +20 -17
  33. package/dist/bscPlugin/definition/DefinitionProvider.js.map +1 -1
  34. package/dist/bscPlugin/hover/HoverProcessor.js +4 -4
  35. package/dist/bscPlugin/hover/HoverProcessor.js.map +1 -1
  36. package/dist/bscPlugin/references/ReferencesProvider.js +4 -3
  37. package/dist/bscPlugin/references/ReferencesProvider.js.map +1 -1
  38. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +2 -2
  39. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -1
  40. package/dist/bscPlugin/symbols/symbolUtils.js +22 -21
  41. package/dist/bscPlugin/symbols/symbolUtils.js.map +1 -1
  42. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js +4 -4
  43. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js.map +1 -1
  44. package/dist/bscPlugin/validation/BrsFileValidator.js +32 -25
  45. package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -1
  46. package/dist/bscPlugin/validation/ScopeValidator.js +84 -76
  47. package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -1
  48. package/dist/bscPlugin/validation/ScopeValidator.spec.js +78 -0
  49. package/dist/bscPlugin/validation/ScopeValidator.spec.js.map +1 -1
  50. package/dist/bscPlugin/validation/XmlFileValidator.js +4 -3
  51. package/dist/bscPlugin/validation/XmlFileValidator.js.map +1 -1
  52. package/dist/files/BrsFile.js +42 -32
  53. package/dist/files/BrsFile.js.map +1 -1
  54. package/dist/files/BrsFile.spec.js +124 -26
  55. package/dist/files/BrsFile.spec.js.map +1 -1
  56. package/dist/files/XmlFile.js +4 -1
  57. package/dist/files/XmlFile.js.map +1 -1
  58. package/dist/files/XmlFile.spec.js +4 -2
  59. package/dist/files/XmlFile.spec.js.map +1 -1
  60. package/dist/globalCallables.js +1 -1
  61. package/dist/globalCallables.js.map +1 -1
  62. package/dist/index.d.ts +1 -1
  63. package/dist/index.js +2 -1
  64. package/dist/index.js.map +1 -1
  65. package/dist/interfaces.d.ts +6 -4
  66. package/dist/interfaces.js +3 -3
  67. package/dist/interfaces.js.map +1 -1
  68. package/dist/lexer/Lexer.d.ts +10 -1
  69. package/dist/lexer/Lexer.js +16 -6
  70. package/dist/lexer/Lexer.js.map +1 -1
  71. package/dist/lexer/Lexer.spec.js +9 -8
  72. package/dist/lexer/Lexer.spec.js.map +1 -1
  73. package/dist/lexer/Token.d.ts +16 -8
  74. package/dist/lexer/Token.js.map +1 -1
  75. package/dist/parser/AstNode.d.ts +4 -4
  76. package/dist/parser/AstNode.js +3 -3
  77. package/dist/parser/AstNode.js.map +1 -1
  78. package/dist/parser/BrsTranspileState.d.ts +2 -2
  79. package/dist/parser/Expression.d.ts +55 -55
  80. package/dist/parser/Expression.js +95 -101
  81. package/dist/parser/Expression.js.map +1 -1
  82. package/dist/parser/Parser.Class.spec.js +59 -59
  83. package/dist/parser/Parser.Class.spec.js.map +1 -1
  84. package/dist/parser/Parser.d.ts +5 -1
  85. package/dist/parser/Parser.js +123 -97
  86. package/dist/parser/Parser.js.map +1 -1
  87. package/dist/parser/Parser.spec.js +233 -223
  88. package/dist/parser/Parser.spec.js.map +1 -1
  89. package/dist/parser/SGParser.d.ts +19 -6
  90. package/dist/parser/SGParser.js +22 -11
  91. package/dist/parser/SGParser.js.map +1 -1
  92. package/dist/parser/SGParser.spec.js +4 -4
  93. package/dist/parser/SGParser.spec.js.map +1 -1
  94. package/dist/parser/SGTypes.d.ts +6 -6
  95. package/dist/parser/SGTypes.js +11 -11
  96. package/dist/parser/SGTypes.js.map +1 -1
  97. package/dist/parser/Statement.d.ts +100 -102
  98. package/dist/parser/Statement.js +215 -149
  99. package/dist/parser/Statement.js.map +1 -1
  100. package/dist/parser/Statement.spec.js +89 -3
  101. package/dist/parser/Statement.spec.js.map +1 -1
  102. package/dist/parser/TranspileState.d.ts +6 -6
  103. package/dist/parser/TranspileState.js +29 -12
  104. package/dist/parser/TranspileState.js.map +1 -1
  105. package/dist/parser/tests/Parser.spec.d.ts +0 -7
  106. package/dist/parser/tests/Parser.spec.js +2 -12
  107. package/dist/parser/tests/Parser.spec.js.map +1 -1
  108. package/dist/parser/tests/controlFlow/For.spec.js +19 -21
  109. package/dist/parser/tests/controlFlow/For.spec.js.map +1 -1
  110. package/dist/parser/tests/controlFlow/ForEach.spec.js +16 -15
  111. package/dist/parser/tests/controlFlow/ForEach.spec.js.map +1 -1
  112. package/dist/parser/tests/controlFlow/If.spec.js +219 -97
  113. package/dist/parser/tests/controlFlow/If.spec.js.map +1 -1
  114. package/dist/parser/tests/controlFlow/While.spec.js +13 -12
  115. package/dist/parser/tests/controlFlow/While.spec.js.map +1 -1
  116. package/dist/parser/tests/expression/Additive.spec.js +25 -17
  117. package/dist/parser/tests/expression/Additive.spec.js.map +1 -1
  118. package/dist/parser/tests/expression/ArrayLiterals.spec.js +51 -38
  119. package/dist/parser/tests/expression/ArrayLiterals.spec.js.map +1 -1
  120. package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js +51 -38
  121. package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js.map +1 -1
  122. package/dist/parser/tests/expression/Boolean.spec.js +21 -14
  123. package/dist/parser/tests/expression/Boolean.spec.js.map +1 -1
  124. package/dist/parser/tests/expression/Call.spec.js +43 -34
  125. package/dist/parser/tests/expression/Call.spec.js.map +1 -1
  126. package/dist/parser/tests/expression/Exponential.spec.js +4 -4
  127. package/dist/parser/tests/expression/Exponential.spec.js.map +1 -1
  128. package/dist/parser/tests/expression/Function.spec.js +53 -44
  129. package/dist/parser/tests/expression/Function.spec.js.map +1 -1
  130. package/dist/parser/tests/expression/Indexing.spec.js +50 -37
  131. package/dist/parser/tests/expression/Indexing.spec.js.map +1 -1
  132. package/dist/parser/tests/expression/Multiplicative.spec.js +8 -8
  133. package/dist/parser/tests/expression/Multiplicative.spec.js.map +1 -1
  134. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +37 -37
  135. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +1 -1
  136. package/dist/parser/tests/expression/PrefixUnary.spec.js +23 -17
  137. package/dist/parser/tests/expression/PrefixUnary.spec.js.map +1 -1
  138. package/dist/parser/tests/expression/Primary.spec.js +42 -26
  139. package/dist/parser/tests/expression/Primary.spec.js.map +1 -1
  140. package/dist/parser/tests/expression/Relational.spec.js +12 -12
  141. package/dist/parser/tests/expression/Relational.spec.js.map +1 -1
  142. package/dist/parser/tests/expression/TemplateStringExpression.spec.js +12 -11
  143. package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +1 -1
  144. package/dist/parser/tests/expression/TernaryExpression.spec.js +51 -51
  145. package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
  146. package/dist/parser/tests/expression/TypeExpression.spec.js +15 -15
  147. package/dist/parser/tests/expression/TypeExpression.spec.js.map +1 -1
  148. package/dist/parser/tests/statement/AssignmentOperators.spec.js +14 -14
  149. package/dist/parser/tests/statement/AssignmentOperators.spec.js.map +1 -1
  150. package/dist/parser/tests/statement/ConstStatement.spec.js +3 -3
  151. package/dist/parser/tests/statement/ConstStatement.spec.js.map +1 -1
  152. package/dist/parser/tests/statement/Declaration.spec.js +29 -23
  153. package/dist/parser/tests/statement/Declaration.spec.js.map +1 -1
  154. package/dist/parser/tests/statement/Dim.spec.js +1 -1
  155. package/dist/parser/tests/statement/Dim.spec.js.map +1 -1
  156. package/dist/parser/tests/statement/Enum.spec.js +10 -10
  157. package/dist/parser/tests/statement/Enum.spec.js.map +1 -1
  158. package/dist/parser/tests/statement/Function.spec.js +36 -35
  159. package/dist/parser/tests/statement/Function.spec.js.map +1 -1
  160. package/dist/parser/tests/statement/Increment.spec.js +23 -18
  161. package/dist/parser/tests/statement/Increment.spec.js.map +1 -1
  162. package/dist/parser/tests/statement/LibraryStatement.spec.js +6 -6
  163. package/dist/parser/tests/statement/LibraryStatement.spec.js.map +1 -1
  164. package/dist/parser/tests/statement/Misc.spec.js +6 -6
  165. package/dist/parser/tests/statement/Misc.spec.js.map +1 -1
  166. package/dist/parser/tests/statement/PrintStatement.spec.js +20 -18
  167. package/dist/parser/tests/statement/PrintStatement.spec.js.map +1 -1
  168. package/dist/parser/tests/statement/ReturnStatement.spec.js +13 -12
  169. package/dist/parser/tests/statement/ReturnStatement.spec.js.map +1 -1
  170. package/dist/parser/tests/statement/Set.spec.js +35 -34
  171. package/dist/parser/tests/statement/Set.spec.js.map +1 -1
  172. package/dist/parser/tests/statement/Stop.spec.js +3 -3
  173. package/dist/parser/tests/statement/Stop.spec.js.map +1 -1
  174. package/dist/roku-types/data.json +81 -15
  175. package/dist/roku-types/index.d.ts +29 -4
  176. package/dist/types/ArrayType.js +6 -1
  177. package/dist/types/ArrayType.js.map +1 -1
  178. package/dist/types/BuiltInInterfaceAdder.js +1 -1
  179. package/dist/types/BuiltInInterfaceAdder.js.map +1 -1
  180. package/dist/types/InheritableType.js.map +1 -1
  181. package/dist/util.d.ts +46 -26
  182. package/dist/util.js +168 -59
  183. package/dist/util.js.map +1 -1
  184. package/dist/validators/ClassValidator.js +13 -11
  185. package/dist/validators/ClassValidator.js.map +1 -1
  186. package/package.json +8 -3
@@ -24,7 +24,7 @@ class EmptyStatement extends AstNode_2.Statement {
24
24
  constructor(options) {
25
25
  super();
26
26
  this.kind = AstNode_1.AstNodeKind.EmptyStatement;
27
- this.range = undefined;
27
+ this.location = undefined;
28
28
  }
29
29
  transpile(state) {
30
30
  return [];
@@ -46,13 +46,13 @@ class Body extends AstNode_2.Statement {
46
46
  this.symbolTable = new SymbolTable_1.SymbolTable('Body', () => { var _a; return (_a = this.parent) === null || _a === void 0 ? void 0 : _a.getSymbolTable(); });
47
47
  this.statements = (_a = options === null || options === void 0 ? void 0 : options.statements) !== null && _a !== void 0 ? _a : [];
48
48
  }
49
- get range() {
49
+ get location() {
50
50
  var _a;
51
51
  //this needs to be a getter because the body has its statements pushed to it after being constructed
52
- return util_1.util.createBoundingRange(...((_a = this.statements) !== null && _a !== void 0 ? _a : []));
52
+ return util_1.util.createBoundingLocation(...((_a = this.statements) !== null && _a !== void 0 ? _a : []));
53
53
  }
54
54
  transpile(state) {
55
- var _a, _b, _c, _d;
55
+ var _a, _b, _c, _d, _e, _f;
56
56
  let result = [];
57
57
  for (let i = 0; i < this.statements.length; i++) {
58
58
  let statement = this.statements[i];
@@ -62,7 +62,7 @@ class Body extends AstNode_2.Statement {
62
62
  //this is the first statement. do nothing related to spacing and newlines
63
63
  //if comment is on same line as prior sibling
64
64
  }
65
- else if (util_1.util.hasLeadingComments(statement) && previousStatement && ((_c = (_b = (_a = util_1.util.getLeadingComments(statement)) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.range) === null || _c === void 0 ? void 0 : _c.start.line) === ((_d = previousStatement.range) === null || _d === void 0 ? void 0 : _d.end.line)) {
65
+ else if (util_1.util.hasLeadingComments(statement) && previousStatement && ((_d = (_c = (_b = (_a = util_1.util.getLeadingComments(statement)) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.location) === null || _c === void 0 ? void 0 : _c.range) === null || _d === void 0 ? void 0 : _d.start.line) === ((_f = (_e = previousStatement.location) === null || _e === void 0 ? void 0 : _e.range) === null || _f === void 0 ? void 0 : _f.end.line)) {
66
66
  result.push(' ');
67
67
  //add double newline if this is a comment, and next is a function
68
68
  }
@@ -109,7 +109,7 @@ class AssignmentStatement extends AstNode_2.Statement {
109
109
  as: options.as
110
110
  };
111
111
  this.typeExpression = options.typeExpression;
112
- this.range = util_1.util.createBoundingRange(util_1.util.createBoundingRangeFromTokens(this.tokens), this.value);
112
+ this.location = util_1.util.createBoundingLocation(util_1.util.createBoundingLocationFromTokens(this.tokens), this.value);
113
113
  }
114
114
  transpile(state) {
115
115
  var _a;
@@ -128,16 +128,15 @@ class AssignmentStatement extends AstNode_2.Statement {
128
128
  }
129
129
  }
130
130
  getType(options) {
131
- var _a, _b, _c;
131
+ var _a, _b, _c, _d;
132
132
  const variableType = (_b = (_a = this.typeExpression) === null || _a === void 0 ? void 0 : _a.getType(Object.assign(Object.assign({}, options), { typeChain: undefined }))) !== null && _b !== void 0 ? _b : this.value.getType(Object.assign(Object.assign({}, options), { typeChain: undefined }));
133
133
  // Note: compound assignments (eg. +=) are internally dealt with via the RHS being a BinaryExpression
134
134
  // so this.value will be a BinaryExpression, and BinaryExpressions can figure out their own types
135
- (_c = options.typeChain) === null || _c === void 0 ? void 0 : _c.push(new interfaces_1.TypeChainEntry({ name: this.tokens.name.text, type: variableType, data: options.data, range: this.tokens.name.range, astNode: this }));
135
+ (_c = options.typeChain) === null || _c === void 0 ? void 0 : _c.push(new interfaces_1.TypeChainEntry({ name: this.tokens.name.text, type: variableType, data: options.data, location: (_d = this.tokens.name) === null || _d === void 0 ? void 0 : _d.location, astNode: this }));
136
136
  return variableType;
137
137
  }
138
- getLeadingTrivia() {
139
- var _a;
140
- return (_a = this.tokens.name.leadingTrivia) !== null && _a !== void 0 ? _a : [];
138
+ get leadingTrivia() {
139
+ return this.tokens.name.leadingTrivia;
141
140
  }
142
141
  }
143
142
  exports.AssignmentStatement = AssignmentStatement;
@@ -151,7 +150,7 @@ class AugmentedAssignmentStatement extends AstNode_2.Statement {
151
150
  };
152
151
  this.item = options.item;
153
152
  this.value = options.value;
154
- this.range = util_1.util.createBoundingRange(this.item, util_1.util.createBoundingRangeFromTokens(this.tokens), this.value);
153
+ this.location = util_1.util.createBoundingLocation(this.item, util_1.util.createBoundingLocationFromTokens(this.tokens), this.value);
155
154
  }
156
155
  transpile(state) {
157
156
  return [
@@ -176,21 +175,74 @@ class AugmentedAssignmentStatement extends AstNode_2.Statement {
176
175
  // options.typeChain?.push(new TypeChainEntry({ name: this.tokens.name.text, type: variableType, data: options.data, range: this.tokens.name.range, astNode: this }));
177
176
  return variableType;
178
177
  }
179
- getLeadingTrivia() {
180
- return this.item.getLeadingTrivia();
178
+ get leadingTrivia() {
179
+ return this.item.leadingTrivia;
181
180
  }
182
181
  }
183
182
  exports.AugmentedAssignmentStatement = AugmentedAssignmentStatement;
184
183
  class Block extends AstNode_2.Statement {
185
184
  constructor(options) {
186
- var _a;
187
185
  super();
188
186
  this.kind = AstNode_1.AstNodeKind.Block;
189
187
  this.statements = options.statements;
190
- this.startingRange = options.startingRange;
191
- this.range = util_1.util.createBoundingRange(this.startingRange, ...((_a = this.statements) !== null && _a !== void 0 ? _a : []));
188
+ }
189
+ get location() {
190
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
191
+ if (this.statements.length > 0) {
192
+ return util_1.util.createBoundingLocation(...this.statements);
193
+ }
194
+ let lastBitBefore;
195
+ let firstBitAfter;
196
+ if ((0, reflection_1.isFunctionExpression)(this.parent)) {
197
+ lastBitBefore = util_1.util.createBoundingLocation(this.parent.tokens.functionType, this.parent.tokens.leftParen, ...((_a = this.parent.parameters) !== null && _a !== void 0 ? _a : []), this.parent.tokens.rightParen, this.parent.tokens.as, this.parent.returnTypeExpression);
198
+ firstBitAfter = (_b = this.parent.tokens.endFunctionType) === null || _b === void 0 ? void 0 : _b.location;
199
+ }
200
+ else if ((0, reflection_1.isIfStatement)(this.parent)) {
201
+ if (this.parent.thenBranch === this) {
202
+ lastBitBefore = util_1.util.createBoundingLocation(this.parent.tokens.then, this.parent.condition);
203
+ firstBitAfter = util_1.util.createBoundingLocation(this.parent.tokens.else, this.parent.elseBranch, this.parent.tokens.endIf);
204
+ }
205
+ else if (this.parent.elseBranch === this) {
206
+ lastBitBefore = (_c = this.parent.tokens.else) === null || _c === void 0 ? void 0 : _c.location;
207
+ firstBitAfter = (_d = this.parent.tokens.endIf) === null || _d === void 0 ? void 0 : _d.location;
208
+ }
209
+ }
210
+ else if ((0, reflection_1.isConditionalCompileStatement)(this.parent)) {
211
+ if (this.parent.thenBranch === this) {
212
+ lastBitBefore = util_1.util.createBoundingLocation(this.parent.tokens.condition, this.parent.tokens.not, this.parent.tokens.hashIf);
213
+ firstBitAfter = util_1.util.createBoundingLocation(this.parent.tokens.hashElse, this.parent.elseBranch, this.parent.tokens.hashEndIf);
214
+ }
215
+ else if (this.parent.elseBranch === this) {
216
+ lastBitBefore = (_e = this.parent.tokens.hashElse) === null || _e === void 0 ? void 0 : _e.location;
217
+ firstBitAfter = (_f = this.parent.tokens.hashEndIf) === null || _f === void 0 ? void 0 : _f.location;
218
+ }
219
+ }
220
+ else if ((0, reflection_1.isForStatement)(this.parent)) {
221
+ lastBitBefore = util_1.util.createBoundingLocation(this.parent.increment, this.parent.tokens.step, this.parent.finalValue, this.parent.tokens.to, this.parent.counterDeclaration, this.parent.tokens.for);
222
+ firstBitAfter = (_g = this.parent.tokens.endFor) === null || _g === void 0 ? void 0 : _g.location;
223
+ }
224
+ else if ((0, reflection_1.isForEachStatement)(this.parent)) {
225
+ lastBitBefore = util_1.util.createBoundingLocation(this.parent.target, this.parent.tokens.in, this.parent.tokens.item, this.parent.tokens.forEach);
226
+ firstBitAfter = (_h = this.parent.tokens.endFor) === null || _h === void 0 ? void 0 : _h.location;
227
+ }
228
+ else if ((0, reflection_1.isWhileStatement)(this.parent)) {
229
+ lastBitBefore = util_1.util.createBoundingLocation(this.parent.condition, this.parent.tokens.while);
230
+ firstBitAfter = (_j = this.parent.tokens.endWhile) === null || _j === void 0 ? void 0 : _j.location;
231
+ }
232
+ else if ((0, reflection_1.isTryCatchStatement)(this.parent)) {
233
+ lastBitBefore = util_1.util.createBoundingLocation(this.parent.tokens.try);
234
+ firstBitAfter = util_1.util.createBoundingLocation(this.parent.tokens.endTry, this.parent.catchStatement);
235
+ }
236
+ else if ((0, reflection_1.isCatchStatement)(this.parent) && (0, reflection_1.isTryCatchStatement)((_k = this.parent) === null || _k === void 0 ? void 0 : _k.parent)) {
237
+ lastBitBefore = util_1.util.createBoundingLocation(this.parent.tokens.catch, this.parent.tokens.exceptionVariable);
238
+ firstBitAfter = (_l = this.parent.parent.tokens.endTry) === null || _l === void 0 ? void 0 : _l.location;
239
+ }
240
+ if ((lastBitBefore === null || lastBitBefore === void 0 ? void 0 : lastBitBefore.range) && (firstBitAfter === null || firstBitAfter === void 0 ? void 0 : firstBitAfter.range)) {
241
+ return util_1.util.createLocation(lastBitBefore.range.end.line, lastBitBefore.range.end.character, firstBitAfter.range.start.line, firstBitAfter.range.start.character, (_m = lastBitBefore.uri) !== null && _m !== void 0 ? _m : firstBitAfter.uri);
242
+ }
192
243
  }
193
244
  transpile(state) {
245
+ var _a;
194
246
  state.blockDepth++;
195
247
  let results = [];
196
248
  for (let i = 0; i < this.statements.length; i++) {
@@ -198,8 +250,8 @@ class Block extends AstNode_2.Statement {
198
250
  let statement = this.statements[i];
199
251
  //is not a comment
200
252
  //if comment is on same line as parent
201
- if (util_1.util.isLeadingCommentOnSameLine(state.lineage[0], statement) ||
202
- util_1.util.isLeadingCommentOnSameLine(previousStatement, statement)) {
253
+ if (util_1.util.isLeadingCommentOnSameLine((_a = state.lineage[0]) === null || _a === void 0 ? void 0 : _a.location, statement) ||
254
+ util_1.util.isLeadingCommentOnSameLine(previousStatement === null || previousStatement === void 0 ? void 0 : previousStatement.location, statement)) {
203
255
  results.push(' ');
204
256
  //is not a comment
205
257
  }
@@ -215,6 +267,10 @@ class Block extends AstNode_2.Statement {
215
267
  state.blockDepth--;
216
268
  return results;
217
269
  }
270
+ get leadingTrivia() {
271
+ var _a, _b;
272
+ return (_b = (_a = this.statements[0]) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
273
+ }
218
274
  walk(visitor, options) {
219
275
  if (options.walkMode & visitors_1.InternalWalkMode.walkStatements) {
220
276
  (0, visitors_1.walkArray)(this.statements, visitor, options, this);
@@ -227,7 +283,7 @@ class ExpressionStatement extends AstNode_2.Statement {
227
283
  super();
228
284
  this.kind = AstNode_1.AstNodeKind.ExpressionStatement;
229
285
  this.expression = options.expression;
230
- this.range = this.expression.range;
286
+ this.location = this.expression.location;
231
287
  }
232
288
  transpile(state) {
233
289
  return this.expression.transpile(state);
@@ -237,8 +293,8 @@ class ExpressionStatement extends AstNode_2.Statement {
237
293
  (0, visitors_1.walk)(this, 'expression', visitor, options);
238
294
  }
239
295
  }
240
- getLeadingTrivia() {
241
- return this.expression.getLeadingTrivia();
296
+ get leadingTrivia() {
297
+ return this.expression.leadingTrivia;
242
298
  }
243
299
  }
244
300
  exports.ExpressionStatement = ExpressionStatement;
@@ -250,7 +306,7 @@ class ExitForStatement extends AstNode_2.Statement {
250
306
  this.tokens = {
251
307
  exitFor: options === null || options === void 0 ? void 0 : options.exitFor
252
308
  };
253
- this.range = (_a = this.tokens.exitFor) === null || _a === void 0 ? void 0 : _a.range;
309
+ this.location = (_a = this.tokens.exitFor) === null || _a === void 0 ? void 0 : _a.location;
254
310
  }
255
311
  transpile(state) {
256
312
  return this.tokens.exitFor ? state.transpileToken(this.tokens.exitFor) : ['exit for'];
@@ -258,9 +314,9 @@ class ExitForStatement extends AstNode_2.Statement {
258
314
  walk(visitor, options) {
259
315
  //nothing to walk
260
316
  }
261
- getLeadingTrivia() {
262
- var _a, _b;
263
- return (_b = (_a = this.tokens.exitFor) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
317
+ get leadingTrivia() {
318
+ var _a;
319
+ return (_a = this.tokens.exitFor) === null || _a === void 0 ? void 0 : _a.leadingTrivia;
264
320
  }
265
321
  }
266
322
  exports.ExitForStatement = ExitForStatement;
@@ -272,7 +328,7 @@ class ExitWhileStatement extends AstNode_2.Statement {
272
328
  this.tokens = {
273
329
  exitWhile: options === null || options === void 0 ? void 0 : options.exitWhile
274
330
  };
275
- this.range = (_a = this.tokens.exitWhile) === null || _a === void 0 ? void 0 : _a.range;
331
+ this.location = (_a = this.tokens.exitWhile) === null || _a === void 0 ? void 0 : _a.location;
276
332
  }
277
333
  transpile(state) {
278
334
  return this.tokens.exitWhile ? state.transpileToken(this.tokens.exitWhile) : ['exit while'];
@@ -280,9 +336,9 @@ class ExitWhileStatement extends AstNode_2.Statement {
280
336
  walk(visitor, options) {
281
337
  //nothing to walk
282
338
  }
283
- getLeadingTrivia() {
284
- var _a, _b;
285
- return (_b = (_a = this.tokens.exitWhile) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
339
+ get leadingTrivia() {
340
+ var _a;
341
+ return (_a = this.tokens.exitWhile) === null || _a === void 0 ? void 0 : _a.leadingTrivia;
286
342
  }
287
343
  }
288
344
  exports.ExitWhileStatement = ExitWhileStatement;
@@ -297,7 +353,7 @@ class FunctionStatement extends AstNode_2.Statement {
297
353
  this.func = options.func;
298
354
  this.func.symbolTable.name += `: '${(_a = this.tokens.name) === null || _a === void 0 ? void 0 : _a.text}'`;
299
355
  this.func.functionStatement = this;
300
- this.range = this.func.range;
356
+ this.location = this.func.location;
301
357
  }
302
358
  /**
303
359
  * Get the name of this expression based on the parse mode
@@ -314,8 +370,8 @@ class FunctionStatement extends AstNode_2.Statement {
314
370
  return this.tokens.name.text;
315
371
  }
316
372
  }
317
- getLeadingTrivia() {
318
- return util_1.util.concatAnnotationLeadingTrivia(this, this.func.getLeadingTrivia());
373
+ get leadingTrivia() {
374
+ return this.func.leadingTrivia;
319
375
  }
320
376
  transpile(state) {
321
377
  //create a fake token using the full transpiled name
@@ -353,14 +409,24 @@ class IfStatement extends AstNode_2.Statement {
353
409
  this.condition = options.condition;
354
410
  this.thenBranch = options.thenBranch;
355
411
  this.elseBranch = options.elseBranch;
356
- this.isInline = options.isInline;
357
412
  this.tokens = {
358
413
  if: options.if,
359
414
  then: options.then,
360
415
  else: options.else,
361
416
  endIf: options.endIf
362
417
  };
363
- this.range = util_1.util.createBoundingRange(util_1.util.createBoundingRangeFromTokens(this.tokens), this.condition, this.thenBranch, this.elseBranch);
418
+ this.location = util_1.util.createBoundingLocation(util_1.util.createBoundingLocationFromTokens(this.tokens), this.condition, this.thenBranch, this.elseBranch);
419
+ }
420
+ get isInline() {
421
+ var _a, _b, _c, _d;
422
+ const allLeadingTrivia = [
423
+ ...this.thenBranch.leadingTrivia,
424
+ ...this.thenBranch.statements.map(s => s.leadingTrivia).flat(),
425
+ ...((_b = (_a = this.tokens.else) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : []),
426
+ ...((_d = (_c = this.tokens.endIf) === null || _c === void 0 ? void 0 : _c.leadingTrivia) !== null && _d !== void 0 ? _d : [])
427
+ ];
428
+ const hasNewline = allLeadingTrivia.find(t => t.kind === TokenKind_1.TokenKind.Newline);
429
+ return !hasNewline;
364
430
  }
365
431
  transpile(state) {
366
432
  var _a, _b;
@@ -427,11 +493,11 @@ class IfStatement extends AstNode_2.Statement {
427
493
  (0, visitors_1.walk)(this, 'elseBranch', visitor, options);
428
494
  }
429
495
  }
430
- getLeadingTrivia() {
496
+ get leadingTrivia() {
431
497
  var _a, _b;
432
498
  return (_b = (_a = this.tokens.if) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
433
499
  }
434
- getEndTrivia() {
500
+ get endTrivia() {
435
501
  var _a, _b;
436
502
  return (_b = (_a = this.tokens.endIf) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
437
503
  }
@@ -445,7 +511,7 @@ class IncrementStatement extends AstNode_2.Statement {
445
511
  this.tokens = {
446
512
  operator: options.operator
447
513
  };
448
- this.range = util_1.util.createBoundingRange(this.value, this.tokens.operator);
514
+ this.location = util_1.util.createBoundingLocation(this.value, this.tokens.operator);
449
515
  }
450
516
  transpile(state) {
451
517
  return [
@@ -458,9 +524,9 @@ class IncrementStatement extends AstNode_2.Statement {
458
524
  (0, visitors_1.walk)(this, 'value', visitor, options);
459
525
  }
460
526
  }
461
- getLeadingTrivia() {
527
+ get leadingTrivia() {
462
528
  var _a, _b;
463
- return (_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.getLeadingTrivia()) !== null && _b !== void 0 ? _b : [];
529
+ return (_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
464
530
  }
465
531
  }
466
532
  exports.IncrementStatement = IncrementStatement;
@@ -482,7 +548,7 @@ class PrintStatement extends AstNode_2.Statement {
482
548
  print: options.print
483
549
  };
484
550
  this.expressions = options.expressions;
485
- this.range = util_1.util.createBoundingRange(this.tokens.print, ...((_a = this.expressions) !== null && _a !== void 0 ? _a : []));
551
+ this.location = util_1.util.createBoundingLocation(this.tokens.print, ...((_a = this.expressions) !== null && _a !== void 0 ? _a : []));
486
552
  }
487
553
  transpile(state) {
488
554
  var _a;
@@ -511,7 +577,7 @@ class PrintStatement extends AstNode_2.Statement {
511
577
  (0, visitors_1.walkArray)(this.expressions, visitor, options, this, (item) => (0, reflection_1.isExpression)(item));
512
578
  }
513
579
  }
514
- getLeadingTrivia() {
580
+ get leadingTrivia() {
515
581
  var _a, _b;
516
582
  return (_b = (_a = this.tokens.print) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
517
583
  }
@@ -529,7 +595,7 @@ class DimStatement extends AstNode_2.Statement {
529
595
  closingSquare: options.closingSquare
530
596
  };
531
597
  this.dimensions = options.dimensions;
532
- this.range = util_1.util.createBoundingRange(options.dim, options.name, options.openingSquare, ...((_a = this.dimensions) !== null && _a !== void 0 ? _a : []), options.closingSquare);
598
+ this.location = util_1.util.createBoundingLocation(options.dim, options.name, options.openingSquare, ...((_a = this.dimensions) !== null && _a !== void 0 ? _a : []), options.closingSquare);
533
599
  }
534
600
  transpile(state) {
535
601
  let result = [
@@ -562,7 +628,7 @@ class DimStatement extends AstNode_2.Statement {
562
628
  }
563
629
  return type;
564
630
  }
565
- getLeadingTrivia() {
631
+ get leadingTrivia() {
566
632
  var _a, _b;
567
633
  return (_b = (_a = this.tokens.dim) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
568
634
  }
@@ -576,7 +642,7 @@ class GotoStatement extends AstNode_2.Statement {
576
642
  goto: options.goto,
577
643
  label: options.label
578
644
  };
579
- this.range = util_1.util.createBoundingRange(this.tokens.goto, this.tokens.label);
645
+ this.location = util_1.util.createBoundingLocation(this.tokens.goto, this.tokens.label);
580
646
  }
581
647
  transpile(state) {
582
648
  return [
@@ -588,7 +654,7 @@ class GotoStatement extends AstNode_2.Statement {
588
654
  walk(visitor, options) {
589
655
  //nothing to walk
590
656
  }
591
- getLeadingTrivia() {
657
+ get leadingTrivia() {
592
658
  var _a, _b;
593
659
  return (_b = (_a = this.tokens.goto) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
594
660
  }
@@ -602,10 +668,10 @@ class LabelStatement extends AstNode_2.Statement {
602
668
  name: options.name,
603
669
  colon: options.colon
604
670
  };
605
- this.range = util_1.util.createBoundingRange(this.tokens.name, this.tokens.colon);
671
+ this.location = util_1.util.createBoundingLocation(this.tokens.name, this.tokens.colon);
606
672
  }
607
- getLeadingTrivia() {
608
- return util_1.util.concatAnnotationLeadingTrivia(this, this.tokens.name.leadingTrivia);
673
+ get leadingTrivia() {
674
+ return this.tokens.name.leadingTrivia;
609
675
  }
610
676
  transpile(state) {
611
677
  return [
@@ -626,7 +692,7 @@ class ReturnStatement extends AstNode_2.Statement {
626
692
  return: options === null || options === void 0 ? void 0 : options.return
627
693
  };
628
694
  this.value = options === null || options === void 0 ? void 0 : options.value;
629
- this.range = util_1.util.createBoundingRange(this.tokens.return, this.value);
695
+ this.location = util_1.util.createBoundingLocation(this.tokens.return, this.value);
630
696
  }
631
697
  transpile(state) {
632
698
  let result = [];
@@ -642,7 +708,7 @@ class ReturnStatement extends AstNode_2.Statement {
642
708
  (0, visitors_1.walk)(this, 'value', visitor, options);
643
709
  }
644
710
  }
645
- getLeadingTrivia() {
711
+ get leadingTrivia() {
646
712
  var _a, _b;
647
713
  return (_b = (_a = this.tokens.return) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
648
714
  }
@@ -656,7 +722,7 @@ class EndStatement extends AstNode_2.Statement {
656
722
  this.tokens = {
657
723
  end: options === null || options === void 0 ? void 0 : options.end
658
724
  };
659
- this.range = (_a = this.tokens.end) === null || _a === void 0 ? void 0 : _a.range;
725
+ this.location = (_a = this.tokens.end) === null || _a === void 0 ? void 0 : _a.location;
660
726
  }
661
727
  transpile(state) {
662
728
  return [
@@ -666,7 +732,7 @@ class EndStatement extends AstNode_2.Statement {
666
732
  walk(visitor, options) {
667
733
  //nothing to walk
668
734
  }
669
- getLeadingTrivia() {
735
+ get leadingTrivia() {
670
736
  var _a, _b;
671
737
  return (_b = (_a = this.tokens.end) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
672
738
  }
@@ -678,7 +744,7 @@ class StopStatement extends AstNode_2.Statement {
678
744
  super();
679
745
  this.kind = AstNode_1.AstNodeKind.StopStatement;
680
746
  this.tokens = { stop: options === null || options === void 0 ? void 0 : options.stop };
681
- this.range = (_b = (_a = this.tokens) === null || _a === void 0 ? void 0 : _a.stop) === null || _b === void 0 ? void 0 : _b.range;
747
+ this.location = (_b = (_a = this.tokens) === null || _a === void 0 ? void 0 : _a.stop) === null || _b === void 0 ? void 0 : _b.location;
682
748
  }
683
749
  transpile(state) {
684
750
  return [
@@ -688,7 +754,7 @@ class StopStatement extends AstNode_2.Statement {
688
754
  walk(visitor, options) {
689
755
  //nothing to walk
690
756
  }
691
- getLeadingTrivia() {
757
+ get leadingTrivia() {
692
758
  var _a, _b;
693
759
  return (_b = (_a = this.tokens.stop) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
694
760
  }
@@ -708,7 +774,7 @@ class ForStatement extends AstNode_2.Statement {
708
774
  this.finalValue = options.finalValue;
709
775
  this.body = options.body;
710
776
  this.increment = options.increment;
711
- this.range = util_1.util.createBoundingRange(this.tokens.for, this.counterDeclaration, this.tokens.to, this.finalValue, this.tokens.step, this.increment, this.body, this.tokens.endFor);
777
+ this.location = util_1.util.createBoundingLocation(this.tokens.for, this.counterDeclaration, this.tokens.to, this.finalValue, this.tokens.step, this.increment, this.body, this.tokens.endFor);
712
778
  }
713
779
  transpile(state) {
714
780
  let result = [];
@@ -744,11 +810,11 @@ class ForStatement extends AstNode_2.Statement {
744
810
  (0, visitors_1.walk)(this, 'body', visitor, options);
745
811
  }
746
812
  }
747
- getLeadingTrivia() {
813
+ get leadingTrivia() {
748
814
  var _a, _b;
749
815
  return (_b = (_a = this.tokens.for) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
750
816
  }
751
- getEndTrivia() {
817
+ get endTrivia() {
752
818
  var _a, _b;
753
819
  return (_b = (_a = this.tokens.endFor) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
754
820
  }
@@ -766,7 +832,7 @@ class ForEachStatement extends AstNode_2.Statement {
766
832
  };
767
833
  this.body = options.body;
768
834
  this.target = options.target;
769
- this.range = util_1.util.createBoundingRange(this.tokens.forEach, this.tokens.item, this.tokens.in, this.target, this.body, this.tokens.endFor);
835
+ this.location = util_1.util.createBoundingLocation(this.tokens.forEach, this.tokens.item, this.tokens.in, this.target, this.body, this.tokens.endFor);
770
836
  }
771
837
  transpile(state) {
772
838
  let result = [];
@@ -797,11 +863,11 @@ class ForEachStatement extends AstNode_2.Statement {
797
863
  getType(options) {
798
864
  return this.getSymbolTable().getSymbolType(this.tokens.item.text, options);
799
865
  }
800
- getLeadingTrivia() {
866
+ get leadingTrivia() {
801
867
  var _a, _b;
802
868
  return (_b = (_a = this.tokens.forEach) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
803
869
  }
804
- getEndTrivia() {
870
+ get endTrivia() {
805
871
  var _a, _b;
806
872
  return (_b = (_a = this.tokens.endFor) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
807
873
  }
@@ -817,7 +883,7 @@ class WhileStatement extends AstNode_2.Statement {
817
883
  };
818
884
  this.body = options.body;
819
885
  this.condition = options.condition;
820
- this.range = util_1.util.createBoundingRange(this.tokens.while, this.condition, this.body, this.tokens.endWhile);
886
+ this.location = util_1.util.createBoundingLocation(this.tokens.while, this.condition, this.body, this.tokens.endWhile);
821
887
  }
822
888
  transpile(state) {
823
889
  let result = [];
@@ -841,11 +907,11 @@ class WhileStatement extends AstNode_2.Statement {
841
907
  (0, visitors_1.walk)(this, 'body', visitor, options);
842
908
  }
843
909
  }
844
- getLeadingTrivia() {
910
+ get leadingTrivia() {
845
911
  var _a, _b;
846
912
  return (_b = (_a = this.tokens.while) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
847
913
  }
848
- getEndTrivia() {
914
+ get endTrivia() {
849
915
  var _a, _b;
850
916
  return (_b = (_a = this.tokens.endWhile) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
851
917
  }
@@ -862,7 +928,7 @@ class DottedSetStatement extends AstNode_2.Statement {
862
928
  };
863
929
  this.obj = options.obj;
864
930
  this.value = options.value;
865
- this.range = util_1.util.createBoundingRange(this.obj, this.tokens.dot, this.tokens.name, this.value);
931
+ this.location = util_1.util.createBoundingLocation(this.obj, this.tokens.dot, this.tokens.name, this.value);
866
932
  }
867
933
  transpile(state) {
868
934
  //if the value is a compound assignment, don't add the obj, dot, name, or operator...the expression will handle that
@@ -892,13 +958,13 @@ class DottedSetStatement extends AstNode_2.Statement {
892
958
  (_c = options.typeChain) === null || _c === void 0 ? void 0 : _c.push(new interfaces_1.TypeChainEntry({
893
959
  name: (_d = this.tokens.name) === null || _d === void 0 ? void 0 : _d.text,
894
960
  type: result, data: options.data,
895
- range: (_e = this.tokens.name) === null || _e === void 0 ? void 0 : _e.range,
961
+ location: (_e = this.tokens.name) === null || _e === void 0 ? void 0 : _e.location,
896
962
  astNode: this
897
963
  }));
898
964
  return result;
899
965
  }
900
- getLeadingTrivia() {
901
- return this.obj.getLeadingTrivia();
966
+ get leadingTrivia() {
967
+ return this.obj.leadingTrivia;
902
968
  }
903
969
  }
904
970
  exports.DottedSetStatement = DottedSetStatement;
@@ -914,7 +980,7 @@ class IndexedSetStatement extends AstNode_2.Statement {
914
980
  this.obj = options.obj;
915
981
  this.indexes = options.indexes;
916
982
  this.value = options.value;
917
- this.range = util_1.util.createBoundingRange(this.obj, this.tokens.openingSquare, ...this.indexes, this.tokens.closingSquare, this.value);
983
+ this.location = util_1.util.createBoundingLocation(this.obj, this.tokens.openingSquare, ...this.indexes, this.tokens.closingSquare, this.value);
918
984
  }
919
985
  transpile(state) {
920
986
  var _a;
@@ -942,8 +1008,8 @@ class IndexedSetStatement extends AstNode_2.Statement {
942
1008
  (0, visitors_1.walk)(this, 'value', visitor, options);
943
1009
  }
944
1010
  }
945
- getLeadingTrivia() {
946
- return this.obj.getLeadingTrivia();
1011
+ get leadingTrivia() {
1012
+ return this.obj.leadingTrivia;
947
1013
  }
948
1014
  }
949
1015
  exports.IndexedSetStatement = IndexedSetStatement;
@@ -955,7 +1021,7 @@ class LibraryStatement extends AstNode_2.Statement {
955
1021
  library: options.library,
956
1022
  filePath: options.filePath
957
1023
  };
958
- this.range = util_1.util.createBoundingRange(this.tokens.library, this.tokens.filePath);
1024
+ this.location = util_1.util.createBoundingLocation(this.tokens.library, this.tokens.filePath);
959
1025
  }
960
1026
  transpile(state) {
961
1027
  let result = [];
@@ -972,7 +1038,7 @@ class LibraryStatement extends AstNode_2.Statement {
972
1038
  walk(visitor, options) {
973
1039
  //nothing to walk
974
1040
  }
975
- getLeadingTrivia() {
1041
+ get leadingTrivia() {
976
1042
  var _a, _b;
977
1043
  return (_b = (_a = this.tokens.library) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
978
1044
  }
@@ -991,14 +1057,14 @@ class NamespaceStatement extends AstNode_2.Statement {
991
1057
  this.name = this.getName(Parser_1.ParseMode.BrighterScript);
992
1058
  this.symbolTable = new SymbolTable_1.SymbolTable(`NamespaceStatement: '${this.name}'`, () => { var _a; return (_a = this.parent) === null || _a === void 0 ? void 0 : _a.getSymbolTable(); });
993
1059
  }
994
- get range() {
995
- return this.cacheRange();
1060
+ get location() {
1061
+ return this.cacheLocation();
996
1062
  }
997
- cacheRange() {
998
- if (!this._range) {
999
- this._range = util_1.util.createBoundingRange(this.tokens.namespace, this.nameExpression, this.body, this.tokens.endNamespace);
1063
+ cacheLocation() {
1064
+ if (!this._location) {
1065
+ this._location = util_1.util.createBoundingLocation(this.tokens.namespace, this.nameExpression, this.body, this.tokens.endNamespace);
1000
1066
  }
1001
- return this._range;
1067
+ return this._location;
1002
1068
  }
1003
1069
  getName(parseMode) {
1004
1070
  var _a, _b;
@@ -1009,13 +1075,13 @@ class NamespaceStatement extends AstNode_2.Statement {
1009
1075
  }
1010
1076
  return name;
1011
1077
  }
1012
- getLeadingTrivia() {
1078
+ get leadingTrivia() {
1013
1079
  var _a;
1014
- return util_1.util.concatAnnotationLeadingTrivia(this, (_a = this.tokens.namespace) === null || _a === void 0 ? void 0 : _a.leadingTrivia);
1080
+ return (_a = this.tokens.namespace) === null || _a === void 0 ? void 0 : _a.leadingTrivia;
1015
1081
  }
1016
- getEndTrivia() {
1017
- var _a, _b;
1018
- return (_b = (_a = this.tokens.endNamespace) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
1082
+ get endTrivia() {
1083
+ var _a;
1084
+ return (_a = this.tokens.endNamespace) === null || _a === void 0 ? void 0 : _a.leadingTrivia;
1019
1085
  }
1020
1086
  getNameParts() {
1021
1087
  var _a, _b;
@@ -1062,20 +1128,20 @@ class NamespaceStatement extends AstNode_2.Statement {
1062
1128
  exports.NamespaceStatement = NamespaceStatement;
1063
1129
  class ImportStatement extends AstNode_2.Statement {
1064
1130
  constructor(options) {
1065
- var _a;
1131
+ var _a, _b;
1066
1132
  super();
1067
1133
  this.kind = AstNode_1.AstNodeKind.ImportStatement;
1068
1134
  this.tokens = {
1069
1135
  import: options.import,
1070
1136
  path: options.path
1071
1137
  };
1072
- this.range = util_1.util.createBoundingRange(this.tokens.import, this.tokens.path);
1138
+ this.location = util_1.util.createBoundingLocation(this.tokens.import, this.tokens.path);
1073
1139
  if (this.tokens.path) {
1074
1140
  //remove quotes
1075
1141
  this.filePath = this.tokens.path.text.replace(/"/g, '');
1076
- if ((_a = this.tokens.path) === null || _a === void 0 ? void 0 : _a.range) {
1142
+ if ((_b = (_a = this.tokens.path) === null || _a === void 0 ? void 0 : _a.location) === null || _b === void 0 ? void 0 : _b.range) {
1077
1143
  //adjust the range to exclude the quotes
1078
- this.tokens.path.range = util_1.util.createRange(this.tokens.path.range.start.line, this.tokens.path.range.start.character + 1, this.tokens.path.range.end.line, this.tokens.path.range.end.character - 1);
1144
+ this.tokens.path.location = util_1.util.createLocation(this.tokens.path.location.range.start.line, this.tokens.path.location.range.start.character + 1, this.tokens.path.location.range.end.line, this.tokens.path.location.range.end.character - 1, this.tokens.path.location.uri);
1079
1145
  }
1080
1146
  }
1081
1147
  }
@@ -1103,7 +1169,7 @@ class ImportStatement extends AstNode_2.Statement {
1103
1169
  walk(visitor, options) {
1104
1170
  //nothing to walk
1105
1171
  }
1106
- getLeadingTrivia() {
1172
+ get leadingTrivia() {
1107
1173
  var _a, _b;
1108
1174
  return (_b = (_a = this.tokens.import) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
1109
1175
  }
@@ -1122,7 +1188,7 @@ class InterfaceStatement extends AstNode_2.Statement {
1122
1188
  };
1123
1189
  this.parentInterfaceName = options.parentInterfaceName;
1124
1190
  this.body = options.body;
1125
- this.range = util_1.util.createBoundingRange(this.tokens.interface, this.tokens.name, this.tokens.extends, this.parentInterfaceName, ...this.body, this.tokens.endInterface);
1191
+ this.location = util_1.util.createBoundingLocation(this.tokens.interface, this.tokens.name, this.tokens.extends, this.parentInterfaceName, ...this.body, this.tokens.endInterface);
1126
1192
  }
1127
1193
  get fields() {
1128
1194
  return this.body.filter(x => (0, reflection_1.isInterfaceFieldStatement)(x));
@@ -1133,13 +1199,13 @@ class InterfaceStatement extends AstNode_2.Statement {
1133
1199
  hasParentInterface() {
1134
1200
  return !!this.parentInterfaceName;
1135
1201
  }
1136
- getLeadingTrivia() {
1202
+ get leadingTrivia() {
1137
1203
  var _a;
1138
- return util_1.util.concatAnnotationLeadingTrivia(this, (_a = this.tokens.interface) === null || _a === void 0 ? void 0 : _a.leadingTrivia);
1204
+ return (_a = this.tokens.interface) === null || _a === void 0 ? void 0 : _a.leadingTrivia;
1139
1205
  }
1140
- getEndTrivia() {
1141
- var _a, _b;
1142
- return (_b = (_a = this.tokens.endInterface) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
1206
+ get endTrivia() {
1207
+ var _a;
1208
+ return (_a = this.tokens.endInterface) === null || _a === void 0 ? void 0 : _a.leadingTrivia;
1143
1209
  }
1144
1210
  /**
1145
1211
  * The name of the interface WITH its leading namespace (if applicable)
@@ -1262,14 +1328,14 @@ class InterfaceFieldStatement extends AstNode_2.Statement {
1262
1328
  as: options.as
1263
1329
  };
1264
1330
  this.typeExpression = options.typeExpression;
1265
- this.range = util_1.util.createBoundingRange(this.tokens.optional, this.tokens.name, this.tokens.as, this.typeExpression);
1331
+ this.location = util_1.util.createBoundingLocation(this.tokens.optional, this.tokens.name, this.tokens.as, this.typeExpression);
1266
1332
  }
1267
1333
  transpile(state) {
1268
1334
  throw new Error('Method not implemented.');
1269
1335
  }
1270
- getLeadingTrivia() {
1336
+ get leadingTrivia() {
1271
1337
  var _a, _b;
1272
- return util_1.util.concatAnnotationLeadingTrivia(this, (_b = (_a = this.tokens.optional) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : this.tokens.name.leadingTrivia);
1338
+ return (_b = (_a = this.tokens.optional) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : this.tokens.name.leadingTrivia;
1273
1339
  }
1274
1340
  get name() {
1275
1341
  return this.tokens.name.text;
@@ -1327,9 +1393,9 @@ class InterfaceMethodStatement extends AstNode_2.Statement {
1327
1393
  transpile(state) {
1328
1394
  throw new Error('Method not implemented.');
1329
1395
  }
1330
- get range() {
1396
+ get location() {
1331
1397
  var _a;
1332
- return util_1.util.createBoundingRange(this.tokens.optional, this.tokens.functionType, this.tokens.name, this.tokens.leftParen, ...((_a = this.params) !== null && _a !== void 0 ? _a : []), this.tokens.rightParen, this.tokens.as, this.returnTypeExpression);
1398
+ return util_1.util.createBoundingLocation(this.tokens.optional, this.tokens.functionType, this.tokens.name, this.tokens.leftParen, ...((_a = this.params) !== null && _a !== void 0 ? _a : []), this.tokens.rightParen, this.tokens.as, this.returnTypeExpression);
1333
1399
  }
1334
1400
  /**
1335
1401
  * Get the name of this method.
@@ -1340,9 +1406,9 @@ class InterfaceMethodStatement extends AstNode_2.Statement {
1340
1406
  get isOptional() {
1341
1407
  return !!this.tokens.optional;
1342
1408
  }
1343
- getLeadingTrivia() {
1409
+ get leadingTrivia() {
1344
1410
  var _a, _b;
1345
- return util_1.util.concatAnnotationLeadingTrivia(this, (_b = (_a = this.tokens.optional) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : this.tokens.functionType.leadingTrivia);
1411
+ return (_b = (_a = this.tokens.optional) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : this.tokens.functionType.leadingTrivia;
1346
1412
  }
1347
1413
  walk(visitor, options) {
1348
1414
  if (options.walkMode & visitors_1.InternalWalkMode.walkExpressions) {
@@ -1431,7 +1497,7 @@ class ClassStatement extends AstNode_2.Statement {
1431
1497
  this.memberMap[(_d = statement === null || statement === void 0 ? void 0 : statement.tokens.name) === null || _d === void 0 ? void 0 : _d.text.toLowerCase()] = statement;
1432
1498
  }
1433
1499
  }
1434
- this.range = util_1.util.createBoundingRange(this.parentClassName, ...((_e = this.body) !== null && _e !== void 0 ? _e : []), util_1.util.createBoundingRangeFromTokens(this.tokens));
1500
+ this.location = util_1.util.createBoundingLocation(this.parentClassName, ...((_e = this.body) !== null && _e !== void 0 ? _e : []), util_1.util.createBoundingLocationFromTokens(this.tokens));
1435
1501
  }
1436
1502
  getName(parseMode) {
1437
1503
  var _a;
@@ -1452,11 +1518,11 @@ class ClassStatement extends AstNode_2.Statement {
1452
1518
  return undefined;
1453
1519
  }
1454
1520
  }
1455
- getLeadingTrivia() {
1521
+ get leadingTrivia() {
1456
1522
  var _a;
1457
- return util_1.util.concatAnnotationLeadingTrivia(this, (_a = this.tokens.class) === null || _a === void 0 ? void 0 : _a.leadingTrivia);
1523
+ return (_a = this.tokens.class) === null || _a === void 0 ? void 0 : _a.leadingTrivia;
1458
1524
  }
1459
- getEndTrivia() {
1525
+ get endTrivia() {
1460
1526
  var _a, _b;
1461
1527
  return (_b = (_a = this.tokens.endClass) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
1462
1528
  }
@@ -1759,7 +1825,7 @@ class MethodStatement extends FunctionStatement {
1759
1825
  }
1760
1826
  }
1761
1827
  this.tokens = Object.assign(Object.assign({}, this.tokens), { override: options.override });
1762
- this.range = util_1.util.createBoundingRange(...(this.modifiers), util_1.util.createBoundingRangeFromTokens(this.tokens), this.func);
1828
+ this.location = util_1.util.createBoundingLocation(...(this.modifiers), util_1.util.createBoundingLocationFromTokens(this.tokens), this.func);
1763
1829
  }
1764
1830
  get accessModifier() {
1765
1831
  return this.modifiers.find(x => accessModifiers.includes(x.kind));
@@ -1770,8 +1836,8 @@ class MethodStatement extends FunctionStatement {
1770
1836
  getName(parseMode) {
1771
1837
  return this.tokens.name.text;
1772
1838
  }
1773
- getLeadingTrivia() {
1774
- return util_1.util.concatAnnotationLeadingTrivia(this, this.func.getLeadingTrivia());
1839
+ get leadingTrivia() {
1840
+ return this.func.leadingTrivia;
1775
1841
  }
1776
1842
  transpile(state) {
1777
1843
  if (this.tokens.name.text.toLowerCase() === 'new') {
@@ -1851,7 +1917,7 @@ class MethodStatement extends FunctionStatement {
1851
1917
  kind: TokenKind_1.TokenKind.Identifier,
1852
1918
  text: 'super',
1853
1919
  isReserved: false,
1854
- range: state.classStatement.tokens.name.range,
1920
+ location: state.classStatement.tokens.name.location,
1855
1921
  leadingWhitespace: '',
1856
1922
  leadingTrivia: []
1857
1923
  }
@@ -1860,7 +1926,7 @@ class MethodStatement extends FunctionStatement {
1860
1926
  kind: TokenKind_1.TokenKind.LeftParen,
1861
1927
  text: '(',
1862
1928
  isReserved: false,
1863
- range: state.classStatement.tokens.name.range,
1929
+ location: state.classStatement.tokens.name.location,
1864
1930
  leadingWhitespace: '',
1865
1931
  leadingTrivia: []
1866
1932
  },
@@ -1868,7 +1934,7 @@ class MethodStatement extends FunctionStatement {
1868
1934
  kind: TokenKind_1.TokenKind.RightParen,
1869
1935
  text: ')',
1870
1936
  isReserved: false,
1871
- range: state.classStatement.tokens.name.range,
1937
+ location: state.classStatement.tokens.name.location,
1872
1938
  leadingWhitespace: '',
1873
1939
  leadingTrivia: []
1874
1940
  },
@@ -1895,10 +1961,10 @@ class MethodStatement extends FunctionStatement {
1895
1961
  value: field.initialValue
1896
1962
  })
1897
1963
  : new AssignmentStatement({
1898
- equals: (0, creators_1.createToken)(TokenKind_1.TokenKind.Equal, '=', field.tokens.name.range),
1964
+ equals: (0, creators_1.createToken)(TokenKind_1.TokenKind.Equal, '=', field.tokens.name.location),
1899
1965
  name: thisQualifiedName,
1900
1966
  //if there is no initial value, set the initial value to `invalid`
1901
- value: (0, creators_1.createInvalidLiteral)('invalid', field.tokens.name.range)
1967
+ value: (0, creators_1.createInvalidLiteral)('invalid', field.tokens.name.location)
1902
1968
  });
1903
1969
  // Add parent so namespace lookups work
1904
1970
  fieldAssignment.parent = state.classStatement;
@@ -1926,7 +1992,7 @@ class FieldStatement extends AstNode_2.Statement {
1926
1992
  };
1927
1993
  this.typeExpression = options.typeExpression;
1928
1994
  this.initialValue = options.initialValue;
1929
- this.range = util_1.util.createBoundingRange(util_1.util.createBoundingRangeFromTokens(this.tokens), this.typeExpression, this.initialValue);
1995
+ this.location = util_1.util.createBoundingLocation(util_1.util.createBoundingLocationFromTokens(this.tokens), this.typeExpression, this.initialValue);
1930
1996
  }
1931
1997
  /**
1932
1998
  * Derive a ValueKind from the type token, or the initial value.
@@ -1936,9 +2002,9 @@ class FieldStatement extends AstNode_2.Statement {
1936
2002
  var _a, _b, _c, _d;
1937
2003
  return (_d = (_b = (_a = this.typeExpression) === null || _a === void 0 ? void 0 : _a.getType(Object.assign(Object.assign({}, options), { flags: 2 /* SymbolTypeFlag.typetime */ }))) !== null && _b !== void 0 ? _b : (_c = this.initialValue) === null || _c === void 0 ? void 0 : _c.getType(Object.assign(Object.assign({}, options), { flags: 1 /* SymbolTypeFlag.runtime */ }))) !== null && _d !== void 0 ? _d : DynamicType_1.DynamicType.instance;
1938
2004
  }
1939
- getLeadingTrivia() {
1940
- var _a, _b, _c, _d, _e, _f;
1941
- return util_1.util.concatAnnotationLeadingTrivia(this, (_f = (_d = (_b = (_a = this.tokens.accessModifier) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : (_c = this.tokens.optional) === null || _c === void 0 ? void 0 : _c.leadingTrivia) !== null && _d !== void 0 ? _d : (_e = this.tokens.name) === null || _e === void 0 ? void 0 : _e.leadingTrivia) !== null && _f !== void 0 ? _f : []);
2005
+ get leadingTrivia() {
2006
+ var _a, _b, _c, _d;
2007
+ return (_d = (_b = (_a = this.tokens.accessModifier) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : (_c = this.tokens.optional) === null || _c === void 0 ? void 0 : _c.leadingTrivia) !== null && _d !== void 0 ? _d : this.tokens.name.leadingTrivia;
1942
2008
  }
1943
2009
  get isOptional() {
1944
2010
  return !!this.tokens.optional;
@@ -1986,7 +2052,7 @@ class TryCatchStatement extends AstNode_2.Statement {
1986
2052
  };
1987
2053
  this.tryBranch = options.tryBranch;
1988
2054
  this.catchStatement = options.catchStatement;
1989
- this.range = util_1.util.createBoundingRange(this.tokens.try, this.tryBranch, this.catchStatement, this.tokens.endTry);
2055
+ this.location = util_1.util.createBoundingLocation(this.tokens.try, this.tryBranch, this.catchStatement, this.tokens.endTry);
1990
2056
  }
1991
2057
  transpile(state) {
1992
2058
  var _a, _b;
@@ -2007,11 +2073,11 @@ class TryCatchStatement extends AstNode_2.Statement {
2007
2073
  (0, visitors_1.walk)(this, 'catchStatement', visitor, options);
2008
2074
  }
2009
2075
  }
2010
- getLeadingTrivia() {
2076
+ get leadingTrivia() {
2011
2077
  var _a, _b;
2012
2078
  return (_b = (_a = this.tokens.try) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
2013
2079
  }
2014
- getEndTrivia() {
2080
+ get endTrivia() {
2015
2081
  var _a, _b;
2016
2082
  return (_b = (_a = this.tokens.endTry) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
2017
2083
  }
@@ -2026,7 +2092,7 @@ class CatchStatement extends AstNode_2.Statement {
2026
2092
  exceptionVariable: options === null || options === void 0 ? void 0 : options.exceptionVariable
2027
2093
  };
2028
2094
  this.catchBranch = options === null || options === void 0 ? void 0 : options.catchBranch;
2029
- this.range = util_1.util.createBoundingRange(this.tokens.catch, this.tokens.exceptionVariable, this.catchBranch);
2095
+ this.location = util_1.util.createBoundingLocation(this.tokens.catch, this.tokens.exceptionVariable, this.catchBranch);
2030
2096
  }
2031
2097
  transpile(state) {
2032
2098
  var _a, _b, _c, _d;
@@ -2042,7 +2108,7 @@ class CatchStatement extends AstNode_2.Statement {
2042
2108
  (0, visitors_1.walk)(this, 'catchBranch', visitor, options);
2043
2109
  }
2044
2110
  }
2045
- getLeadingTrivia() {
2111
+ get leadingTrivia() {
2046
2112
  var _a, _b;
2047
2113
  return (_b = (_a = this.tokens.catch) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
2048
2114
  }
@@ -2056,7 +2122,7 @@ class ThrowStatement extends AstNode_2.Statement {
2056
2122
  throw: options.throw
2057
2123
  };
2058
2124
  this.expression = options.expression;
2059
- this.range = util_1.util.createBoundingRange(this.tokens.throw, this.expression);
2125
+ this.location = util_1.util.createBoundingLocation(this.tokens.throw, this.expression);
2060
2126
  }
2061
2127
  transpile(state) {
2062
2128
  const result = [
@@ -2078,7 +2144,7 @@ class ThrowStatement extends AstNode_2.Statement {
2078
2144
  (0, visitors_1.walk)(this, 'expression', visitor, options);
2079
2145
  }
2080
2146
  }
2081
- getLeadingTrivia() {
2147
+ get leadingTrivia() {
2082
2148
  var _a, _b;
2083
2149
  return (_b = (_a = this.tokens.throw) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
2084
2150
  }
@@ -2097,8 +2163,8 @@ class EnumStatement extends AstNode_2.Statement {
2097
2163
  this.symbolTable = new SymbolTable_1.SymbolTable('Enum');
2098
2164
  this.body = (_a = options.body) !== null && _a !== void 0 ? _a : [];
2099
2165
  }
2100
- get range() {
2101
- return util_1.util.createBoundingRange(this.tokens.enum, this.tokens.name, ...this.body, this.tokens.endEnum);
2166
+ get location() {
2167
+ return util_1.util.createBoundingLocation(this.tokens.enum, this.tokens.name, ...this.body, this.tokens.endEnum);
2102
2168
  }
2103
2169
  getMembers() {
2104
2170
  const result = [];
@@ -2109,11 +2175,11 @@ class EnumStatement extends AstNode_2.Statement {
2109
2175
  }
2110
2176
  return result;
2111
2177
  }
2112
- getLeadingTrivia() {
2178
+ get leadingTrivia() {
2113
2179
  var _a;
2114
- return util_1.util.concatAnnotationLeadingTrivia(this, (_a = this.tokens.enum) === null || _a === void 0 ? void 0 : _a.leadingTrivia);
2180
+ return (_a = this.tokens.enum) === null || _a === void 0 ? void 0 : _a.leadingTrivia;
2115
2181
  }
2116
- getEndTrivia() {
2182
+ get endTrivia() {
2117
2183
  var _a, _b;
2118
2184
  return (_b = (_a = this.tokens.endEnum) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
2119
2185
  }
@@ -2238,8 +2304,8 @@ class EnumMemberStatement extends AstNode_2.Statement {
2238
2304
  };
2239
2305
  this.value = options.value;
2240
2306
  }
2241
- get range() {
2242
- return util_1.util.createBoundingRange(this.tokens.name, this.tokens.equals, this.value);
2307
+ get location() {
2308
+ return util_1.util.createBoundingLocation(this.tokens.name, this.tokens.equals, this.value);
2243
2309
  }
2244
2310
  /**
2245
2311
  * The name of the member
@@ -2247,8 +2313,8 @@ class EnumMemberStatement extends AstNode_2.Statement {
2247
2313
  get name() {
2248
2314
  return this.tokens.name.text;
2249
2315
  }
2250
- getLeadingTrivia() {
2251
- return util_1.util.concatAnnotationLeadingTrivia(this, this.tokens.name.leadingTrivia);
2316
+ get leadingTrivia() {
2317
+ return this.tokens.name.leadingTrivia;
2252
2318
  }
2253
2319
  transpile(state) {
2254
2320
  return [];
@@ -2289,14 +2355,14 @@ class ConstStatement extends AstNode_2.Statement {
2289
2355
  equals: options.equals
2290
2356
  };
2291
2357
  this.value = options.value;
2292
- this.range = util_1.util.createBoundingRange(this.tokens.const, this.tokens.name, this.tokens.equals, this.value);
2358
+ this.location = util_1.util.createBoundingLocation(this.tokens.const, this.tokens.name, this.tokens.equals, this.value);
2293
2359
  }
2294
2360
  get name() {
2295
2361
  return this.tokens.name.text;
2296
2362
  }
2297
- getLeadingTrivia() {
2363
+ get leadingTrivia() {
2298
2364
  var _a;
2299
- return util_1.util.concatAnnotationLeadingTrivia(this, (_a = this.tokens.const) === null || _a === void 0 ? void 0 : _a.leadingTrivia);
2365
+ return (_a = this.tokens.const) === null || _a === void 0 ? void 0 : _a.leadingTrivia;
2300
2366
  }
2301
2367
  /**
2302
2368
  * The name of the statement WITH its leading namespace (if applicable)
@@ -2350,7 +2416,7 @@ class ContinueStatement extends AstNode_2.Statement {
2350
2416
  continue: options.continue,
2351
2417
  loopType: options.loopType
2352
2418
  };
2353
- this.range = util_1.util.createBoundingRange(this.tokens.continue, this.tokens.loopType);
2419
+ this.location = util_1.util.createBoundingLocation(this.tokens.continue, this.tokens.loopType);
2354
2420
  }
2355
2421
  transpile(state) {
2356
2422
  var _a, _b, _c, _d, _e;
@@ -2363,7 +2429,7 @@ class ContinueStatement extends AstNode_2.Statement {
2363
2429
  walk(visitor, options) {
2364
2430
  //nothing to walk
2365
2431
  }
2366
- getLeadingTrivia() {
2432
+ get leadingTrivia() {
2367
2433
  var _a, _b;
2368
2434
  return (_b = (_a = this.tokens.continue) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
2369
2435
  }
@@ -2377,7 +2443,7 @@ class TypecastStatement extends AstNode_2.Statement {
2377
2443
  typecast: options.typecast
2378
2444
  };
2379
2445
  this.typecastExpression = options.typecastExpression;
2380
- this.range = util_1.util.createBoundingRange(this.tokens.typecast, this.typecastExpression);
2446
+ this.location = util_1.util.createBoundingLocation(this.tokens.typecast, this.typecastExpression);
2381
2447
  }
2382
2448
  transpile(state) {
2383
2449
  //the typecast statement is a comment just for debugging purposes
@@ -2396,7 +2462,7 @@ class TypecastStatement extends AstNode_2.Statement {
2396
2462
  (0, visitors_1.walk)(this, 'typecastExpression', visitor, options);
2397
2463
  }
2398
2464
  }
2399
- getLeadingTrivia() {
2465
+ get leadingTrivia() {
2400
2466
  var _a, _b;
2401
2467
  return (_b = (_a = this.tokens.typecast) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
2402
2468
  }
@@ -2413,7 +2479,7 @@ class ConditionalCompileErrorStatement extends AstNode_2.Statement {
2413
2479
  hashError: options.hashError,
2414
2480
  message: options.message
2415
2481
  };
2416
- this.range = util_1.util.createBoundingRange(util_1.util.createBoundingRangeFromTokens(this.tokens));
2482
+ this.location = util_1.util.createBoundingLocation(util_1.util.createBoundingLocationFromTokens(this.tokens));
2417
2483
  }
2418
2484
  transpile(state) {
2419
2485
  return [
@@ -2425,7 +2491,7 @@ class ConditionalCompileErrorStatement extends AstNode_2.Statement {
2425
2491
  walk(visitor, options) {
2426
2492
  // nothing to walk
2427
2493
  }
2428
- getLeadingTrivia() {
2494
+ get leadingTrivia() {
2429
2495
  var _a;
2430
2496
  return (_a = this.tokens.hashError.leadingTrivia) !== null && _a !== void 0 ? _a : [];
2431
2497
  }
@@ -2441,7 +2507,7 @@ class AliasStatement extends AstNode_2.Statement {
2441
2507
  equals: options.equals
2442
2508
  };
2443
2509
  this.value = options.value;
2444
- this.range = util_1.util.createBoundingRange(this.tokens.alias, this.tokens.name, this.tokens.equals, this.value);
2510
+ this.location = util_1.util.createBoundingLocation(this.tokens.alias, this.tokens.name, this.tokens.equals, this.value);
2445
2511
  }
2446
2512
  transpile(state) {
2447
2513
  //the alias statement is a comment just for debugging purposes
@@ -2460,7 +2526,7 @@ class AliasStatement extends AstNode_2.Statement {
2460
2526
  (0, visitors_1.walk)(this, 'value', visitor, options);
2461
2527
  }
2462
2528
  }
2463
- getLeadingTrivia() {
2529
+ get leadingTrivia() {
2464
2530
  var _a, _b;
2465
2531
  return (_b = (_a = this.tokens.alias) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
2466
2532
  }
@@ -2482,7 +2548,7 @@ class ConditionalCompileStatement extends AstNode_2.Statement {
2482
2548
  hashElse: options.hashElse,
2483
2549
  hashEndIf: options.hashEndIf
2484
2550
  };
2485
- this.range = util_1.util.createBoundingRange(util_1.util.createBoundingRangeFromTokens(this.tokens), this.thenBranch, this.elseBranch);
2551
+ this.location = util_1.util.createBoundingLocation(util_1.util.createBoundingLocationFromTokens(this.tokens), this.thenBranch, this.elseBranch);
2486
2552
  }
2487
2553
  transpile(state) {
2488
2554
  var _a, _b, _c;
@@ -2563,7 +2629,7 @@ class ConditionalCompileStatement extends AstNode_2.Statement {
2563
2629
  }
2564
2630
  }
2565
2631
  }
2566
- getLeadingTrivia() {
2632
+ get leadingTrivia() {
2567
2633
  var _a, _b;
2568
2634
  return (_b = (_a = this.tokens.hashIf) === null || _a === void 0 ? void 0 : _a.leadingTrivia) !== null && _b !== void 0 ? _b : [];
2569
2635
  }
@@ -2577,7 +2643,7 @@ class ConditionalCompileConstStatement extends AstNode_2.Statement {
2577
2643
  hashConst: options.hashConst
2578
2644
  };
2579
2645
  this.assignment = options.assignment;
2580
- this.range = util_1.util.createBoundingRange(util_1.util.createBoundingRangeFromTokens(this.tokens), this.assignment);
2646
+ this.location = util_1.util.createBoundingLocation(util_1.util.createBoundingLocationFromTokens(this.tokens), this.assignment);
2581
2647
  }
2582
2648
  transpile(state) {
2583
2649
  return [
@@ -2593,7 +2659,7 @@ class ConditionalCompileConstStatement extends AstNode_2.Statement {
2593
2659
  walk(visitor, options) {
2594
2660
  // nothing to walk
2595
2661
  }
2596
- getLeadingTrivia() {
2662
+ get leadingTrivia() {
2597
2663
  var _a;
2598
2664
  return (_a = this.tokens.hashConst.leadingTrivia) !== null && _a !== void 0 ? _a : [];
2599
2665
  }