brighterscript 0.59.0 → 0.60.1

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 (223) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +8 -4
  3. package/dist/CommentFlagProcessor.d.ts +1 -1
  4. package/dist/CommentFlagProcessor.js +1 -1
  5. package/dist/DependencyGraph.d.ts +3 -2
  6. package/dist/DependencyGraph.js +3 -2
  7. package/dist/DependencyGraph.js.map +1 -1
  8. package/dist/DiagnosticFilterer.js +1 -2
  9. package/dist/DiagnosticFilterer.js.map +1 -1
  10. package/dist/DiagnosticMessages.d.ts +6 -1
  11. package/dist/DiagnosticMessages.js +6 -1
  12. package/dist/DiagnosticMessages.js.map +1 -1
  13. package/dist/FunctionScope.d.ts +1 -1
  14. package/dist/FunctionScope.js +1 -1
  15. package/dist/KeyedThrottler.d.ts +3 -3
  16. package/dist/KeyedThrottler.js +3 -3
  17. package/dist/KeyedThrottler.js.map +1 -1
  18. package/dist/LanguageServer.d.ts +0 -7
  19. package/dist/LanguageServer.js +0 -7
  20. package/dist/LanguageServer.js.map +1 -1
  21. package/dist/Program.d.ts +5 -7
  22. package/dist/Program.js +11 -213
  23. package/dist/Program.js.map +1 -1
  24. package/dist/ProgramBuilder.d.ts +0 -1
  25. package/dist/ProgramBuilder.js +0 -1
  26. package/dist/ProgramBuilder.js.map +1 -1
  27. package/dist/Scope.d.ts +31 -33
  28. package/dist/Scope.js +47 -33
  29. package/dist/Scope.js.map +1 -1
  30. package/dist/SymbolTable.d.ts +0 -3
  31. package/dist/SymbolTable.js +0 -3
  32. package/dist/SymbolTable.js.map +1 -1
  33. package/dist/Watcher.d.ts +0 -3
  34. package/dist/Watcher.js +0 -3
  35. package/dist/Watcher.js.map +1 -1
  36. package/dist/astUtils/AstEditor.d.ts +1 -1
  37. package/dist/astUtils/AstEditor.js +1 -1
  38. package/dist/astUtils/AstEditor.spec.js +58 -58
  39. package/dist/astUtils/AstEditor.spec.js.map +1 -1
  40. package/dist/astUtils/creators.spec.js +5 -5
  41. package/dist/astUtils/creators.spec.js.map +1 -1
  42. package/dist/astUtils/reflection.spec.js +112 -112
  43. package/dist/astUtils/reflection.spec.js.map +1 -1
  44. package/dist/astUtils/stackedVisitor.spec.js +12 -12
  45. package/dist/astUtils/stackedVisitor.spec.js.map +1 -1
  46. package/dist/astUtils/visitors.d.ts +4 -0
  47. package/dist/astUtils/visitors.js +4 -0
  48. package/dist/astUtils/visitors.js.map +1 -1
  49. package/dist/astUtils/visitors.spec.js +21 -21
  50. package/dist/astUtils/visitors.spec.js.map +1 -1
  51. package/dist/bscPlugin/CallExpressionInfo.d.ts +35 -0
  52. package/dist/bscPlugin/CallExpressionInfo.js +131 -0
  53. package/dist/bscPlugin/CallExpressionInfo.js.map +1 -0
  54. package/dist/bscPlugin/SignatureHelpUtil.d.ts +10 -0
  55. package/dist/bscPlugin/SignatureHelpUtil.js +135 -0
  56. package/dist/bscPlugin/SignatureHelpUtil.js.map +1 -0
  57. package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js +7 -7
  58. package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js.map +1 -1
  59. package/dist/bscPlugin/hover/HoverProcessor.spec.js +27 -27
  60. package/dist/bscPlugin/hover/HoverProcessor.spec.js.map +1 -1
  61. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js +2 -2
  62. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js.map +1 -1
  63. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js +1 -2
  64. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js.map +1 -1
  65. package/dist/bscPlugin/validation/BrsFileValidator.d.ts +1 -0
  66. package/dist/bscPlugin/validation/BrsFileValidator.js +11 -0
  67. package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -1
  68. package/dist/bscPlugin/validation/BrsFileValidator.spec.js +39 -9
  69. package/dist/bscPlugin/validation/BrsFileValidator.spec.js.map +1 -1
  70. package/dist/files/BrsFile.Class.spec.js +11 -11
  71. package/dist/files/BrsFile.Class.spec.js.map +1 -1
  72. package/dist/files/BrsFile.d.ts +8 -20
  73. package/dist/files/BrsFile.js +16 -97
  74. package/dist/files/BrsFile.js.map +1 -1
  75. package/dist/files/BrsFile.spec.js +245 -187
  76. package/dist/files/BrsFile.spec.js.map +1 -1
  77. package/dist/files/XmlFile.d.ts +1 -4
  78. package/dist/files/XmlFile.js +1 -4
  79. package/dist/files/XmlFile.js.map +1 -1
  80. package/dist/files/XmlFile.spec.js +82 -82
  81. package/dist/files/XmlFile.spec.js.map +1 -1
  82. package/dist/files/tests/imports.spec.js +7 -7
  83. package/dist/files/tests/imports.spec.js.map +1 -1
  84. package/dist/lexer/Character.spec.js +5 -5
  85. package/dist/lexer/Character.spec.js.map +1 -1
  86. package/dist/lexer/Lexer.d.ts +0 -5
  87. package/dist/lexer/Lexer.js +0 -5
  88. package/dist/lexer/Lexer.js.map +1 -1
  89. package/dist/lexer/Lexer.spec.js +136 -136
  90. package/dist/lexer/Lexer.spec.js.map +1 -1
  91. package/dist/parser/AstNode.d.ts +1 -1
  92. package/dist/parser/AstNode.spec.js +3 -3
  93. package/dist/parser/AstNode.spec.js.map +1 -1
  94. package/dist/parser/Expression.js.map +1 -1
  95. package/dist/parser/Parser.Class.spec.js +60 -60
  96. package/dist/parser/Parser.Class.spec.js.map +1 -1
  97. package/dist/parser/Parser.d.ts +4 -4
  98. package/dist/parser/Parser.js +5 -8
  99. package/dist/parser/Parser.js.map +1 -1
  100. package/dist/parser/Parser.spec.js +229 -221
  101. package/dist/parser/Parser.spec.js.map +1 -1
  102. package/dist/parser/SGParser.spec.js +14 -14
  103. package/dist/parser/SGParser.spec.js.map +1 -1
  104. package/dist/parser/Statement.d.ts +3 -2
  105. package/dist/parser/Statement.js +12 -5
  106. package/dist/parser/Statement.js.map +1 -1
  107. package/dist/parser/Statement.spec.js +29 -11
  108. package/dist/parser/Statement.spec.js.map +1 -1
  109. package/dist/parser/tests/controlFlow/For.spec.js +15 -15
  110. package/dist/parser/tests/controlFlow/For.spec.js.map +1 -1
  111. package/dist/parser/tests/controlFlow/ForEach.spec.js +13 -13
  112. package/dist/parser/tests/controlFlow/ForEach.spec.js.map +1 -1
  113. package/dist/parser/tests/controlFlow/If.spec.js +93 -93
  114. package/dist/parser/tests/controlFlow/If.spec.js.map +1 -1
  115. package/dist/parser/tests/controlFlow/While.spec.js +12 -12
  116. package/dist/parser/tests/controlFlow/While.spec.js.map +1 -1
  117. package/dist/parser/tests/expression/Additive.spec.js +8 -8
  118. package/dist/parser/tests/expression/Additive.spec.js.map +1 -1
  119. package/dist/parser/tests/expression/ArrayLiterals.spec.js +26 -26
  120. package/dist/parser/tests/expression/ArrayLiterals.spec.js.map +1 -1
  121. package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js +27 -27
  122. package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js.map +1 -1
  123. package/dist/parser/tests/expression/Boolean.spec.js +8 -8
  124. package/dist/parser/tests/expression/Boolean.spec.js.map +1 -1
  125. package/dist/parser/tests/expression/Call.spec.js +45 -45
  126. package/dist/parser/tests/expression/Call.spec.js.map +1 -1
  127. package/dist/parser/tests/expression/Exponential.spec.js +5 -5
  128. package/dist/parser/tests/expression/Exponential.spec.js.map +1 -1
  129. package/dist/parser/tests/expression/Function.spec.js +36 -36
  130. package/dist/parser/tests/expression/Function.spec.js.map +1 -1
  131. package/dist/parser/tests/expression/Indexing.spec.js +29 -29
  132. package/dist/parser/tests/expression/Indexing.spec.js.map +1 -1
  133. package/dist/parser/tests/expression/Multiplicative.spec.js +9 -9
  134. package/dist/parser/tests/expression/Multiplicative.spec.js.map +1 -1
  135. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +34 -34
  136. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +1 -1
  137. package/dist/parser/tests/expression/PrefixUnary.spec.js +12 -12
  138. package/dist/parser/tests/expression/PrefixUnary.spec.js.map +1 -1
  139. package/dist/parser/tests/expression/Primary.spec.js +12 -12
  140. package/dist/parser/tests/expression/Primary.spec.js.map +1 -1
  141. package/dist/parser/tests/expression/Relational.spec.js +13 -13
  142. package/dist/parser/tests/expression/Relational.spec.js.map +1 -1
  143. package/dist/parser/tests/expression/TemplateStringExpression.spec.js +10 -10
  144. package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +1 -1
  145. package/dist/parser/tests/expression/TernaryExpression.spec.js +53 -53
  146. package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
  147. package/dist/parser/tests/statement/AssignmentOperators.spec.js +15 -15
  148. package/dist/parser/tests/statement/AssignmentOperators.spec.js.map +1 -1
  149. package/dist/parser/tests/statement/ConstStatement.spec.js +6 -6
  150. package/dist/parser/tests/statement/ConstStatement.spec.js.map +1 -1
  151. package/dist/parser/tests/statement/Continue.spec.js +4 -4
  152. package/dist/parser/tests/statement/Continue.spec.js.map +1 -1
  153. package/dist/parser/tests/statement/Declaration.spec.js +19 -19
  154. package/dist/parser/tests/statement/Declaration.spec.js.map +1 -1
  155. package/dist/parser/tests/statement/Dim.spec.js +22 -22
  156. package/dist/parser/tests/statement/Dim.spec.js.map +1 -1
  157. package/dist/parser/tests/statement/Enum.spec.js +14 -14
  158. package/dist/parser/tests/statement/Enum.spec.js.map +1 -1
  159. package/dist/parser/tests/statement/Function.spec.js +35 -35
  160. package/dist/parser/tests/statement/Function.spec.js.map +1 -1
  161. package/dist/parser/tests/statement/Goto.spec.js +5 -5
  162. package/dist/parser/tests/statement/Goto.spec.js.map +1 -1
  163. package/dist/parser/tests/statement/Increment.spec.js +20 -20
  164. package/dist/parser/tests/statement/Increment.spec.js.map +1 -1
  165. package/dist/parser/tests/statement/LibraryStatement.spec.js +11 -11
  166. package/dist/parser/tests/statement/LibraryStatement.spec.js.map +1 -1
  167. package/dist/parser/tests/statement/Misc.spec.js +20 -20
  168. package/dist/parser/tests/statement/Misc.spec.js.map +1 -1
  169. package/dist/parser/tests/statement/PrintStatement.spec.js +16 -16
  170. package/dist/parser/tests/statement/PrintStatement.spec.js.map +1 -1
  171. package/dist/parser/tests/statement/ReturnStatement.spec.js +9 -9
  172. package/dist/parser/tests/statement/ReturnStatement.spec.js.map +1 -1
  173. package/dist/parser/tests/statement/Set.spec.js +22 -22
  174. package/dist/parser/tests/statement/Set.spec.js.map +1 -1
  175. package/dist/parser/tests/statement/Stop.spec.js +6 -6
  176. package/dist/parser/tests/statement/Stop.spec.js.map +1 -1
  177. package/dist/parser/tests/statement/Throw.spec.js +6 -6
  178. package/dist/parser/tests/statement/Throw.spec.js.map +1 -1
  179. package/dist/parser/tests/statement/TryCatch.spec.js +15 -15
  180. package/dist/parser/tests/statement/TryCatch.spec.js.map +1 -1
  181. package/dist/preprocessor/Manifest.spec.js +8 -8
  182. package/dist/preprocessor/Manifest.spec.js.map +1 -1
  183. package/dist/preprocessor/Preprocessor.d.ts +2 -2
  184. package/dist/preprocessor/Preprocessor.js +2 -2
  185. package/dist/preprocessor/Preprocessor.spec.js +25 -25
  186. package/dist/preprocessor/Preprocessor.spec.js.map +1 -1
  187. package/dist/preprocessor/PreprocessorParser.d.ts +1 -1
  188. package/dist/preprocessor/PreprocessorParser.js +1 -1
  189. package/dist/preprocessor/PreprocessorParser.spec.js +13 -13
  190. package/dist/preprocessor/PreprocessorParser.spec.js.map +1 -1
  191. package/dist/types/ArrayType.spec.js +9 -9
  192. package/dist/types/ArrayType.spec.js.map +1 -1
  193. package/dist/types/BooleanType.spec.js +3 -3
  194. package/dist/types/BooleanType.spec.js.map +1 -1
  195. package/dist/types/DoubleType.spec.js +3 -3
  196. package/dist/types/DoubleType.spec.js.map +1 -1
  197. package/dist/types/DynamicType.d.ts +0 -1
  198. package/dist/types/DynamicType.js +0 -1
  199. package/dist/types/DynamicType.js.map +1 -1
  200. package/dist/types/DynamicType.spec.js +3 -3
  201. package/dist/types/DynamicType.spec.js.map +1 -1
  202. package/dist/types/FloatType.spec.js +3 -3
  203. package/dist/types/FloatType.spec.js.map +1 -1
  204. package/dist/types/FunctionType.spec.js +6 -6
  205. package/dist/types/FunctionType.spec.js.map +1 -1
  206. package/dist/types/IntegerType.spec.js +3 -3
  207. package/dist/types/IntegerType.spec.js.map +1 -1
  208. package/dist/types/InterfaceType.spec.js +8 -8
  209. package/dist/types/InterfaceType.spec.js.map +1 -1
  210. package/dist/types/InvalidType.spec.js +3 -3
  211. package/dist/types/InvalidType.spec.js.map +1 -1
  212. package/dist/types/LongIntegerType.spec.js +3 -3
  213. package/dist/types/LongIntegerType.spec.js.map +1 -1
  214. package/dist/types/ObjectType.spec.js +3 -3
  215. package/dist/types/ObjectType.spec.js.map +1 -1
  216. package/dist/types/StringType.spec.js +3 -3
  217. package/dist/types/StringType.spec.js.map +1 -1
  218. package/dist/types/VoidType.spec.js +3 -3
  219. package/dist/types/VoidType.spec.js.map +1 -1
  220. package/dist/util.d.ts +21 -43
  221. package/dist/util.js +26 -54
  222. package/dist/util.js.map +1 -1
  223. package/package.json +3 -3
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.failStatementType = exports.rangeToArray = void 0;
4
- const chai_1 = require("chai");
4
+ const chai_config_spec_1 = require("../chai-config.spec");
5
5
  const Lexer_1 = require("../lexer/Lexer");
6
6
  const TokenKind_1 = require("../lexer/TokenKind");
7
7
  const Expression_1 = require("./Expression");
@@ -18,7 +18,7 @@ const Program_1 = require("../Program");
18
18
  const visitors_1 = require("../astUtils/visitors");
19
19
  describe('parser', () => {
20
20
  it('emits empty object when empty token list is provided', () => {
21
- (0, chai_1.expect)(Parser_1.Parser.parse([])).to.deep.include({
21
+ (0, chai_config_spec_1.expect)(Parser_1.Parser.parse([])).to.deep.include({
22
22
  statements: [],
23
23
  diagnostics: []
24
24
  });
@@ -32,7 +32,7 @@ describe('parser', () => {
32
32
  sub UnusedFunction()
33
33
  end sub
34
34
  `);
35
- (0, chai_1.expect)(parser.references.functionStatements.map(x => x.name.text)).to.eql([
35
+ (0, chai_config_spec_1.expect)(parser.references.functionStatements.map(x => x.name.text)).to.eql([
36
36
  'main',
37
37
  'UnusedFunction'
38
38
  ]);
@@ -40,9 +40,9 @@ describe('parser', () => {
40
40
  parser.ast.statements.splice(1);
41
41
  //tell the parser we modified the AST and need to regenerate references
42
42
  parser.invalidateReferences();
43
- (0, chai_1.expect)(parser['_references']).not.to.exist;
43
+ (0, chai_config_spec_1.expect)(parser['_references']).not.to.exist;
44
44
  //calling `references` automatically regenerates the references
45
- (0, chai_1.expect)(parser.references.functionStatements.map(x => x.name.text)).to.eql([
45
+ (0, chai_config_spec_1.expect)(parser.references.functionStatements.map(x => x.name.text)).to.eql([
46
46
  'main'
47
47
  ]);
48
48
  });
@@ -112,10 +112,10 @@ describe('parser', () => {
112
112
  '"bob"',
113
113
  'name.space.getSomething()'
114
114
  ];
115
- (0, chai_1.expect)(expressionsToStrings(parser.references.expressions)).to.eql(expected);
115
+ (0, chai_config_spec_1.expect)(expressionsToStrings(parser.references.expressions)).to.eql(expected);
116
116
  //tell the parser we modified the AST and need to regenerate references
117
117
  parser.invalidateReferences();
118
- (0, chai_1.expect)(expressionsToStrings(parser.references.expressions).sort()).to.eql(expected.sort());
118
+ (0, chai_config_spec_1.expect)(expressionsToStrings(parser.references.expressions).sort()).to.eql(expected.sort());
119
119
  });
120
120
  it('works for references.expressions', () => {
121
121
  const parser = Parser_1.Parser.parse(`
@@ -132,10 +132,10 @@ describe('parser', () => {
132
132
  'Name.Space.Enum2.Value',
133
133
  'true or type(true) = "something" or Enums.A.Value = "value" and Enum1.Value = Name.Space.Enum2.Value'
134
134
  ];
135
- (0, chai_1.expect)(expressionsToStrings(parser.references.expressions)).to.eql(expected);
135
+ (0, chai_config_spec_1.expect)(expressionsToStrings(parser.references.expressions)).to.eql(expected);
136
136
  //tell the parser we modified the AST and need to regenerate references
137
137
  parser.invalidateReferences();
138
- (0, chai_1.expect)(expressionsToStrings(parser.references.expressions).sort()).to.eql(expected.sort());
138
+ (0, chai_config_spec_1.expect)(expressionsToStrings(parser.references.expressions).sort()).to.eql(expected.sort());
139
139
  });
140
140
  it('works for logical expression', () => {
141
141
  const parser = Parser_1.Parser.parse(`
@@ -146,10 +146,10 @@ describe('parser', () => {
146
146
  '"value"',
147
147
  'Enums.A.Value = "value"'
148
148
  ];
149
- (0, chai_1.expect)(expressionsToStrings(parser.references.expressions)).to.eql(expected);
149
+ (0, chai_config_spec_1.expect)(expressionsToStrings(parser.references.expressions)).to.eql(expected);
150
150
  //tell the parser we modified the AST and need to regenerate references
151
151
  parser.invalidateReferences();
152
- (0, chai_1.expect)(expressionsToStrings(parser.references.expressions).sort()).to.eql(expected.sort());
152
+ (0, chai_config_spec_1.expect)(expressionsToStrings(parser.references.expressions).sort()).to.eql(expected.sort());
153
153
  });
154
154
  });
155
155
  describe('callfunc operator', () => {
@@ -160,7 +160,7 @@ describe('parser', () => {
160
160
  node@.doSomething(1, 2)
161
161
  end sub
162
162
  `, Parser_1.ParseMode.BrightScript);
163
- (0, chai_1.expect)((_a = parser.diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.bsFeatureNotSupportedInBrsFiles('callfunc operator').message);
163
+ (0, chai_config_spec_1.expect)((_a = parser.diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.bsFeatureNotSupportedInBrsFiles('callfunc operator').message);
164
164
  });
165
165
  it('does not cause parse errors', () => {
166
166
  var _a, _b, _c, _d, _e;
@@ -169,8 +169,8 @@ describe('parser', () => {
169
169
  node@.doSomething(1, 2)
170
170
  end sub
171
171
  `, Parser_1.ParseMode.BrighterScript);
172
- (0, chai_1.expect)((_a = parser.diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
173
- (0, chai_1.expect)((_e = (_d = (_c = (_b = parser.statements[0]) === null || _b === void 0 ? void 0 : _b.func) === null || _c === void 0 ? void 0 : _c.body) === null || _d === void 0 ? void 0 : _d.statements[0]) === null || _e === void 0 ? void 0 : _e.expression).to.be.instanceof(Expression_1.CallfuncExpression);
172
+ (0, chai_config_spec_1.expect)((_a = parser.diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
173
+ (0, chai_config_spec_1.expect)((_e = (_d = (_c = (_b = parser.statements[0]) === null || _b === void 0 ? void 0 : _b.func) === null || _c === void 0 ? void 0 : _c.body) === null || _d === void 0 ? void 0 : _d.statements[0]) === null || _e === void 0 ? void 0 : _e.expression).to.be.instanceof(Expression_1.CallfuncExpression);
174
174
  });
175
175
  });
176
176
  describe('optional chaining operator', () => {
@@ -187,50 +187,50 @@ describe('parser', () => {
187
187
  }
188
188
  it('works for ?.', () => {
189
189
  const expression = getExpression(`value = person?.name`);
190
- (0, chai_1.expect)(expression).to.be.instanceOf(Expression_1.DottedGetExpression);
191
- (0, chai_1.expect)(expression.dot.kind).to.eql(TokenKind_1.TokenKind.QuestionDot);
190
+ (0, chai_config_spec_1.expect)(expression).to.be.instanceOf(Expression_1.DottedGetExpression);
191
+ (0, chai_config_spec_1.expect)(expression.dot.kind).to.eql(TokenKind_1.TokenKind.QuestionDot);
192
192
  });
193
193
  it('works for ?[', () => {
194
194
  const expression = getExpression(`value = person?["name"]`, { matcher: reflection_1.isIndexedGetExpression });
195
- (0, chai_1.expect)(expression).to.be.instanceOf(Expression_1.IndexedGetExpression);
196
- (0, chai_1.expect)(expression.openingSquare.kind).to.eql(TokenKind_1.TokenKind.QuestionLeftSquare);
197
- (0, chai_1.expect)(expression.questionDotToken).not.to.exist;
195
+ (0, chai_config_spec_1.expect)(expression).to.be.instanceOf(Expression_1.IndexedGetExpression);
196
+ (0, chai_config_spec_1.expect)(expression.openingSquare.kind).to.eql(TokenKind_1.TokenKind.QuestionLeftSquare);
197
+ (0, chai_config_spec_1.expect)(expression.questionDotToken).not.to.exist;
198
198
  });
199
199
  it('works for ?.[', () => {
200
200
  var _a;
201
201
  const expression = getExpression(`value = person?.["name"]`, { matcher: reflection_1.isIndexedGetExpression });
202
- (0, chai_1.expect)(expression).to.be.instanceOf(Expression_1.IndexedGetExpression);
203
- (0, chai_1.expect)(expression.openingSquare.kind).to.eql(TokenKind_1.TokenKind.LeftSquareBracket);
204
- (0, chai_1.expect)((_a = expression.questionDotToken) === null || _a === void 0 ? void 0 : _a.kind).to.eql(TokenKind_1.TokenKind.QuestionDot);
202
+ (0, chai_config_spec_1.expect)(expression).to.be.instanceOf(Expression_1.IndexedGetExpression);
203
+ (0, chai_config_spec_1.expect)(expression.openingSquare.kind).to.eql(TokenKind_1.TokenKind.LeftSquareBracket);
204
+ (0, chai_config_spec_1.expect)((_a = expression.questionDotToken) === null || _a === void 0 ? void 0 : _a.kind).to.eql(TokenKind_1.TokenKind.QuestionDot);
205
205
  });
206
206
  it('works for ?@', () => {
207
207
  const expression = getExpression(`value = someXml?@someAttr`);
208
- (0, chai_1.expect)(expression).to.be.instanceOf(Expression_1.XmlAttributeGetExpression);
209
- (0, chai_1.expect)(expression.at.kind).to.eql(TokenKind_1.TokenKind.QuestionAt);
208
+ (0, chai_config_spec_1.expect)(expression).to.be.instanceOf(Expression_1.XmlAttributeGetExpression);
209
+ (0, chai_config_spec_1.expect)(expression.at.kind).to.eql(TokenKind_1.TokenKind.QuestionAt);
210
210
  });
211
211
  it('works for ?(', () => {
212
212
  const expression = getExpression(`value = person.getName?()`);
213
- (0, chai_1.expect)(expression).to.be.instanceOf(Expression_1.CallExpression);
214
- (0, chai_1.expect)(expression.openingParen.kind).to.eql(TokenKind_1.TokenKind.QuestionLeftParen);
213
+ (0, chai_config_spec_1.expect)(expression).to.be.instanceOf(Expression_1.CallExpression);
214
+ (0, chai_config_spec_1.expect)(expression.openingParen.kind).to.eql(TokenKind_1.TokenKind.QuestionLeftParen);
215
215
  });
216
216
  it('works for print statements using question mark', () => {
217
217
  const { statements } = parse(`
218
218
  ?[1]
219
219
  ?(1+1)
220
220
  `);
221
- (0, chai_1.expect)(statements[0]).to.be.instanceOf(Statement_1.PrintStatement);
222
- (0, chai_1.expect)(statements[1]).to.be.instanceOf(Statement_1.PrintStatement);
221
+ (0, chai_config_spec_1.expect)(statements[0]).to.be.instanceOf(Statement_1.PrintStatement);
222
+ (0, chai_config_spec_1.expect)(statements[1]).to.be.instanceOf(Statement_1.PrintStatement);
223
223
  });
224
224
  //TODO enable this once we properly parse IIFEs
225
225
  it.skip('works for ?( in anonymous function', () => {
226
226
  const expression = getExpression(`thing = (function() : end function)?()`);
227
- (0, chai_1.expect)(expression).to.be.instanceOf(Expression_1.CallExpression);
228
- (0, chai_1.expect)(expression.openingParen.kind).to.eql(TokenKind_1.TokenKind.QuestionLeftParen);
227
+ (0, chai_config_spec_1.expect)(expression).to.be.instanceOf(Expression_1.CallExpression);
228
+ (0, chai_config_spec_1.expect)(expression.openingParen.kind).to.eql(TokenKind_1.TokenKind.QuestionLeftParen);
229
229
  });
230
230
  it('works for ?( in new call', () => {
231
231
  const expression = getExpression(`thing = new Person?()`, { parseMode: Parser_1.ParseMode.BrighterScript });
232
- (0, chai_1.expect)(expression).to.be.instanceOf(Expression_1.NewExpression);
233
- (0, chai_1.expect)(expression.call.openingParen.kind).to.eql(TokenKind_1.TokenKind.QuestionLeftParen);
232
+ (0, chai_config_spec_1.expect)(expression).to.be.instanceOf(Expression_1.NewExpression);
233
+ (0, chai_config_spec_1.expect)(expression.call.openingParen.kind).to.eql(TokenKind_1.TokenKind.QuestionLeftParen);
234
234
  });
235
235
  it('distinguishes between optional chaining and ternary expression', () => {
236
236
  const parser = parse(`
@@ -240,8 +240,8 @@ describe('parser', () => {
240
240
  key = isTrue ? ["name"] : ["age"]
241
241
  end sub
242
242
  `, Parser_1.ParseMode.BrighterScript);
243
- (0, chai_1.expect)(parser.references.assignmentStatements[0].value).is.instanceof(Expression_1.IndexedGetExpression);
244
- (0, chai_1.expect)(parser.references.assignmentStatements[2].value).is.instanceof(Expression_1.TernaryExpression);
243
+ (0, chai_config_spec_1.expect)(parser.references.assignmentStatements[0].value).is.instanceof(Expression_1.IndexedGetExpression);
244
+ (0, chai_config_spec_1.expect)(parser.references.assignmentStatements[2].value).is.instanceof(Expression_1.TernaryExpression);
245
245
  });
246
246
  it('distinguishes between optional chaining and ternary expression', () => {
247
247
  const parser = parse(`
@@ -252,13 +252,13 @@ describe('parser', () => {
252
252
  key = isTrue ? ["name"] : getDefault()
253
253
  end sub
254
254
  `, Parser_1.ParseMode.BrighterScript);
255
- (0, chai_1.expect)(parser.references.assignmentStatements[0].value).is.instanceof(Expression_1.IndexedGetExpression);
256
- (0, chai_1.expect)(parser.references.assignmentStatements[1].value).is.instanceof(Expression_1.TernaryExpression);
255
+ (0, chai_config_spec_1.expect)(parser.references.assignmentStatements[0].value).is.instanceof(Expression_1.IndexedGetExpression);
256
+ (0, chai_config_spec_1.expect)(parser.references.assignmentStatements[1].value).is.instanceof(Expression_1.TernaryExpression);
257
257
  });
258
258
  });
259
259
  describe('diagnostic locations', () => {
260
260
  it('tracks basic diagnostic locations', () => {
261
- (0, chai_1.expect)(parse(`
261
+ (0, chai_config_spec_1.expect)(parse(`
262
262
  sub main()
263
263
  call()a
264
264
  end sub
@@ -274,8 +274,8 @@ describe('parser', () => {
274
274
  return "6c5cdf1"
275
275
  end functionasdf
276
276
  `).diagnostics;
277
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.exist.and.to.eql(DiagnosticMessages_1.DiagnosticMessages.expectedStatementOrFunctionCallButReceivedExpression().message);
278
- (0, chai_1.expect)((_b = diagnostics[0]) === null || _b === void 0 ? void 0 : _b.range).to.eql(vscode_languageserver_1.Range.create(3, 20, 3, 32));
277
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.exist.and.to.eql(DiagnosticMessages_1.DiagnosticMessages.expectedStatementOrFunctionCallButReceivedExpression().message);
278
+ (0, chai_config_spec_1.expect)((_b = diagnostics[0]) === null || _b === void 0 ? void 0 : _b.range).to.eql(vscode_languageserver_1.Range.create(3, 20, 3, 32));
279
279
  });
280
280
  });
281
281
  describe('parse', () => {
@@ -312,20 +312,28 @@ describe('parser', () => {
312
312
  });
313
313
  it('supports using "interface" as parameter name', () => {
314
314
  var _a;
315
- (0, chai_1.expect)((_a = parse(`
315
+ (0, chai_config_spec_1.expect)((_a = parse(`
316
316
  sub main(interface as object)
317
317
  end sub
318
318
  `, Parser_1.ParseMode.BrighterScript).diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
319
319
  });
320
320
  describe('namespace', () => {
321
- it('catches namespaces declared not at root level', () => {
322
- var _a;
323
- (0, chai_1.expect)((_a = parse(`
324
- sub main()
325
- namespace Name.Space
321
+ it('allows namespaces declared inside other namespaces', () => {
322
+ const parser = parse(`
323
+ namespace Level1
324
+ namespace Level2.Level3
325
+ sub main()
326
+ end sub
326
327
  end namespace
327
- end sub
328
- `, Parser_1.ParseMode.BrighterScript).diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.keywordMustBeDeclaredAtRootLevel('namespace').message);
328
+ end namespace
329
+ `, Parser_1.ParseMode.BrighterScript);
330
+ (0, testHelpers_spec_1.expectZeroDiagnostics)(parser);
331
+ // We expect these names to be "as given" in this context, because we aren't
332
+ // evaluating a full program.
333
+ (0, chai_config_spec_1.expect)(parser.references.namespaceStatements.map(statement => statement.getName(Parser_1.ParseMode.BrighterScript))).to.deep.equal([
334
+ 'Level2.Level3',
335
+ 'Level1'
336
+ ]);
329
337
  });
330
338
  it('parses empty namespace', () => {
331
339
  var _a;
@@ -333,8 +341,8 @@ describe('parser', () => {
333
341
  namespace Name.Space
334
342
  end namespace
335
343
  `, Parser_1.ParseMode.BrighterScript);
336
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
337
- (0, chai_1.expect)(statements[0]).to.be.instanceof(Statement_1.NamespaceStatement);
344
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
345
+ (0, chai_config_spec_1.expect)(statements[0]).to.be.instanceof(Statement_1.NamespaceStatement);
338
346
  });
339
347
  it('includes body', () => {
340
348
  var _a;
@@ -344,9 +352,9 @@ describe('parser', () => {
344
352
  end sub
345
353
  end namespace
346
354
  `, Parser_1.ParseMode.BrighterScript);
347
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
348
- (0, chai_1.expect)(statements[0]).to.be.instanceof(Statement_1.NamespaceStatement);
349
- (0, chai_1.expect)(statements[0].body.statements[0]).to.be.instanceof(Statement_1.FunctionStatement);
355
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
356
+ (0, chai_config_spec_1.expect)(statements[0]).to.be.instanceof(Statement_1.NamespaceStatement);
357
+ (0, chai_config_spec_1.expect)(statements[0].body.statements[0]).to.be.instanceof(Statement_1.FunctionStatement);
350
358
  });
351
359
  it('supports comments and newlines', () => {
352
360
  var _a;
@@ -362,7 +370,7 @@ describe('parser', () => {
362
370
  'comment
363
371
  end namespace 'comment
364
372
  `, Parser_1.ParseMode.BrighterScript);
365
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
373
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
366
374
  });
367
375
  it('catches missing name', () => {
368
376
  var _a;
@@ -370,7 +378,7 @@ describe('parser', () => {
370
378
  namespace
371
379
  end namespace
372
380
  `, Parser_1.ParseMode.BrighterScript);
373
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.expectedIdentifierAfterKeyword('namespace').message);
381
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.expectedIdentifierAfterKeyword('namespace').message);
374
382
  });
375
383
  it('recovers after missing `end namespace`', () => {
376
384
  var _a, _b, _c;
@@ -379,9 +387,9 @@ describe('parser', () => {
379
387
  sub main()
380
388
  end sub
381
389
  `, Parser_1.ParseMode.BrighterScript);
382
- (0, chai_1.expect)(parser.ast.statements[0]).to.be.instanceof(Statement_1.NamespaceStatement);
383
- (0, chai_1.expect)((_a = parser.diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.couldNotFindMatchingEndKeyword('namespace').message);
384
- (0, chai_1.expect)((_c = (_b = parser.ast.statements[0]) === null || _b === void 0 ? void 0 : _b.body) === null || _c === void 0 ? void 0 : _c.statements[0]).to.be.instanceof(Statement_1.FunctionStatement);
390
+ (0, chai_config_spec_1.expect)(parser.ast.statements[0]).to.be.instanceof(Statement_1.NamespaceStatement);
391
+ (0, chai_config_spec_1.expect)((_a = parser.diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.couldNotFindMatchingEndKeyword('namespace').message);
392
+ (0, chai_config_spec_1.expect)((_c = (_b = parser.ast.statements[0]) === null || _b === void 0 ? void 0 : _b.body) === null || _c === void 0 ? void 0 : _c.statements[0]).to.be.instanceof(Statement_1.FunctionStatement);
385
393
  });
386
394
  it('adds diagnostic when encountering namespace in brightscript mode', () => {
387
395
  var _a;
@@ -389,12 +397,12 @@ describe('parser', () => {
389
397
  namespace Name.Space
390
398
  end namespace
391
399
  `);
392
- (0, chai_1.expect)((_a = parser.diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.bsFeatureNotSupportedInBrsFiles('namespace').message);
400
+ (0, chai_config_spec_1.expect)((_a = parser.diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.bsFeatureNotSupportedInBrsFiles('namespace').message);
393
401
  });
394
402
  });
395
403
  it('supports << operator', () => {
396
404
  var _a;
397
- (0, chai_1.expect)((_a = parse(`
405
+ (0, chai_config_spec_1.expect)((_a = parse(`
398
406
  sub main()
399
407
  print ((r << 24) + (g << 16) + (b << 8) + a)
400
408
  end sub
@@ -402,7 +410,7 @@ describe('parser', () => {
402
410
  });
403
411
  it('supports >> operator', () => {
404
412
  var _a;
405
- (0, chai_1.expect)((_a = parse(`
413
+ (0, chai_config_spec_1.expect)((_a = parse(`
406
414
  sub main()
407
415
  print ((r >> 24) + (g >> 16) + (b >> 8) + a)
408
416
  end sub
@@ -410,7 +418,7 @@ describe('parser', () => {
410
418
  });
411
419
  it('allows global function names with same as token to be called', () => {
412
420
  var _a;
413
- (0, chai_1.expect)((_a = parse(`
421
+ (0, chai_config_spec_1.expect)((_a = parse(`
414
422
  sub main()
415
423
  print string(123)
416
424
  end sub
@@ -424,18 +432,18 @@ describe('parser', () => {
424
432
  age = personXml.firstChild@age
425
433
  end sub
426
434
  `);
427
- (0, chai_1.expect)((_a = parser.diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.not.exist;
435
+ (0, chai_config_spec_1.expect)((_a = parser.diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.not.exist;
428
436
  let statements = parser.statements[0].func.body.statements;
429
437
  let first = statements[0].value;
430
- (0, chai_1.expect)(first).to.be.instanceof(Expression_1.XmlAttributeGetExpression);
431
- (0, chai_1.expect)(first.name.text).to.equal('firstName');
432
- (0, chai_1.expect)(first.at.text).to.equal('@');
433
- (0, chai_1.expect)(first.obj.name.text).to.equal('personXml');
438
+ (0, chai_config_spec_1.expect)(first).to.be.instanceof(Expression_1.XmlAttributeGetExpression);
439
+ (0, chai_config_spec_1.expect)(first.name.text).to.equal('firstName');
440
+ (0, chai_config_spec_1.expect)(first.at.text).to.equal('@');
441
+ (0, chai_config_spec_1.expect)(first.obj.name.text).to.equal('personXml');
434
442
  let second = statements[1].value;
435
- (0, chai_1.expect)(second).to.be.instanceof(Expression_1.XmlAttributeGetExpression);
436
- (0, chai_1.expect)(second.name.text).to.equal('age');
437
- (0, chai_1.expect)(second.at.text).to.equal('@');
438
- (0, chai_1.expect)(second.obj.name.text).to.equal('firstChild');
443
+ (0, chai_config_spec_1.expect)(second).to.be.instanceof(Expression_1.XmlAttributeGetExpression);
444
+ (0, chai_config_spec_1.expect)(second.name.text).to.equal('age');
445
+ (0, chai_config_spec_1.expect)(second.at.text).to.equal('@');
446
+ (0, chai_config_spec_1.expect)(second.obj.name.text).to.equal('firstChild');
439
447
  });
440
448
  it('does not allow chaining of @ symbols', () => {
441
449
  let parser = parse(`
@@ -444,58 +452,58 @@ describe('parser', () => {
444
452
  name = personXml@name@age@shoeSize
445
453
  end sub
446
454
  `);
447
- (0, chai_1.expect)(parser.diagnostics).not.to.be.empty;
455
+ (0, chai_config_spec_1.expect)(parser.diagnostics).not.to.be.empty;
448
456
  });
449
457
  it('unknown function type does not invalidate rest of function', () => {
450
458
  let { statements, diagnostics } = parse(`
451
459
  function log() as UNKNOWN_TYPE
452
460
  end function
453
461
  `, Parser_1.ParseMode.BrightScript);
454
- (0, chai_1.expect)(diagnostics.length).to.be.greaterThan(0);
455
- (0, chai_1.expect)(statements[0]).to.exist;
462
+ (0, chai_config_spec_1.expect)(diagnostics.length).to.be.greaterThan(0);
463
+ (0, chai_config_spec_1.expect)(statements[0]).to.exist;
456
464
  });
457
465
  it('unknown function type is not a problem in Brighterscript mode', () => {
458
466
  let { statements, diagnostics } = parse(`
459
467
  function log() as UNKNOWN_TYPE
460
468
  end function
461
469
  `, Parser_1.ParseMode.BrighterScript);
462
- (0, chai_1.expect)(diagnostics.length).to.equal(0);
463
- (0, chai_1.expect)(statements[0]).to.exist;
470
+ (0, chai_config_spec_1.expect)(diagnostics.length).to.equal(0);
471
+ (0, chai_config_spec_1.expect)(statements[0]).to.exist;
464
472
  });
465
473
  it('allows namespaced function type in Brighterscript mode', () => {
466
474
  let { statements, diagnostics } = parse(`
467
475
  function log() as SOME_NAMESPACE.UNKNOWN_TYPE
468
476
  end function
469
477
  `, Parser_1.ParseMode.BrighterScript);
470
- (0, chai_1.expect)(diagnostics.length).to.equal(0);
471
- (0, chai_1.expect)(statements[0]).to.exist;
478
+ (0, chai_config_spec_1.expect)(diagnostics.length).to.equal(0);
479
+ (0, chai_config_spec_1.expect)(statements[0]).to.exist;
472
480
  });
473
481
  it('allows custom parameter types in BrighterscriptMode', () => {
474
482
  let { statements, diagnostics } = parse(`
475
483
  sub foo(value as UNKNOWN_TYPE)
476
484
  end sub
477
485
  `, Parser_1.ParseMode.BrighterScript);
478
- (0, chai_1.expect)(diagnostics.length).to.equal(0);
479
- (0, chai_1.expect)(statements[0]).to.exist;
486
+ (0, chai_config_spec_1.expect)(diagnostics.length).to.equal(0);
487
+ (0, chai_config_spec_1.expect)(statements[0]).to.exist;
480
488
  });
481
489
  it('does not allow custom parameter types in Brightscript Mode', () => {
482
490
  let { diagnostics } = parse(`
483
491
  sub foo(value as UNKNOWN_TYPE)
484
492
  end sub
485
493
  `, Parser_1.ParseMode.BrightScript);
486
- (0, chai_1.expect)(diagnostics.length).not.to.equal(0);
494
+ (0, chai_config_spec_1.expect)(diagnostics.length).not.to.equal(0);
487
495
  });
488
496
  it('allows custom namespaced parameter types in BrighterscriptMode', () => {
489
497
  let { statements, diagnostics } = parse(`
490
498
  sub foo(value as SOME_NAMESPACE.UNKNOWN_TYPE)
491
499
  end sub
492
500
  `, Parser_1.ParseMode.BrighterScript);
493
- (0, chai_1.expect)(diagnostics.length).to.equal(0);
494
- (0, chai_1.expect)(statements[0]).to.exist;
501
+ (0, chai_config_spec_1.expect)(diagnostics.length).to.equal(0);
502
+ (0, chai_config_spec_1.expect)(statements[0]).to.exist;
495
503
  });
496
504
  it('works with conditionals', () => {
497
505
  var _a;
498
- (0, chai_1.expect)((_a = parse(`
506
+ (0, chai_config_spec_1.expect)((_a = parse(`
499
507
  function printNumber()
500
508
  if true then
501
509
  print 1
@@ -507,7 +515,7 @@ describe('parser', () => {
507
515
  });
508
516
  it('supports single-line if statements', () => {
509
517
  var _a;
510
- (0, chai_1.expect)((_a = parse(`If true Then print "error" : Stop`).diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.not.exist;
518
+ (0, chai_config_spec_1.expect)((_a = parse(`If true Then print "error" : Stop`).diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.not.exist;
511
519
  });
512
520
  it('works with excess newlines', () => {
513
521
  var _a;
@@ -520,7 +528,7 @@ describe('parser', () => {
520
528
  ' print 1\n\n' +
521
529
  ' end if\n\n' +
522
530
  'end function\n\n');
523
- (0, chai_1.expect)((_a = Parser_1.Parser.parse(tokens).diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.not.exist;
531
+ (0, chai_config_spec_1.expect)((_a = Parser_1.Parser.parse(tokens).diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.not.exist;
524
532
  });
525
533
  it('does not invalidate entire file when line ends with a period', () => {
526
534
  let { tokens } = Lexer_1.Lexer.scan(`
@@ -530,15 +538,15 @@ describe('parser', () => {
530
538
 
531
539
  `);
532
540
  let { diagnostics } = Parser_1.Parser.parse(tokens);
533
- (0, chai_1.expect)(diagnostics).to.be.lengthOf(1, 'Error count should be 0');
541
+ (0, chai_config_spec_1.expect)(diagnostics).to.be.lengthOf(1, 'Error count should be 0');
534
542
  });
535
543
  it.skip('allows printing object with trailing period', () => {
536
544
  let { tokens } = Lexer_1.Lexer.scan(`print a.`);
537
545
  let { statements, diagnostics } = Parser_1.Parser.parse(tokens);
538
546
  let printStatement = statements[0];
539
- (0, chai_1.expect)(diagnostics).to.be.empty;
540
- (0, chai_1.expect)(printStatement).to.be.instanceof(Statement_1.PrintStatement);
541
- (0, chai_1.expect)(printStatement.expressions[0]).to.be.instanceof(Expression_1.DottedGetExpression);
547
+ (0, chai_config_spec_1.expect)(diagnostics).to.be.empty;
548
+ (0, chai_config_spec_1.expect)(printStatement).to.be.instanceof(Statement_1.PrintStatement);
549
+ (0, chai_config_spec_1.expect)(printStatement.expressions[0]).to.be.instanceof(Expression_1.DottedGetExpression);
542
550
  });
543
551
  describe('comments', () => {
544
552
  it('combines multi-line comments', () => {
@@ -548,8 +556,8 @@ describe('parser', () => {
548
556
  'line 3
549
557
  `);
550
558
  let { diagnostics, statements } = Parser_1.Parser.parse(tokens);
551
- (0, chai_1.expect)(diagnostics).to.be.lengthOf(0, 'Error count should be 0');
552
- (0, chai_1.expect)(statements[0].text).to.equal(`'line 1\n'line 2\n'line 3`);
559
+ (0, chai_config_spec_1.expect)(diagnostics).to.be.lengthOf(0, 'Error count should be 0');
560
+ (0, chai_config_spec_1.expect)(statements[0].text).to.equal(`'line 1\n'line 2\n'line 3`);
553
561
  });
554
562
  it('does not combile comments separated by newlines', () => {
555
563
  let { tokens } = Lexer_1.Lexer.scan(`
@@ -560,11 +568,11 @@ describe('parser', () => {
560
568
  'line 3
561
569
  `);
562
570
  let { diagnostics, statements } = Parser_1.Parser.parse(tokens);
563
- (0, chai_1.expect)(diagnostics).to.be.lengthOf(0, 'Error count should be 0');
564
- (0, chai_1.expect)(statements).to.be.lengthOf(3);
565
- (0, chai_1.expect)(statements[0].text).to.equal(`'line 1`);
566
- (0, chai_1.expect)(statements[1].text).to.equal(`'line 2`);
567
- (0, chai_1.expect)(statements[2].text).to.equal(`'line 3`);
571
+ (0, chai_config_spec_1.expect)(diagnostics).to.be.lengthOf(0, 'Error count should be 0');
572
+ (0, chai_config_spec_1.expect)(statements).to.be.lengthOf(3);
573
+ (0, chai_config_spec_1.expect)(statements[0].text).to.equal(`'line 1`);
574
+ (0, chai_config_spec_1.expect)(statements[1].text).to.equal(`'line 2`);
575
+ (0, chai_config_spec_1.expect)(statements[2].text).to.equal(`'line 3`);
568
576
  });
569
577
  it('works after print statement', () => {
570
578
  let { tokens } = Lexer_1.Lexer.scan(`
@@ -573,8 +581,8 @@ describe('parser', () => {
573
581
  end sub
574
582
  `);
575
583
  let { diagnostics, statements } = Parser_1.Parser.parse(tokens);
576
- (0, chai_1.expect)(diagnostics).to.be.lengthOf(0, 'Error count should be 0');
577
- (0, chai_1.expect)(statements[0].func.body.statements[1].text).to.equal(`'comment 1`);
584
+ (0, chai_config_spec_1.expect)(diagnostics).to.be.lengthOf(0, 'Error count should be 0');
585
+ (0, chai_config_spec_1.expect)(statements[0].func.body.statements[1].text).to.equal(`'comment 1`);
578
586
  });
579
587
  it('declaration-level', () => {
580
588
  let { tokens } = Lexer_1.Lexer.scan(`
@@ -584,9 +592,9 @@ describe('parser', () => {
584
592
  'comment 2
585
593
  `);
586
594
  let { diagnostics, statements } = Parser_1.Parser.parse(tokens);
587
- (0, chai_1.expect)(diagnostics).to.be.lengthOf(0, 'Error count should be 0');
588
- (0, chai_1.expect)(statements[0].text).to.equal(`'comment 1`);
589
- (0, chai_1.expect)(statements[2].text).to.equal(`'comment 2`);
595
+ (0, chai_config_spec_1.expect)(diagnostics).to.be.lengthOf(0, 'Error count should be 0');
596
+ (0, chai_config_spec_1.expect)(statements[0].text).to.equal(`'comment 1`);
597
+ (0, chai_config_spec_1.expect)(statements[2].text).to.equal(`'comment 2`);
590
598
  });
591
599
  it('works in aa literal as its own statement', () => {
592
600
  let { tokens } = Lexer_1.Lexer.scan(`
@@ -596,7 +604,7 @@ describe('parser', () => {
596
604
  }
597
605
  `);
598
606
  let { diagnostics } = Parser_1.Parser.parse(tokens);
599
- (0, chai_1.expect)(diagnostics).to.be.lengthOf(0, 'Error count should be 0');
607
+ (0, chai_config_spec_1.expect)(diagnostics).to.be.lengthOf(0, 'Error count should be 0');
600
608
  });
601
609
  it('parses after function call', () => {
602
610
  let { tokens } = Lexer_1.Lexer.scan(`
@@ -606,8 +614,8 @@ describe('parser', () => {
606
614
  end sub
607
615
  `);
608
616
  let { diagnostics, statements } = Parser_1.Parser.parse(tokens);
609
- (0, chai_1.expect)(diagnostics).to.be.lengthOf(0, 'Should have zero diagnostics');
610
- (0, chai_1.expect)(statements[0].func.body.statements[2].text).to.equal(`'comment 1`);
617
+ (0, chai_config_spec_1.expect)(diagnostics).to.be.lengthOf(0, 'Should have zero diagnostics');
618
+ (0, chai_config_spec_1.expect)(statements[0].func.body.statements[2].text).to.equal(`'comment 1`);
611
619
  });
612
620
  it('function', () => {
613
621
  let { tokens } = Lexer_1.Lexer.scan(`
@@ -618,11 +626,11 @@ describe('parser', () => {
618
626
  end function 'comment 4
619
627
  `);
620
628
  let { diagnostics, statements } = Parser_1.Parser.parse(tokens);
621
- (0, chai_1.expect)(diagnostics).to.be.lengthOf(0, 'Should have zero diagnostics');
622
- (0, chai_1.expect)(statements[0].func.body.statements[0].text).to.equal(`'comment 1`);
623
- (0, chai_1.expect)(statements[0].func.body.statements[1].text).to.equal(`'comment 2`);
624
- (0, chai_1.expect)(statements[0].func.body.statements[3].text).to.equal(`'comment 3`);
625
- (0, chai_1.expect)(statements[1].text).to.equal(`'comment 4`);
629
+ (0, chai_config_spec_1.expect)(diagnostics).to.be.lengthOf(0, 'Should have zero diagnostics');
630
+ (0, chai_config_spec_1.expect)(statements[0].func.body.statements[0].text).to.equal(`'comment 1`);
631
+ (0, chai_config_spec_1.expect)(statements[0].func.body.statements[1].text).to.equal(`'comment 2`);
632
+ (0, chai_config_spec_1.expect)(statements[0].func.body.statements[3].text).to.equal(`'comment 3`);
633
+ (0, chai_config_spec_1.expect)(statements[1].text).to.equal(`'comment 4`);
626
634
  });
627
635
  it('if statement`', () => {
628
636
  let { tokens } = Lexer_1.Lexer.scan(`
@@ -643,7 +651,7 @@ describe('parser', () => {
643
651
  end function
644
652
  `);
645
653
  let { diagnostics, statements } = Parser_1.Parser.parse(tokens);
646
- (0, chai_1.expect)(diagnostics).to.be.lengthOf(0, 'Should have zero diagnostics');
654
+ (0, chai_config_spec_1.expect)(diagnostics).to.be.lengthOf(0, 'Should have zero diagnostics');
647
655
  let fnSmt = statements[0];
648
656
  if ((0, reflection_1.isFunctionStatement)(fnSmt)) {
649
657
  let ifStmt = fnSmt.func.body.statements[0];
@@ -690,12 +698,12 @@ describe('parser', () => {
690
698
  end function
691
699
  `);
692
700
  let { diagnostics, statements } = Parser_1.Parser.parse(tokens);
693
- (0, chai_1.expect)(diagnostics).to.be.lengthOf(0, 'Error count should be zero');
701
+ (0, chai_config_spec_1.expect)(diagnostics).to.be.lengthOf(0, 'Error count should be zero');
694
702
  let stmt = statements[0].func.body.statements[0];
695
- (0, chai_1.expect)(stmt.body.statements[0].text).to.equal(`'comment 1`);
696
- (0, chai_1.expect)(stmt.body.statements[1].text).to.equal(`'comment 2`);
697
- (0, chai_1.expect)(stmt.body.statements[3].text).to.equal(`'comment 3`);
698
- (0, chai_1.expect)(statements[0].func.body.statements[1].text).to.equal(`'comment 4`);
703
+ (0, chai_config_spec_1.expect)(stmt.body.statements[0].text).to.equal(`'comment 1`);
704
+ (0, chai_config_spec_1.expect)(stmt.body.statements[1].text).to.equal(`'comment 2`);
705
+ (0, chai_config_spec_1.expect)(stmt.body.statements[3].text).to.equal(`'comment 3`);
706
+ (0, chai_config_spec_1.expect)(statements[0].func.body.statements[1].text).to.equal(`'comment 4`);
699
707
  });
700
708
  it('for', () => {
701
709
  let { tokens } = Lexer_1.Lexer.scan(`
@@ -708,12 +716,12 @@ describe('parser', () => {
708
716
  end function
709
717
  `);
710
718
  let { diagnostics, statements } = Parser_1.Parser.parse(tokens);
711
- (0, chai_1.expect)(diagnostics).to.be.lengthOf(0, 'Error count should be zero');
719
+ (0, chai_config_spec_1.expect)(diagnostics).to.be.lengthOf(0, 'Error count should be zero');
712
720
  let stmt = statements[0].func.body.statements[0];
713
- (0, chai_1.expect)(stmt.body.statements[0].text).to.equal(`'comment 1`);
714
- (0, chai_1.expect)(stmt.body.statements[1].text).to.equal(`'comment 2`);
715
- (0, chai_1.expect)(stmt.body.statements[3].text).to.equal(`'comment 3`);
716
- (0, chai_1.expect)(statements[0].func.body.statements[1].text).to.equal(`'comment 4`);
721
+ (0, chai_config_spec_1.expect)(stmt.body.statements[0].text).to.equal(`'comment 1`);
722
+ (0, chai_config_spec_1.expect)(stmt.body.statements[1].text).to.equal(`'comment 2`);
723
+ (0, chai_config_spec_1.expect)(stmt.body.statements[3].text).to.equal(`'comment 3`);
724
+ (0, chai_config_spec_1.expect)(statements[0].func.body.statements[1].text).to.equal(`'comment 4`);
717
725
  });
718
726
  it('for each', () => {
719
727
  let { tokens } = Lexer_1.Lexer.scan(`
@@ -726,12 +734,12 @@ describe('parser', () => {
726
734
  end function
727
735
  `);
728
736
  let { diagnostics, statements } = Parser_1.Parser.parse(tokens);
729
- (0, chai_1.expect)(diagnostics).to.be.lengthOf(0, 'Error count should be zero');
737
+ (0, chai_config_spec_1.expect)(diagnostics).to.be.lengthOf(0, 'Error count should be zero');
730
738
  let stmt = statements[0].func.body.statements[0];
731
- (0, chai_1.expect)(stmt.body.statements[0].text).to.equal(`'comment 1`);
732
- (0, chai_1.expect)(stmt.body.statements[1].text).to.equal(`'comment 2`);
733
- (0, chai_1.expect)(stmt.body.statements[3].text).to.equal(`'comment 3`);
734
- (0, chai_1.expect)(statements[0].func.body.statements[1].text).to.equal(`'comment 4`);
739
+ (0, chai_config_spec_1.expect)(stmt.body.statements[0].text).to.equal(`'comment 1`);
740
+ (0, chai_config_spec_1.expect)(stmt.body.statements[1].text).to.equal(`'comment 2`);
741
+ (0, chai_config_spec_1.expect)(stmt.body.statements[3].text).to.equal(`'comment 3`);
742
+ (0, chai_config_spec_1.expect)(statements[0].func.body.statements[1].text).to.equal(`'comment 4`);
735
743
  });
736
744
  });
737
745
  });
@@ -743,7 +751,7 @@ describe('parser', () => {
743
751
  then = true
744
752
  end sub
745
753
  `);
746
- (0, chai_1.expect)(diagnostics).to.be.lengthOf(1);
754
+ (0, chai_config_spec_1.expect)(diagnostics).to.be.lengthOf(1);
747
755
  });
748
756
  it('is allowed as an AA property name', () => {
749
757
  var _a;
@@ -756,7 +764,7 @@ describe('parser', () => {
756
764
  print person.then
757
765
  end sub
758
766
  `);
759
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
767
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
760
768
  });
761
769
  it('allows `mod` as an AA literal property', () => {
762
770
  const parser = parse(`
@@ -788,7 +796,7 @@ describe('parser', () => {
788
796
  }), {
789
797
  walkMode: visitors_1.WalkMode.visitAllRecursive
790
798
  });
791
- (0, chai_1.expect)(elements.map(x => x.keyToken.kind)).to.eql([TokenKind_1.TokenKind.Identifier, TokenKind_1.TokenKind.Identifier]);
799
+ (0, chai_config_spec_1.expect)(elements.map(x => x.keyToken.kind)).to.eql([TokenKind_1.TokenKind.Identifier, TokenKind_1.TokenKind.Identifier]);
792
800
  });
793
801
  });
794
802
  it('"end" is not allowed as a local identifier', () => {
@@ -797,7 +805,7 @@ describe('parser', () => {
797
805
  end = true
798
806
  end sub
799
807
  `);
800
- (0, chai_1.expect)(diagnostics).to.be.length.greaterThan(0);
808
+ (0, chai_config_spec_1.expect)(diagnostics).to.be.length.greaterThan(0);
801
809
  });
802
810
  it('none of them can be used as local variables', () => {
803
811
  let reservedWords = new Set(TokenKind_1.ReservedWords);
@@ -810,7 +818,7 @@ describe('parser', () => {
810
818
  end sub
811
819
  `);
812
820
  let { diagnostics } = Parser_1.Parser.parse(tokens);
813
- (0, chai_1.expect)(diagnostics, `assigning to reserved word "${reservedWord}" should have been an error`).to.be.length.greaterThan(0);
821
+ (0, chai_config_spec_1.expect)(diagnostics, `assigning to reserved word "${reservedWord}" should have been an error`).to.be.length.greaterThan(0);
814
822
  }
815
823
  });
816
824
  });
@@ -820,24 +828,24 @@ describe('parser', () => {
820
828
  let { statements, diagnostics } = parse(`
821
829
  import "somePath"
822
830
  `, Parser_1.ParseMode.BrighterScript);
823
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
824
- (0, chai_1.expect)(statements[0]).to.be.instanceof(Statement_1.ImportStatement);
831
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
832
+ (0, chai_config_spec_1.expect)(statements[0]).to.be.instanceof(Statement_1.ImportStatement);
825
833
  });
826
834
  it('catches import statements used in brightscript files', () => {
827
835
  var _a;
828
836
  let { statements, diagnostics } = parse(`
829
837
  import "somePath"
830
838
  `, Parser_1.ParseMode.BrightScript);
831
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.eql(DiagnosticMessages_1.DiagnosticMessages.bsFeatureNotSupportedInBrsFiles('import statements').message);
832
- (0, chai_1.expect)(statements[0]).to.be.instanceof(Statement_1.ImportStatement);
839
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.eql(DiagnosticMessages_1.DiagnosticMessages.bsFeatureNotSupportedInBrsFiles('import statements').message);
840
+ (0, chai_config_spec_1.expect)(statements[0]).to.be.instanceof(Statement_1.ImportStatement);
833
841
  });
834
842
  it('catchs missing file path', () => {
835
843
  var _a;
836
844
  let { statements, diagnostics } = parse(`
837
845
  import
838
846
  `, Parser_1.ParseMode.BrighterScript);
839
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.expectedStringLiteralAfterKeyword('import').message);
840
- (0, chai_1.expect)(statements[0]).to.be.instanceof(Statement_1.ImportStatement);
847
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.expectedStringLiteralAfterKeyword('import').message);
848
+ (0, chai_config_spec_1.expect)(statements[0]).to.be.instanceof(Statement_1.ImportStatement);
841
849
  });
842
850
  });
843
851
  describe('Annotations', () => {
@@ -848,7 +856,7 @@ describe('parser', () => {
848
856
  sub main()
849
857
  end sub
850
858
  `, Parser_1.ParseMode.BrighterScript);
851
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.unexpectedToken('@').message);
859
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.unexpectedToken('@').message);
852
860
  });
853
861
  it('properly handles empty annotation above class method', () => {
854
862
  var _a;
@@ -860,7 +868,7 @@ describe('parser', () => {
860
868
  end sub
861
869
  end class
862
870
  `, Parser_1.ParseMode.BrighterScript);
863
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.expectedIdentifier().message);
871
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.expectedIdentifier().message);
864
872
  });
865
873
  it('parses with error if annotation is not followed by a statement', () => {
866
874
  var _a, _b, _c, _d;
@@ -874,11 +882,11 @@ describe('parser', () => {
874
882
  end class
875
883
  @meta1
876
884
  `, Parser_1.ParseMode.BrighterScript);
877
- (0, chai_1.expect)(diagnostics.length).to.equal(4);
878
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.unusedAnnotation().message);
879
- (0, chai_1.expect)((_b = diagnostics[1]) === null || _b === void 0 ? void 0 : _b.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.unusedAnnotation().message);
880
- (0, chai_1.expect)((_c = diagnostics[2]) === null || _c === void 0 ? void 0 : _c.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.unusedAnnotation().message);
881
- (0, chai_1.expect)((_d = diagnostics[3]) === null || _d === void 0 ? void 0 : _d.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.unusedAnnotation().message);
885
+ (0, chai_config_spec_1.expect)(diagnostics.length).to.equal(4);
886
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.unusedAnnotation().message);
887
+ (0, chai_config_spec_1.expect)((_b = diagnostics[1]) === null || _b === void 0 ? void 0 : _b.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.unusedAnnotation().message);
888
+ (0, chai_config_spec_1.expect)((_c = diagnostics[2]) === null || _c === void 0 ? void 0 : _c.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.unusedAnnotation().message);
889
+ (0, chai_config_spec_1.expect)((_d = diagnostics[3]) === null || _d === void 0 ? void 0 : _d.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.unusedAnnotation().message);
882
890
  });
883
891
  it('attaches an annotation to next statement', () => {
884
892
  var _a;
@@ -890,18 +898,18 @@ describe('parser', () => {
890
898
  @meta2 sub init()
891
899
  end sub
892
900
  `, Parser_1.ParseMode.BrighterScript);
893
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
894
- (0, chai_1.expect)(statements[0]).to.be.instanceof(Statement_1.FunctionStatement);
901
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
902
+ (0, chai_config_spec_1.expect)(statements[0]).to.be.instanceof(Statement_1.FunctionStatement);
895
903
  let fn = statements[0];
896
- (0, chai_1.expect)(fn.annotations).to.exist;
897
- (0, chai_1.expect)(fn.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
898
- (0, chai_1.expect)(fn.annotations[0].nameToken.text).to.equal('meta1');
899
- (0, chai_1.expect)(fn.annotations[0].name).to.equal('meta1');
900
- (0, chai_1.expect)(statements[1]).to.be.instanceof(Statement_1.FunctionStatement);
904
+ (0, chai_config_spec_1.expect)(fn.annotations).to.exist;
905
+ (0, chai_config_spec_1.expect)(fn.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
906
+ (0, chai_config_spec_1.expect)(fn.annotations[0].nameToken.text).to.equal('meta1');
907
+ (0, chai_config_spec_1.expect)(fn.annotations[0].name).to.equal('meta1');
908
+ (0, chai_config_spec_1.expect)(statements[1]).to.be.instanceof(Statement_1.FunctionStatement);
901
909
  fn = statements[1];
902
- (0, chai_1.expect)(fn.annotations).to.exist;
903
- (0, chai_1.expect)(fn.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
904
- (0, chai_1.expect)(fn.annotations[0].nameToken.text).to.equal('meta2');
910
+ (0, chai_config_spec_1.expect)(fn.annotations).to.exist;
911
+ (0, chai_config_spec_1.expect)(fn.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
912
+ (0, chai_config_spec_1.expect)(fn.annotations[0].nameToken.text).to.equal('meta2');
905
913
  });
906
914
  it('attaches annotations inside a function body', () => {
907
915
  var _a, _b;
@@ -911,13 +919,13 @@ describe('parser', () => {
911
919
  print "hello"
912
920
  end function
913
921
  `, Parser_1.ParseMode.BrighterScript);
914
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
922
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
915
923
  let fn = statements[0];
916
924
  let fnStatements = fn.func.body.statements;
917
925
  let stat = fnStatements[0];
918
- (0, chai_1.expect)(stat).to.exist;
919
- (0, chai_1.expect)((_b = stat.annotations) === null || _b === void 0 ? void 0 : _b.length).to.equal(1);
920
- (0, chai_1.expect)(stat.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
926
+ (0, chai_config_spec_1.expect)(stat).to.exist;
927
+ (0, chai_config_spec_1.expect)((_b = stat.annotations) === null || _b === void 0 ? void 0 : _b.length).to.equal(1);
928
+ (0, chai_config_spec_1.expect)(stat.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
921
929
  });
922
930
  it('attaches multiple annotations to next statement', () => {
923
931
  var _a;
@@ -927,14 +935,14 @@ describe('parser', () => {
927
935
  function main()
928
936
  end function
929
937
  `, Parser_1.ParseMode.BrighterScript);
930
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
931
- (0, chai_1.expect)(statements[0]).to.be.instanceof(Statement_1.FunctionStatement);
938
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
939
+ (0, chai_config_spec_1.expect)(statements[0]).to.be.instanceof(Statement_1.FunctionStatement);
932
940
  let fn = statements[0];
933
- (0, chai_1.expect)(fn.annotations).to.exist;
934
- (0, chai_1.expect)(fn.annotations.length).to.equal(3);
935
- (0, chai_1.expect)(fn.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
936
- (0, chai_1.expect)(fn.annotations[1]).to.be.instanceof(Expression_1.AnnotationExpression);
937
- (0, chai_1.expect)(fn.annotations[2]).to.be.instanceof(Expression_1.AnnotationExpression);
941
+ (0, chai_config_spec_1.expect)(fn.annotations).to.exist;
942
+ (0, chai_config_spec_1.expect)(fn.annotations.length).to.equal(3);
943
+ (0, chai_config_spec_1.expect)(fn.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
944
+ (0, chai_config_spec_1.expect)(fn.annotations[1]).to.be.instanceof(Expression_1.AnnotationExpression);
945
+ (0, chai_config_spec_1.expect)(fn.annotations[2]).to.be.instanceof(Expression_1.AnnotationExpression);
938
946
  });
939
947
  it('allows annotations with parameters', () => {
940
948
  var _a;
@@ -943,12 +951,12 @@ describe('parser', () => {
943
951
  function main()
944
952
  end function
945
953
  `, Parser_1.ParseMode.BrighterScript);
946
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
954
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
947
955
  let fn = statements[0];
948
- (0, chai_1.expect)(fn.annotations).to.exist;
949
- (0, chai_1.expect)(fn.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
950
- (0, chai_1.expect)(fn.annotations[0].nameToken.text).to.equal('meta1');
951
- (0, chai_1.expect)(fn.annotations[0].call).to.be.instanceof(Expression_1.CallExpression);
956
+ (0, chai_config_spec_1.expect)(fn.annotations).to.exist;
957
+ (0, chai_config_spec_1.expect)(fn.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
958
+ (0, chai_config_spec_1.expect)(fn.annotations[0].nameToken.text).to.equal('meta1');
959
+ (0, chai_config_spec_1.expect)(fn.annotations[0].call).to.be.instanceof(Expression_1.CallExpression);
952
960
  });
953
961
  it('attaches annotations to a class', () => {
954
962
  var _a, _b;
@@ -960,10 +968,10 @@ describe('parser', () => {
960
968
  end function
961
969
  end class
962
970
  `, Parser_1.ParseMode.BrighterScript);
963
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
971
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
964
972
  let cs = statements[0];
965
- (0, chai_1.expect)((_b = cs.annotations) === null || _b === void 0 ? void 0 : _b.length).to.equal(1);
966
- (0, chai_1.expect)(cs.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
973
+ (0, chai_config_spec_1.expect)((_b = cs.annotations) === null || _b === void 0 ? void 0 : _b.length).to.equal(1);
974
+ (0, chai_config_spec_1.expect)(cs.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
967
975
  });
968
976
  it('attaches annotations to multiple clases', () => {
969
977
  var _a, _b, _c;
@@ -981,15 +989,15 @@ describe('parser', () => {
981
989
  end function
982
990
  end class
983
991
  `, Parser_1.ParseMode.BrighterScript);
984
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
992
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
985
993
  let cs = statements[0];
986
- (0, chai_1.expect)((_b = cs.annotations) === null || _b === void 0 ? void 0 : _b.length).to.equal(1);
987
- (0, chai_1.expect)(cs.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
988
- (0, chai_1.expect)(cs.annotations[0].name).to.equal('meta1');
994
+ (0, chai_config_spec_1.expect)((_b = cs.annotations) === null || _b === void 0 ? void 0 : _b.length).to.equal(1);
995
+ (0, chai_config_spec_1.expect)(cs.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
996
+ (0, chai_config_spec_1.expect)(cs.annotations[0].name).to.equal('meta1');
989
997
  let cs2 = statements[1];
990
- (0, chai_1.expect)((_c = cs2.annotations) === null || _c === void 0 ? void 0 : _c.length).to.equal(1);
991
- (0, chai_1.expect)(cs2.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
992
- (0, chai_1.expect)(cs2.annotations[0].name).to.equal('meta2');
998
+ (0, chai_config_spec_1.expect)((_c = cs2.annotations) === null || _c === void 0 ? void 0 : _c.length).to.equal(1);
999
+ (0, chai_config_spec_1.expect)(cs2.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
1000
+ (0, chai_config_spec_1.expect)(cs2.annotations[0].name).to.equal('meta2');
993
1001
  });
994
1002
  it('attaches annotations to a namespaced class', () => {
995
1003
  var _a, _b;
@@ -1003,11 +1011,11 @@ describe('parser', () => {
1003
1011
  end class
1004
1012
  end namespace
1005
1013
  `, Parser_1.ParseMode.BrighterScript);
1006
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
1014
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
1007
1015
  let ns = statements[0];
1008
1016
  let cs = ns.body.statements[0];
1009
- (0, chai_1.expect)((_b = cs.annotations) === null || _b === void 0 ? void 0 : _b.length).to.equal(1);
1010
- (0, chai_1.expect)(cs.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
1017
+ (0, chai_config_spec_1.expect)((_b = cs.annotations) === null || _b === void 0 ? void 0 : _b.length).to.equal(1);
1018
+ (0, chai_config_spec_1.expect)(cs.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
1011
1019
  });
1012
1020
  it('attaches annotations to a namespaced class - multiple', () => {
1013
1021
  var _a, _b, _c;
@@ -1027,16 +1035,16 @@ describe('parser', () => {
1027
1035
  end class
1028
1036
  end namespace
1029
1037
  `, Parser_1.ParseMode.BrighterScript);
1030
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
1038
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
1031
1039
  let ns = statements[0];
1032
1040
  let cs = ns.body.statements[0];
1033
- (0, chai_1.expect)((_b = cs.annotations) === null || _b === void 0 ? void 0 : _b.length).to.equal(1);
1034
- (0, chai_1.expect)(cs.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
1035
- (0, chai_1.expect)(cs.annotations[0].name).to.equal('meta1');
1041
+ (0, chai_config_spec_1.expect)((_b = cs.annotations) === null || _b === void 0 ? void 0 : _b.length).to.equal(1);
1042
+ (0, chai_config_spec_1.expect)(cs.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
1043
+ (0, chai_config_spec_1.expect)(cs.annotations[0].name).to.equal('meta1');
1036
1044
  let cs2 = ns.body.statements[1];
1037
- (0, chai_1.expect)((_c = cs2.annotations) === null || _c === void 0 ? void 0 : _c.length).to.equal(1);
1038
- (0, chai_1.expect)(cs2.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
1039
- (0, chai_1.expect)(cs2.annotations[0].name).to.equal('meta2');
1045
+ (0, chai_config_spec_1.expect)((_c = cs2.annotations) === null || _c === void 0 ? void 0 : _c.length).to.equal(1);
1046
+ (0, chai_config_spec_1.expect)(cs2.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
1047
+ (0, chai_config_spec_1.expect)(cs2.annotations[0].name).to.equal('meta2');
1040
1048
  });
1041
1049
  it('attaches annotations to a class constructor', () => {
1042
1050
  var _a, _b;
@@ -1051,11 +1059,11 @@ describe('parser', () => {
1051
1059
  end function
1052
1060
  end class
1053
1061
  `, Parser_1.ParseMode.BrighterScript);
1054
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
1062
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
1055
1063
  let cs = statements[0];
1056
1064
  let stat = cs.body[0];
1057
- (0, chai_1.expect)((_b = stat.annotations) === null || _b === void 0 ? void 0 : _b.length).to.equal(1);
1058
- (0, chai_1.expect)(stat.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
1065
+ (0, chai_config_spec_1.expect)((_b = stat.annotations) === null || _b === void 0 ? void 0 : _b.length).to.equal(1);
1066
+ (0, chai_config_spec_1.expect)(stat.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
1059
1067
  });
1060
1068
  it('attaches annotations to a class methods', () => {
1061
1069
  var _a, _b;
@@ -1070,11 +1078,11 @@ describe('parser', () => {
1070
1078
  end function
1071
1079
  end class
1072
1080
  `, Parser_1.ParseMode.BrighterScript);
1073
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
1081
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
1074
1082
  let cs = statements[0];
1075
1083
  let stat = cs.body[1];
1076
- (0, chai_1.expect)((_b = stat.annotations) === null || _b === void 0 ? void 0 : _b.length).to.equal(1);
1077
- (0, chai_1.expect)(stat.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
1084
+ (0, chai_config_spec_1.expect)((_b = stat.annotations) === null || _b === void 0 ? void 0 : _b.length).to.equal(1);
1085
+ (0, chai_config_spec_1.expect)(stat.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
1078
1086
  });
1079
1087
  it('attaches annotations to a class methods, fields and constructor', () => {
1080
1088
  var _a, _b, _c, _d, _e;
@@ -1098,19 +1106,19 @@ describe('parser', () => {
1098
1106
  public foo="bar"
1099
1107
  end class
1100
1108
  `, Parser_1.ParseMode.BrighterScript);
1101
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
1109
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
1102
1110
  let cs = statements[0];
1103
- (0, chai_1.expect)((_b = cs.annotations) === null || _b === void 0 ? void 0 : _b.length).to.equal(2);
1104
- (0, chai_1.expect)(cs.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
1111
+ (0, chai_config_spec_1.expect)((_b = cs.annotations) === null || _b === void 0 ? void 0 : _b.length).to.equal(2);
1112
+ (0, chai_config_spec_1.expect)(cs.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
1105
1113
  let stat1 = cs.body[0];
1106
1114
  let stat2 = cs.body[1];
1107
1115
  let f1 = cs.body[2];
1108
- (0, chai_1.expect)((_c = stat1.annotations) === null || _c === void 0 ? void 0 : _c.length).to.equal(2);
1109
- (0, chai_1.expect)(stat1.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
1110
- (0, chai_1.expect)((_d = stat2.annotations) === null || _d === void 0 ? void 0 : _d.length).to.equal(2);
1111
- (0, chai_1.expect)(stat2.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
1112
- (0, chai_1.expect)((_e = f1.annotations) === null || _e === void 0 ? void 0 : _e.length).to.equal(2);
1113
- (0, chai_1.expect)(f1.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
1116
+ (0, chai_config_spec_1.expect)((_c = stat1.annotations) === null || _c === void 0 ? void 0 : _c.length).to.equal(2);
1117
+ (0, chai_config_spec_1.expect)(stat1.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
1118
+ (0, chai_config_spec_1.expect)((_d = stat2.annotations) === null || _d === void 0 ? void 0 : _d.length).to.equal(2);
1119
+ (0, chai_config_spec_1.expect)(stat2.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
1120
+ (0, chai_config_spec_1.expect)((_e = f1.annotations) === null || _e === void 0 ? void 0 : _e.length).to.equal(2);
1121
+ (0, chai_config_spec_1.expect)(f1.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
1114
1122
  });
1115
1123
  it('ignores annotations on commented out lines', () => {
1116
1124
  var _a;
@@ -1121,9 +1129,9 @@ describe('parser', () => {
1121
1129
  print "hello"
1122
1130
  end function
1123
1131
  `, Parser_1.ParseMode.BrighterScript);
1124
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
1132
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
1125
1133
  let cs = statements[0];
1126
- (0, chai_1.expect)(cs.annotations).to.be.undefined;
1134
+ (0, chai_config_spec_1.expect)(cs.annotations).to.be.undefined;
1127
1135
  });
1128
1136
  it('can convert argument of an annotation to JS types', () => {
1129
1137
  var _a;
@@ -1141,22 +1149,22 @@ describe('parser', () => {
1141
1149
  sub init()
1142
1150
  end sub
1143
1151
  `, Parser_1.ParseMode.BrighterScript);
1144
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
1145
- (0, chai_1.expect)(statements[0]).to.be.instanceof(Statement_1.FunctionStatement);
1152
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
1153
+ (0, chai_config_spec_1.expect)(statements[0]).to.be.instanceof(Statement_1.FunctionStatement);
1146
1154
  let fn = statements[0];
1147
- (0, chai_1.expect)(fn.annotations).to.exist;
1148
- (0, chai_1.expect)(fn.annotations[0].getArguments()).to.deep.equal([]);
1149
- (0, chai_1.expect)(statements[1]).to.be.instanceof(Statement_1.FunctionStatement);
1155
+ (0, chai_config_spec_1.expect)(fn.annotations).to.exist;
1156
+ (0, chai_config_spec_1.expect)(fn.annotations[0].getArguments()).to.deep.equal([]);
1157
+ (0, chai_config_spec_1.expect)(statements[1]).to.be.instanceof(Statement_1.FunctionStatement);
1150
1158
  fn = statements[1];
1151
- (0, chai_1.expect)(fn.annotations).to.exist;
1152
- (0, chai_1.expect)(fn.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
1153
- (0, chai_1.expect)(fn.annotations[0].getArguments()).to.deep.equal([
1159
+ (0, chai_config_spec_1.expect)(fn.annotations).to.exist;
1160
+ (0, chai_config_spec_1.expect)(fn.annotations[0]).to.be.instanceof(Expression_1.AnnotationExpression);
1161
+ (0, chai_config_spec_1.expect)(fn.annotations[0].getArguments()).to.deep.equal([
1154
1162
  'arg', 2, true,
1155
1163
  { prop: 'value' }, [1, 2],
1156
1164
  null
1157
1165
  ]);
1158
1166
  let allArgs = fn.annotations[0].getArguments(false);
1159
- (0, chai_1.expect)(allArgs.pop()).to.be.instanceOf(Expression_1.FunctionExpression);
1167
+ (0, chai_config_spec_1.expect)(allArgs.pop()).to.be.instanceOf(Expression_1.FunctionExpression);
1160
1168
  });
1161
1169
  it('can handle negative numbers', () => {
1162
1170
  var _a;
@@ -1168,11 +1176,11 @@ describe('parser', () => {
1168
1176
  sub init()
1169
1177
  end sub
1170
1178
  `, Parser_1.ParseMode.BrighterScript);
1171
- (0, chai_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
1172
- (0, chai_1.expect)(statements[0]).to.be.instanceof(Statement_1.FunctionStatement);
1179
+ (0, chai_config_spec_1.expect)((_a = diagnostics[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
1180
+ (0, chai_config_spec_1.expect)(statements[0]).to.be.instanceof(Statement_1.FunctionStatement);
1173
1181
  let fn = statements[0];
1174
- (0, chai_1.expect)(fn.annotations).to.exist;
1175
- (0, chai_1.expect)(fn.annotations[0].getArguments()).to.deep.equal([-100]);
1182
+ (0, chai_config_spec_1.expect)(fn.annotations).to.exist;
1183
+ (0, chai_config_spec_1.expect)(fn.annotations[0].getArguments()).to.deep.equal([-100]);
1176
1184
  });
1177
1185
  });
1178
1186
  });
@@ -1193,14 +1201,14 @@ function rangeToArray(range) {
1193
1201
  exports.rangeToArray = rangeToArray;
1194
1202
  function expectCommentWithText(stat, text) {
1195
1203
  if ((0, reflection_1.isCommentStatement)(stat)) {
1196
- (0, chai_1.expect)(stat.text).to.equal(text);
1204
+ (0, chai_config_spec_1.expect)(stat.text).to.equal(text);
1197
1205
  }
1198
1206
  else {
1199
1207
  failStatementType(stat, 'Comment');
1200
1208
  }
1201
1209
  }
1202
1210
  function failStatementType(stat, type) {
1203
- chai_1.assert.fail(`Statement ${stat.constructor.name} line ${stat.range.start.line} is not a ${type}`);
1211
+ chai_config_spec_1.assert.fail(`Statement ${stat.constructor.name} line ${stat.range.start.line} is not a ${type}`);
1204
1212
  }
1205
1213
  exports.failStatementType = failStatementType;
1206
1214
  //# sourceMappingURL=Parser.spec.js.map