brighterscript 1.0.0-alpha.1 → 1.0.0-alpha.13

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 (316) hide show
  1. package/CHANGELOG.md +362 -248
  2. package/README.md +2 -2
  3. package/bsconfig.schema.json +1 -1
  4. package/dist/CodeActionUtil.d.ts +11 -2
  5. package/dist/CodeActionUtil.js +17 -3
  6. package/dist/CodeActionUtil.js.map +1 -1
  7. package/dist/CommentFlagProcessor.d.ts +4 -4
  8. package/dist/CommentFlagProcessor.js +5 -3
  9. package/dist/CommentFlagProcessor.js.map +1 -1
  10. package/dist/DependencyGraph.js.map +1 -1
  11. package/dist/DiagnosticCollection.js +2 -2
  12. package/dist/DiagnosticCollection.js.map +1 -1
  13. package/dist/DiagnosticFilterer.js +3 -3
  14. package/dist/DiagnosticFilterer.js.map +1 -1
  15. package/dist/DiagnosticMessages.d.ts +15 -5
  16. package/dist/DiagnosticMessages.js +19 -9
  17. package/dist/DiagnosticMessages.js.map +1 -1
  18. package/dist/LanguageServer.d.ts +11 -10
  19. package/dist/LanguageServer.js +87 -58
  20. package/dist/LanguageServer.js.map +1 -1
  21. package/dist/Logger.d.ts +2 -0
  22. package/dist/Logger.js +5 -3
  23. package/dist/Logger.js.map +1 -1
  24. package/dist/Program.d.ts +76 -46
  25. package/dist/Program.js +254 -180
  26. package/dist/Program.js.map +1 -1
  27. package/dist/ProgramBuilder.d.ts +7 -7
  28. package/dist/ProgramBuilder.js +37 -43
  29. package/dist/ProgramBuilder.js.map +1 -1
  30. package/dist/Scope.d.ts +33 -23
  31. package/dist/Scope.js +222 -147
  32. package/dist/Scope.js.map +1 -1
  33. package/dist/SemanticTokenUtils.d.ts +14 -0
  34. package/dist/SemanticTokenUtils.js +81 -0
  35. package/dist/SemanticTokenUtils.js.map +1 -0
  36. package/dist/SymbolTable.d.ts +9 -3
  37. package/dist/SymbolTable.js +40 -13
  38. package/dist/SymbolTable.js.map +1 -1
  39. package/dist/XmlScope.d.ts +7 -2
  40. package/dist/XmlScope.js +67 -29
  41. package/dist/XmlScope.js.map +1 -1
  42. package/dist/astUtils/AstEditor.d.ts +27 -0
  43. package/dist/astUtils/AstEditor.js +97 -0
  44. package/dist/astUtils/AstEditor.js.map +1 -0
  45. package/dist/astUtils/AstEditor.spec.d.ts +1 -0
  46. package/dist/astUtils/AstEditor.spec.js +133 -0
  47. package/dist/astUtils/AstEditor.spec.js.map +1 -0
  48. package/dist/astUtils/creators.d.ts +15 -1
  49. package/dist/astUtils/creators.js +39 -9
  50. package/dist/astUtils/creators.js.map +1 -1
  51. package/dist/astUtils/creators.spec.js +4 -4
  52. package/dist/astUtils/creators.spec.js.map +1 -1
  53. package/dist/astUtils/index.js +1 -1
  54. package/dist/astUtils/reflection.d.ts +20 -8
  55. package/dist/astUtils/reflection.js +42 -1
  56. package/dist/astUtils/reflection.js.map +1 -1
  57. package/dist/astUtils/reflection.spec.js +115 -115
  58. package/dist/astUtils/reflection.spec.js.map +1 -1
  59. package/dist/astUtils/stackedVisitor.js.map +1 -1
  60. package/dist/astUtils/stackedVisitor.spec.js +13 -13
  61. package/dist/astUtils/stackedVisitor.spec.js.map +1 -1
  62. package/dist/astUtils/visitors.js +1 -1
  63. package/dist/astUtils/visitors.js.map +1 -1
  64. package/dist/astUtils/visitors.spec.js +28 -28
  65. package/dist/astUtils/visitors.spec.js.map +1 -1
  66. package/dist/astUtils/xml.d.ts +4 -3
  67. package/dist/astUtils/xml.js +8 -3
  68. package/dist/astUtils/xml.js.map +1 -1
  69. package/dist/bscPlugin/BscPlugin.d.ts +2 -1
  70. package/dist/bscPlugin/BscPlugin.js +4 -0
  71. package/dist/bscPlugin/BscPlugin.js.map +1 -1
  72. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +5 -6
  73. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
  74. package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js +30 -30
  75. package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js.map +1 -1
  76. package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.d.ts +7 -0
  77. package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.js +63 -0
  78. package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.js.map +1 -0
  79. package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.spec.d.ts +1 -0
  80. package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.spec.js +45 -0
  81. package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.spec.js.map +1 -0
  82. package/dist/diagnosticUtils.d.ts +1 -0
  83. package/dist/diagnosticUtils.js +14 -7
  84. package/dist/diagnosticUtils.js.map +1 -1
  85. package/dist/examples/plugins/removePrint.js +2 -2
  86. package/dist/examples/plugins/removePrint.js.map +1 -1
  87. package/dist/files/BrsFile.Class.spec.js +486 -71
  88. package/dist/files/BrsFile.Class.spec.js.map +1 -1
  89. package/dist/files/BrsFile.d.ts +48 -23
  90. package/dist/files/BrsFile.js +403 -233
  91. package/dist/files/BrsFile.js.map +1 -1
  92. package/dist/files/BrsFile.spec.js +367 -316
  93. package/dist/files/BrsFile.spec.js.map +1 -1
  94. package/dist/files/XmlFile.d.ts +13 -6
  95. package/dist/files/XmlFile.js +27 -21
  96. package/dist/files/XmlFile.js.map +1 -1
  97. package/dist/files/XmlFile.spec.js +274 -228
  98. package/dist/files/XmlFile.spec.js.map +1 -1
  99. package/dist/files/tests/imports.spec.js +49 -49
  100. package/dist/files/tests/imports.spec.js.map +1 -1
  101. package/dist/globalCallables.d.ts +3 -1
  102. package/dist/globalCallables.js +359 -87
  103. package/dist/globalCallables.js.map +1 -1
  104. package/dist/index.js +2 -1
  105. package/dist/index.js.map +1 -1
  106. package/dist/interfaces.d.ts +51 -14
  107. package/dist/lexer/Lexer.d.ts +14 -1
  108. package/dist/lexer/Lexer.js +91 -21
  109. package/dist/lexer/Lexer.js.map +1 -1
  110. package/dist/lexer/Lexer.spec.js +187 -132
  111. package/dist/lexer/Lexer.spec.js.map +1 -1
  112. package/dist/lexer/Token.d.ts +2 -2
  113. package/dist/lexer/TokenKind.d.ts +7 -1
  114. package/dist/lexer/TokenKind.js +51 -3
  115. package/dist/lexer/TokenKind.js.map +1 -1
  116. package/dist/lexer/index.js +2 -1
  117. package/dist/lexer/index.js.map +1 -1
  118. package/dist/parser/BrsTranspileState.d.ts +7 -0
  119. package/dist/parser/BrsTranspileState.js +10 -1
  120. package/dist/parser/BrsTranspileState.js.map +1 -1
  121. package/dist/parser/Expression.d.ts +23 -5
  122. package/dist/parser/Expression.js +124 -75
  123. package/dist/parser/Expression.js.map +1 -1
  124. package/dist/parser/Parser.Class.spec.js +159 -60
  125. package/dist/parser/Parser.Class.spec.js.map +1 -1
  126. package/dist/parser/Parser.d.ts +114 -26
  127. package/dist/parser/Parser.js +471 -126
  128. package/dist/parser/Parser.js.map +1 -1
  129. package/dist/parser/Parser.spec.js +396 -235
  130. package/dist/parser/Parser.spec.js.map +1 -1
  131. package/dist/parser/SGParser.d.ts +41 -4
  132. package/dist/parser/SGParser.js +186 -175
  133. package/dist/parser/SGParser.js.map +1 -1
  134. package/dist/parser/SGParser.spec.js +35 -22
  135. package/dist/parser/SGParser.spec.js.map +1 -1
  136. package/dist/parser/SGTypes.d.ts +206 -38
  137. package/dist/parser/SGTypes.js +470 -161
  138. package/dist/parser/SGTypes.js.map +1 -1
  139. package/dist/parser/SGTypes.spec.d.ts +1 -0
  140. package/dist/parser/SGTypes.spec.js +351 -0
  141. package/dist/parser/SGTypes.spec.js.map +1 -0
  142. package/dist/parser/Statement.d.ts +92 -18
  143. package/dist/parser/Statement.js +287 -58
  144. package/dist/parser/Statement.js.map +1 -1
  145. package/dist/parser/Statement.spec.js +11 -11
  146. package/dist/parser/Statement.spec.js.map +1 -1
  147. package/dist/parser/TranspileState.d.ts +1 -1
  148. package/dist/parser/TranspileState.js +15 -7
  149. package/dist/parser/TranspileState.js.map +1 -1
  150. package/dist/parser/index.js +1 -1
  151. package/dist/parser/tests/Parser.spec.d.ts +8 -7
  152. package/dist/parser/tests/Parser.spec.js +12 -8
  153. package/dist/parser/tests/Parser.spec.js.map +1 -1
  154. package/dist/parser/tests/controlFlow/For.spec.js +50 -50
  155. package/dist/parser/tests/controlFlow/For.spec.js.map +1 -1
  156. package/dist/parser/tests/controlFlow/ForEach.spec.js +31 -31
  157. package/dist/parser/tests/controlFlow/ForEach.spec.js.map +1 -1
  158. package/dist/parser/tests/controlFlow/If.spec.js +174 -156
  159. package/dist/parser/tests/controlFlow/If.spec.js.map +1 -1
  160. package/dist/parser/tests/controlFlow/While.spec.js +32 -32
  161. package/dist/parser/tests/controlFlow/While.spec.js.map +1 -1
  162. package/dist/parser/tests/expression/Additive.spec.js +21 -21
  163. package/dist/parser/tests/expression/Additive.spec.js.map +1 -1
  164. package/dist/parser/tests/expression/ArrayLiterals.spec.js +105 -105
  165. package/dist/parser/tests/expression/ArrayLiterals.spec.js.map +1 -1
  166. package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js +148 -124
  167. package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js.map +1 -1
  168. package/dist/parser/tests/expression/Boolean.spec.js +17 -17
  169. package/dist/parser/tests/expression/Boolean.spec.js.map +1 -1
  170. package/dist/parser/tests/expression/Call.spec.js +30 -30
  171. package/dist/parser/tests/expression/Call.spec.js.map +1 -1
  172. package/dist/parser/tests/expression/Exponential.spec.js +16 -16
  173. package/dist/parser/tests/expression/Exponential.spec.js.map +1 -1
  174. package/dist/parser/tests/expression/Function.spec.js +247 -247
  175. package/dist/parser/tests/expression/Function.spec.js.map +1 -1
  176. package/dist/parser/tests/expression/Indexing.spec.js +73 -73
  177. package/dist/parser/tests/expression/Indexing.spec.js.map +1 -1
  178. package/dist/parser/tests/expression/Multiplicative.spec.js +36 -36
  179. package/dist/parser/tests/expression/Multiplicative.spec.js.map +1 -1
  180. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +59 -47
  181. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +1 -1
  182. package/dist/parser/tests/expression/PrefixUnary.spec.js +35 -35
  183. package/dist/parser/tests/expression/PrefixUnary.spec.js.map +1 -1
  184. package/dist/parser/tests/expression/Primary.spec.js +26 -26
  185. package/dist/parser/tests/expression/Primary.spec.js.map +1 -1
  186. package/dist/parser/tests/expression/RegexLiteralExpression.spec.d.ts +1 -0
  187. package/dist/parser/tests/expression/RegexLiteralExpression.spec.js +170 -0
  188. package/dist/parser/tests/expression/RegexLiteralExpression.spec.js.map +1 -0
  189. package/dist/parser/tests/expression/Relational.spec.js +42 -42
  190. package/dist/parser/tests/expression/Relational.spec.js.map +1 -1
  191. package/dist/parser/tests/expression/SourceLiteralExpression.spec.js +8 -8
  192. package/dist/parser/tests/expression/SourceLiteralExpression.spec.js.map +1 -1
  193. package/dist/parser/tests/expression/TemplateStringExpression.spec.js +12 -12
  194. package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +1 -1
  195. package/dist/parser/tests/expression/TernaryExpression.spec.js +100 -100
  196. package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
  197. package/dist/parser/tests/statement/AssignmentOperators.spec.js +35 -35
  198. package/dist/parser/tests/statement/AssignmentOperators.spec.js.map +1 -1
  199. package/dist/parser/tests/statement/Declaration.spec.js +39 -39
  200. package/dist/parser/tests/statement/Declaration.spec.js.map +1 -1
  201. package/dist/parser/tests/statement/Dim.spec.js +21 -21
  202. package/dist/parser/tests/statement/Dim.spec.js.map +1 -1
  203. package/dist/parser/tests/statement/Function.spec.js +192 -192
  204. package/dist/parser/tests/statement/Function.spec.js.map +1 -1
  205. package/dist/parser/tests/statement/Goto.spec.js +11 -11
  206. package/dist/parser/tests/statement/Goto.spec.js.map +1 -1
  207. package/dist/parser/tests/statement/Increment.spec.js +46 -46
  208. package/dist/parser/tests/statement/Increment.spec.js.map +1 -1
  209. package/dist/parser/tests/statement/InterfaceStatement.spec.d.ts +1 -0
  210. package/dist/parser/tests/statement/InterfaceStatement.spec.js +61 -0
  211. package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +1 -0
  212. package/dist/parser/tests/statement/LibraryStatement.spec.js +10 -10
  213. package/dist/parser/tests/statement/LibraryStatement.spec.js.map +1 -1
  214. package/dist/parser/tests/statement/Misc.spec.js +37 -36
  215. package/dist/parser/tests/statement/Misc.spec.js.map +1 -1
  216. package/dist/parser/tests/statement/PrintStatement.spec.js +30 -30
  217. package/dist/parser/tests/statement/PrintStatement.spec.js.map +1 -1
  218. package/dist/parser/tests/statement/ReturnStatement.spec.js +43 -43
  219. package/dist/parser/tests/statement/ReturnStatement.spec.js.map +1 -1
  220. package/dist/parser/tests/statement/Set.spec.js +69 -69
  221. package/dist/parser/tests/statement/Set.spec.js.map +1 -1
  222. package/dist/parser/tests/statement/Stop.spec.js +9 -9
  223. package/dist/parser/tests/statement/Stop.spec.js.map +1 -1
  224. package/dist/parser/tests/statement/Throw.spec.js +5 -5
  225. package/dist/parser/tests/statement/Throw.spec.js.map +1 -1
  226. package/dist/parser/tests/statement/TryCatch.spec.js +13 -13
  227. package/dist/parser/tests/statement/TryCatch.spec.js.map +1 -1
  228. package/dist/preprocessor/Chunk.js.map +1 -1
  229. package/dist/preprocessor/Manifest.d.ts +1 -1
  230. package/dist/preprocessor/Preprocessor.js +1 -1
  231. package/dist/preprocessor/Preprocessor.js.map +1 -1
  232. package/dist/preprocessor/Preprocessor.spec.js +49 -49
  233. package/dist/preprocessor/Preprocessor.spec.js.map +1 -1
  234. package/dist/preprocessor/PreprocessorParser.spec.js +72 -72
  235. package/dist/preprocessor/PreprocessorParser.spec.js.map +1 -1
  236. package/dist/preprocessor/index.js +1 -1
  237. package/dist/types/ArrayType.js +5 -4
  238. package/dist/types/ArrayType.js.map +1 -1
  239. package/dist/types/ArrayType.spec.js +8 -8
  240. package/dist/types/ArrayType.spec.js.map +1 -1
  241. package/dist/types/BooleanType.js +3 -3
  242. package/dist/types/BooleanType.js.map +1 -1
  243. package/dist/types/BooleanType.spec.js +2 -2
  244. package/dist/types/BooleanType.spec.js.map +1 -1
  245. package/dist/types/BscType.d.ts +19 -5
  246. package/dist/types/BscType.js +9 -0
  247. package/dist/types/BscType.js.map +1 -1
  248. package/dist/types/CustomType.d.ts +8 -5
  249. package/dist/types/CustomType.js +17 -6
  250. package/dist/types/CustomType.js.map +1 -1
  251. package/dist/types/DoubleType.js +8 -8
  252. package/dist/types/DoubleType.js.map +1 -1
  253. package/dist/types/DoubleType.spec.js +2 -2
  254. package/dist/types/DoubleType.spec.js.map +1 -1
  255. package/dist/types/DynamicType.js +1 -1
  256. package/dist/types/DynamicType.js.map +1 -1
  257. package/dist/types/DynamicType.spec.js +2 -2
  258. package/dist/types/DynamicType.spec.js.map +1 -1
  259. package/dist/types/FloatType.d.ts +1 -1
  260. package/dist/types/FloatType.js +8 -8
  261. package/dist/types/FloatType.js.map +1 -1
  262. package/dist/types/FloatType.spec.js +2 -2
  263. package/dist/types/FloatType.spec.js.map +1 -1
  264. package/dist/types/FunctionType.d.ts +5 -11
  265. package/dist/types/FunctionType.js +24 -13
  266. package/dist/types/FunctionType.js.map +1 -1
  267. package/dist/types/FunctionType.spec.js +11 -5
  268. package/dist/types/FunctionType.spec.js.map +1 -1
  269. package/dist/types/IntegerType.d.ts +1 -1
  270. package/dist/types/IntegerType.js +8 -8
  271. package/dist/types/IntegerType.js.map +1 -1
  272. package/dist/types/IntegerType.spec.js +2 -2
  273. package/dist/types/IntegerType.spec.js.map +1 -1
  274. package/dist/types/InterfaceType.d.ts +8 -2
  275. package/dist/types/InterfaceType.js +42 -6
  276. package/dist/types/InterfaceType.js.map +1 -1
  277. package/dist/types/InterfaceType.spec.d.ts +1 -0
  278. package/dist/types/InterfaceType.spec.js +174 -0
  279. package/dist/types/InterfaceType.spec.js.map +1 -0
  280. package/dist/types/InvalidType.js +4 -4
  281. package/dist/types/InvalidType.js.map +1 -1
  282. package/dist/types/InvalidType.spec.js +2 -2
  283. package/dist/types/InvalidType.spec.js.map +1 -1
  284. package/dist/types/LazyType.d.ts +9 -7
  285. package/dist/types/LazyType.js +22 -10
  286. package/dist/types/LazyType.js.map +1 -1
  287. package/dist/types/LongIntegerType.d.ts +1 -1
  288. package/dist/types/LongIntegerType.js +8 -8
  289. package/dist/types/LongIntegerType.js.map +1 -1
  290. package/dist/types/LongIntegerType.spec.js +2 -2
  291. package/dist/types/LongIntegerType.spec.js.map +1 -1
  292. package/dist/types/ObjectType.d.ts +7 -4
  293. package/dist/types/ObjectType.js +6 -3
  294. package/dist/types/ObjectType.js.map +1 -1
  295. package/dist/types/ObjectType.spec.js +2 -2
  296. package/dist/types/ObjectType.spec.js.map +1 -1
  297. package/dist/types/StringType.js +3 -3
  298. package/dist/types/StringType.js.map +1 -1
  299. package/dist/types/StringType.spec.js +2 -2
  300. package/dist/types/StringType.spec.js.map +1 -1
  301. package/dist/types/UninitializedType.js +3 -3
  302. package/dist/types/UninitializedType.js.map +1 -1
  303. package/dist/types/VoidType.js +3 -3
  304. package/dist/types/VoidType.js.map +1 -1
  305. package/dist/types/VoidType.spec.js +2 -2
  306. package/dist/types/VoidType.spec.js.map +1 -1
  307. package/dist/types/helpers.d.ts +42 -0
  308. package/dist/types/helpers.js +113 -0
  309. package/dist/types/helpers.js.map +1 -0
  310. package/dist/util.d.ts +77 -17
  311. package/dist/util.js +247 -59
  312. package/dist/util.js.map +1 -1
  313. package/dist/validators/ClassValidator.d.ts +5 -1
  314. package/dist/validators/ClassValidator.js +59 -24
  315. package/dist/validators/ClassValidator.js.map +1 -1
  316. package/package.json +13 -13
@@ -22,12 +22,12 @@ const Logger_1 = require("../Logger");
22
22
  const VoidType_1 = require("../types/VoidType");
23
23
  let sinon = sinonImport.createSandbox();
24
24
  describe('BrsFile', () => {
25
- let rootDir = util_1.standardizePath `${process.cwd()}/.tmp/rootDir`;
25
+ let rootDir = (0, util_1.standardizePath) `${process.cwd()}/.tmp/rootDir`;
26
26
  let program;
27
- let srcPath = util_1.standardizePath `${rootDir}/source/main.brs`;
27
+ let srcPath = (0, util_1.standardizePath) `${rootDir}/source/main.brs`;
28
28
  let destPath = 'source/main.brs';
29
29
  let file;
30
- let testTranspile = testHelpers_spec_1.getTestTranspile(() => [program, rootDir]);
30
+ let testTranspile = (0, testHelpers_spec_1.getTestTranspile)(() => [program, rootDir]);
31
31
  beforeEach(() => {
32
32
  program = new Program_1.Program({ rootDir: rootDir, sourceMap: true });
33
33
  file = new BrsFile_1.BrsFile(srcPath, destPath, program);
@@ -38,19 +38,29 @@ describe('BrsFile', () => {
38
38
  });
39
39
  it('supports the third parameter in CreateObject', () => {
40
40
  var _a;
41
- program.addOrReplaceFile('source/main.brs', `
41
+ program.setFile('source/main.brs', `
42
42
  sub main()
43
43
  regexp = CreateObject("roRegex", "[a-z]+", "i")
44
44
  end sub
45
45
  `);
46
46
  program.validate();
47
- chai_1.expect((_a = program.getDiagnostics()[0]) === null || _a === void 0 ? void 0 : _a.message).to.not.exist;
47
+ (0, chai_1.expect)((_a = program.getDiagnostics()[0]) === null || _a === void 0 ? void 0 : _a.message).to.not.exist;
48
+ });
49
+ it('supports the 6 params in CreateObject for roRegion', () => {
50
+ var _a;
51
+ program.setFile('source/main.brs', `
52
+ sub createRegion(bitmap as object)
53
+ region = CreateObject("roRegion", bitmap, 20, 40, 100, 200)
54
+ end sub
55
+ `);
56
+ program.validate();
57
+ (0, chai_1.expect)((_a = program.getDiagnostics()[0]) === null || _a === void 0 ? void 0 : _a.message).to.not.exist;
48
58
  });
49
59
  it('sets needsTranspiled to true for .bs files', () => {
50
60
  //BrightScript
51
- chai_1.expect(new BrsFile_1.BrsFile(`${rootDir}/source/main.brs`, 'source/main.brs', program).needsTranspiled).to.be.false;
61
+ (0, chai_1.expect)(new BrsFile_1.BrsFile(`${rootDir}/source/main.brs`, 'source/main.brs', program).needsTranspiled).to.be.false;
52
62
  //BrighterScript
53
- chai_1.expect(new BrsFile_1.BrsFile(`${rootDir}/source/main.bs`, 'source/main.bs', program).needsTranspiled).to.be.true;
63
+ (0, chai_1.expect)(new BrsFile_1.BrsFile(`${rootDir}/source/main.bs`, 'source/main.bs', program).needsTranspiled).to.be.true;
54
64
  });
55
65
  it('allows adding diagnostics', () => {
56
66
  const expected = [{
@@ -60,7 +70,7 @@ describe('BrsFile', () => {
60
70
  }];
61
71
  file.addDiagnostics(expected);
62
72
  const actual = file.getDiagnostics();
63
- chai_1.expect(actual).deep.equal(expected);
73
+ (0, chai_1.expect)(actual).deep.equal(expected);
64
74
  });
65
75
  describe('getPartialVariableName', () => {
66
76
  let entry = {
@@ -68,72 +78,72 @@ describe('BrsFile', () => {
68
78
  dest: `source/lib.brs`
69
79
  };
70
80
  it('creates proper tokens', () => {
71
- file = program.addOrReplaceFile(entry, `call(ModuleA.ModuleB.ModuleC.`);
72
- chai_1.expect(file['getPartialVariableName'](file.parser.tokens[7])).to.equal('ModuleA.ModuleB.ModuleC.');
73
- chai_1.expect(file['getPartialVariableName'](file.parser.tokens[6])).to.equal('ModuleA.ModuleB.ModuleC');
74
- chai_1.expect(file['getPartialVariableName'](file.parser.tokens[5])).to.equal('ModuleA.ModuleB.');
75
- chai_1.expect(file['getPartialVariableName'](file.parser.tokens[4])).to.equal('ModuleA.ModuleB');
76
- chai_1.expect(file['getPartialVariableName'](file.parser.tokens[3])).to.equal('ModuleA.');
77
- chai_1.expect(file['getPartialVariableName'](file.parser.tokens[2])).to.equal('ModuleA');
81
+ file = program.setFile(entry, `call(ModuleA.ModuleB.ModuleC.`);
82
+ (0, chai_1.expect)(file['getPartialVariableName'](file.parser.tokens[7])).to.equal('ModuleA.ModuleB.ModuleC.');
83
+ (0, chai_1.expect)(file['getPartialVariableName'](file.parser.tokens[6])).to.equal('ModuleA.ModuleB.ModuleC');
84
+ (0, chai_1.expect)(file['getPartialVariableName'](file.parser.tokens[5])).to.equal('ModuleA.ModuleB.');
85
+ (0, chai_1.expect)(file['getPartialVariableName'](file.parser.tokens[4])).to.equal('ModuleA.ModuleB');
86
+ (0, chai_1.expect)(file['getPartialVariableName'](file.parser.tokens[3])).to.equal('ModuleA.');
87
+ (0, chai_1.expect)(file['getPartialVariableName'](file.parser.tokens[2])).to.equal('ModuleA');
78
88
  });
79
89
  });
80
90
  describe('getScopesForFile', () => {
81
91
  it('finds the scope for the file', () => {
82
92
  var _a;
83
- let file = program.addOrReplaceFile('source/main.brs', ``);
84
- chai_1.expect((_a = program.getScopesForFile(file)[0]) === null || _a === void 0 ? void 0 : _a.name).to.equal('source');
93
+ let file = program.setFile('source/main.brs', ``);
94
+ (0, chai_1.expect)((_a = program.getScopesForFile(file)[0]) === null || _a === void 0 ? void 0 : _a.name).to.equal('source');
85
95
  });
86
96
  });
87
97
  describe('getCompletions', () => {
88
98
  it('does not crash for callfunc on a function call', () => {
89
- const file = program.addOrReplaceFile('source/main.brs', `
99
+ const file = program.setFile('source/main.brs', `
90
100
  sub main()
91
101
  getManager()@.
92
102
  end sub
93
103
  `);
94
- chai_1.expect(() => {
95
- program.getCompletions(file.pathAbsolute, util_1.default.createPosition(2, 34));
104
+ (0, chai_1.expect)(() => {
105
+ program.getCompletions(file.srcPath, util_1.default.createPosition(2, 34));
96
106
  }).not.to.throw;
97
107
  });
98
108
  it('suggests pkg paths in strings that match that criteria', () => {
99
- program.addOrReplaceFile('source/main.brs', `
109
+ program.setFile('source/main.brs', `
100
110
  sub main()
101
111
  print "pkg:"
102
112
  end sub
103
113
  `);
104
114
  const result = program.getCompletions(`${rootDir}/source/main.brs`, vscode_languageserver_1.Position.create(2, 31));
105
115
  const names = result.map(x => x.label);
106
- chai_1.expect(names.sort()).to.eql([
116
+ (0, chai_1.expect)(names.sort()).to.eql([
107
117
  'pkg:/source/main.brs'
108
118
  ]);
109
119
  });
110
120
  it('suggests libpkg paths in strings that match that criteria', () => {
111
- program.addOrReplaceFile('source/main.brs', `
121
+ program.setFile('source/main.brs', `
112
122
  sub main()
113
123
  print "libpkg:"
114
124
  end sub
115
125
  `);
116
126
  const result = program.getCompletions(`${rootDir}/source/main.brs`, vscode_languageserver_1.Position.create(2, 31));
117
127
  const names = result.map(x => x.label);
118
- chai_1.expect(names.sort()).to.eql([
128
+ (0, chai_1.expect)(names.sort()).to.eql([
119
129
  'libpkg:/source/main.brs'
120
130
  ]);
121
131
  });
122
132
  it('suggests pkg paths in template strings', () => {
123
- program.addOrReplaceFile('source/main.brs', `
133
+ program.setFile('source/main.brs', `
124
134
  sub main()
125
135
  print \`pkg:\`
126
136
  end sub
127
137
  `);
128
138
  const result = program.getCompletions(`${rootDir}/source/main.brs`, vscode_languageserver_1.Position.create(2, 31));
129
139
  const names = result.map(x => x.label);
130
- chai_1.expect(names.sort()).to.eql([
140
+ (0, chai_1.expect)(names.sort()).to.eql([
131
141
  'pkg:/source/main.brs'
132
142
  ]);
133
143
  });
134
144
  it('waits for the file to be processed before collecting completions', () => {
135
145
  //eslint-disable-next-line @typescript-eslint/no-floating-promises
136
- program.addOrReplaceFile('source/main.brs', `
146
+ program.setFile('source/main.brs', `
137
147
  sub Main()
138
148
  print "hello"
139
149
  Say
@@ -144,30 +154,30 @@ describe('BrsFile', () => {
144
154
  `);
145
155
  let result = program.getCompletions(`${rootDir}/source/main.brs`, vscode_languageserver_1.Position.create(3, 23));
146
156
  let names = result.map(x => x.label);
147
- chai_1.expect(names).to.includes('Main');
148
- chai_1.expect(names).to.includes('SayHello');
157
+ (0, chai_1.expect)(names).to.includes('Main');
158
+ (0, chai_1.expect)(names).to.includes('SayHello');
149
159
  });
150
160
  it('always includes `m`', () => {
151
161
  //eslint-disable-next-line @typescript-eslint/no-floating-promises
152
- program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
162
+ program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
153
163
  sub Main()
154
164
 
155
165
  end sub
156
166
  `);
157
167
  let result = program.getCompletions(`${rootDir}/source/main.brs`, vscode_languageserver_1.Position.create(2, 23));
158
168
  let names = result.map(x => x.label);
159
- chai_1.expect(names).to.contain('m');
169
+ (0, chai_1.expect)(names).to.contain('m');
160
170
  });
161
171
  it('does not fail for missing previousToken', () => {
162
172
  //add a single character to the file, and get completions after it
163
- program.addOrReplaceFile('source/main.brs', `i`);
164
- chai_1.expect(() => {
173
+ program.setFile('source/main.brs', `i`);
174
+ (0, chai_1.expect)(() => {
165
175
  program.getCompletions(`${rootDir}/source/main.brs`, vscode_languageserver_1.Position.create(0, 1)).map(x => x.label);
166
176
  }).not.to.throw;
167
177
  });
168
178
  it('includes all keywords`', () => {
169
179
  //eslint-disable-next-line @typescript-eslint/no-floating-promises
170
- program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
180
+ program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
171
181
  sub Main()
172
182
 
173
183
  end sub
@@ -177,29 +187,29 @@ describe('BrsFile', () => {
177
187
  let result = program.getCompletions(`${rootDir}/source/main.brs`, vscode_languageserver_1.Position.create(2, 23));
178
188
  let names = result.map(x => x.label);
179
189
  for (let keyword of keywords) {
180
- chai_1.expect(names).to.include(keyword);
190
+ (0, chai_1.expect)(names).to.include(keyword);
181
191
  }
182
192
  //outside the function
183
193
  result = program.getCompletions(`${rootDir}/source/main.brs`, vscode_languageserver_1.Position.create(4, 8));
184
194
  names = result.map(x => x.label);
185
195
  for (let keyword of keywords) {
186
- chai_1.expect(names).to.include(keyword);
196
+ (0, chai_1.expect)(names).to.include(keyword);
187
197
  }
188
198
  });
189
199
  it('does not provide completions within a comment', () => {
190
200
  //eslint-disable-next-line @typescript-eslint/no-floating-promises
191
- program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
201
+ program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
192
202
  sub Main()
193
203
  'some comment
194
204
  end sub
195
205
  `);
196
206
  //inside the function
197
207
  let result = program.getCompletions(`${rootDir}/source/main.brs`, vscode_languageserver_1.Position.create(2, 33));
198
- chai_1.expect(result).to.be.lengthOf(0);
208
+ (0, chai_1.expect)(result).to.be.lengthOf(0);
199
209
  });
200
210
  it('does not provide duplicate entries for variables', () => {
201
211
  //eslint-disable-next-line @typescript-eslint/no-floating-promises
202
- program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
212
+ program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
203
213
  sub Main()
204
214
  name = "bob"
205
215
  age = 12
@@ -210,55 +220,81 @@ describe('BrsFile', () => {
210
220
  let count = result.reduce((total, x) => {
211
221
  return x.label === 'name' ? total + 1 : total;
212
222
  }, 0);
213
- chai_1.expect(count).to.equal(1);
223
+ (0, chai_1.expect)(count).to.equal(1);
214
224
  });
215
225
  it('does not include `as` and `string` text options when used in function params', () => {
216
226
  //eslint-disable-next-line @typescript-eslint/no-floating-promises
217
- program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
227
+ program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
218
228
  sub Main(name as string)
219
229
 
220
230
  end sub
221
231
  `);
222
232
  let result = program.getCompletions(`${rootDir}/source/main.brs`, vscode_languageserver_1.Position.create(2, 23));
223
- chai_1.expect(result.filter(x => x.kind === vscode_languageserver_1.CompletionItemKind.Text)).not.to.contain('as');
224
- chai_1.expect(result.filter(x => x.kind === vscode_languageserver_1.CompletionItemKind.Text)).not.to.contain('string');
233
+ (0, chai_1.expect)(result.filter(x => x.kind === vscode_languageserver_1.CompletionItemKind.Text)).not.to.contain('as');
234
+ (0, chai_1.expect)(result.filter(x => x.kind === vscode_languageserver_1.CompletionItemKind.Text)).not.to.contain('string');
225
235
  });
226
236
  it('does not provide intellisense results when inside a comment', () => {
227
237
  //eslint-disable-next-line @typescript-eslint/no-floating-promises
228
- program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
238
+ program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
229
239
  sub Main(name as string)
230
240
  'this is a comment
231
241
  end sub
232
242
  `);
233
243
  let results = program.getCompletions(`${rootDir}/source/main.brs`, vscode_languageserver_1.Position.create(2, 30));
234
- chai_1.expect(results).to.be.empty;
244
+ (0, chai_1.expect)(results).to.be.empty;
235
245
  });
236
246
  it('does provide intellisence for labels only after a goto keyword', () => {
237
247
  var _a;
238
248
  //eslint-disable-next-line @typescript-eslint/no-floating-promises
239
- program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
249
+ program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
240
250
  sub Main(name as string)
241
251
  something:
242
252
  goto \nend sub
243
253
  `);
244
254
  let results = program.getCompletions(`${rootDir}/source/main.brs`, vscode_languageserver_1.Position.create(3, 25));
245
- chai_1.expect(results.length).to.equal(1);
246
- chai_1.expect((_a = results[0]) === null || _a === void 0 ? void 0 : _a.label).to.equal('something');
255
+ (0, chai_1.expect)(results.length).to.equal(1);
256
+ (0, chai_1.expect)((_a = results[0]) === null || _a === void 0 ? void 0 : _a.label).to.equal('something');
257
+ });
258
+ it('includes properties of objects', () => {
259
+ //eslint-disable-next-line @typescript-eslint/no-floating-promises
260
+ program.setFile('source/main.brs', `
261
+ sub Main()
262
+ myObj = {name:"Bob", age: 34, height:6.0}
263
+ myObj.
264
+ end sub
265
+ `);
266
+ let result = program.getCompletions(`${rootDir}/source/main.brs`, vscode_languageserver_1.Position.create(3, 26));
267
+ let names = result.map(x => x.label);
268
+ (0, chai_1.expect)(names).to.contain('name');
269
+ (0, chai_1.expect)(names).to.contain('age');
270
+ (0, chai_1.expect)(names).to.contain('height');
271
+ });
272
+ it('includes properties of m', () => {
273
+ //eslint-disable-next-line @typescript-eslint/no-floating-promises
274
+ program.setFile('source/main.brs', `
275
+ sub Main()
276
+ m.someField= "hello"
277
+ m.
278
+ end sub
279
+ `);
280
+ let result = program.getCompletions(`${rootDir}/source/main.brs`, vscode_languageserver_1.Position.create(3, 22));
281
+ let names = result.map(x => x.label);
282
+ (0, chai_1.expect)(names).to.contain('someField');
247
283
  });
248
284
  });
249
285
  describe('comment flags', () => {
250
286
  describe('bs:disable-next-line', () => {
251
287
  it('disables critical diagnostic issues', () => {
252
288
  var _a, _b;
253
- program.addOrReplaceFile('source/main.brs', `
289
+ program.setFile('source/main.brs', `
254
290
  sub main()
255
291
  Dim requestData
256
292
  end sub
257
293
  `);
258
294
  //should have an error
259
295
  program.validate();
260
- chai_1.expect((_a = program.getDiagnostics()[0]) === null || _a === void 0 ? void 0 : _a.message).to.exist;
261
- program.addOrReplaceFile('source/main.brs', `
296
+ (0, chai_1.expect)((_a = program.getDiagnostics()[0]) === null || _a === void 0 ? void 0 : _a.message).to.exist;
297
+ program.setFile('source/main.brs', `
262
298
  sub main()
263
299
  'bs:disable-next-line
264
300
  Dim requestData
@@ -266,11 +302,11 @@ describe('BrsFile', () => {
266
302
  `);
267
303
  //should have an error
268
304
  program.validate();
269
- chai_1.expect((_b = program.getDiagnostics()[0]) === null || _b === void 0 ? void 0 : _b.message).not.to.exist;
305
+ (0, chai_1.expect)((_b = program.getDiagnostics()[0]) === null || _b === void 0 ? void 0 : _b.message).not.to.exist;
270
306
  });
271
307
  it('works with leading whitespace', () => {
272
308
  var _a;
273
- program.addOrReplaceFile('source/main.brs', `
309
+ program.setFile('source/main.brs', `
274
310
  sub main()
275
311
  ' bs:disable-next-line
276
312
  =asdf=sadf=
@@ -278,89 +314,104 @@ describe('BrsFile', () => {
278
314
  `);
279
315
  //should have an error
280
316
  program.validate();
281
- chai_1.expect((_a = program.getDiagnostics()[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
317
+ (0, chai_1.expect)((_a = program.getDiagnostics()[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
282
318
  });
283
319
  it('works for all', () => {
284
320
  var _a;
285
- let file = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
321
+ let file = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
286
322
  sub Main()
287
323
  'bs:disable-next-line
288
324
  name = "bob
289
325
  end sub
290
326
  `);
291
- chai_1.expect(file.commentFlags[0]).to.exist;
292
- chai_1.expect(file.commentFlags[0]).to.deep.include({
327
+ (0, chai_1.expect)(file.commentFlags[0]).to.exist;
328
+ (0, chai_1.expect)(file.commentFlags[0]).to.deep.include({
293
329
  codes: null,
294
330
  range: vscode_languageserver_1.Range.create(2, 24, 2, 45),
295
331
  affectedRange: util_1.default.createRange(3, 0, 3, Number.MAX_SAFE_INTEGER)
296
332
  });
297
333
  program.validate();
298
334
  //the "unterminated string" error should be filtered out
299
- chai_1.expect((_a = program.getDiagnostics()[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
335
+ (0, chai_1.expect)((_a = program.getDiagnostics()[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
300
336
  });
301
337
  it('works for specific codes', () => {
302
338
  var _a;
303
- let file = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
339
+ let file = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
304
340
  sub Main()
305
341
  'bs:disable-next-line: 1083, 1001
306
342
  name = "bob
307
343
  end sub
308
344
  `);
309
- chai_1.expect(file.commentFlags[0]).to.exist;
310
- chai_1.expect(file.commentFlags[0]).to.deep.include({
345
+ (0, chai_1.expect)(file.commentFlags[0]).to.exist;
346
+ (0, chai_1.expect)(file.commentFlags[0]).to.deep.include({
311
347
  codes: [1083, 1001],
312
348
  range: vscode_languageserver_1.Range.create(2, 24, 2, 57),
313
349
  affectedRange: util_1.default.createRange(3, 0, 3, Number.MAX_SAFE_INTEGER)
314
350
  });
315
351
  //the "unterminated string" error should be filtered out
316
- chai_1.expect((_a = program.getDiagnostics()[0]) === null || _a === void 0 ? void 0 : _a.message).to.not.exist;
352
+ (0, chai_1.expect)((_a = program.getDiagnostics()[0]) === null || _a === void 0 ? void 0 : _a.message).to.not.exist;
317
353
  });
318
- it('ignores non-numeric codes', () => {
354
+ it('recognizes non-numeric codes', () => {
319
355
  var _a;
320
- let file = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
356
+ let file = program.setFile('source/main.brs', `
321
357
  sub Main()
322
358
  'bs:disable-next-line: LINT9999
323
359
  name = "bob
324
360
  end sub
325
361
  `);
326
- chai_1.expect(file.commentFlags[0]).to.not.exist;
327
- chai_1.expect((_a = program.getDiagnostics()[0]) === null || _a === void 0 ? void 0 : _a.message).to.exist;
362
+ (0, chai_1.expect)(file.commentFlags[0]).to.exist;
363
+ (0, chai_1.expect)((_a = program.getDiagnostics()[0]) === null || _a === void 0 ? void 0 : _a.message).to.exist;
364
+ });
365
+ it('supports disabling non-numeric error codes', () => {
366
+ const program = new Program_1.Program({});
367
+ const file = program.setFile('source/main.brs', `
368
+ sub main()
369
+ something = true 'bs:disable-line: LINT1005
370
+ end sub
371
+ `);
372
+ file.addDiagnostics([{
373
+ code: 'LINT1005',
374
+ file: file,
375
+ message: 'Something is not right',
376
+ range: util_1.default.createRange(2, 16, 2, 26)
377
+ }]);
378
+ (0, chai_1.expect)(program.getScopesForFile(file)[0].getDiagnostics()).to.be.empty;
328
379
  });
329
380
  it('adds diagnostics for unknown numeric diagnostic codes', () => {
330
- program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
381
+ program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
331
382
  sub main()
332
383
  print "hi" 'bs:disable-line: 123456 999999 aaaab
333
384
  end sub
334
385
  `);
335
386
  program.validate();
336
- chai_1.expect(program.getDiagnostics()).to.be.lengthOf(2);
337
- chai_1.expect(program.getDiagnostics()[0]).to.deep.include({
387
+ (0, chai_1.expect)(program.getDiagnostics()).to.be.lengthOf(2);
388
+ (0, chai_1.expect)(program.getDiagnostics()[0]).to.deep.include({
338
389
  range: vscode_languageserver_1.Range.create(2, 53, 2, 59)
339
390
  });
340
- chai_1.expect(program.getDiagnostics()[1]).to.deep.include({
391
+ (0, chai_1.expect)(program.getDiagnostics()[1]).to.deep.include({
341
392
  range: vscode_languageserver_1.Range.create(2, 60, 2, 66)
342
393
  });
343
394
  });
344
395
  });
345
396
  describe('bs:disable-line', () => {
346
397
  it('works for all', () => {
347
- let file = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
398
+ let file = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
348
399
  sub Main()
349
400
  z::;;%%%%%% 'bs:disable-line
350
401
  end sub
351
402
  `);
352
- chai_1.expect(file.commentFlags[0]).to.exist;
353
- chai_1.expect(file.commentFlags[0]).to.deep.include({
403
+ (0, chai_1.expect)(file.commentFlags[0]).to.exist;
404
+ (0, chai_1.expect)(file.commentFlags[0]).to.deep.include({
354
405
  codes: null,
355
406
  range: vscode_languageserver_1.Range.create(2, 36, 2, 52),
356
407
  affectedRange: vscode_languageserver_1.Range.create(2, 0, 2, 36)
357
408
  });
358
409
  program.validate();
359
410
  //the "unterminated string" error should be filtered out
360
- chai_1.expect(program.getDiagnostics()).to.be.lengthOf(0);
411
+ (0, chai_1.expect)(program.getDiagnostics()).to.be.lengthOf(0);
361
412
  });
362
413
  it('works for specific codes', () => {
363
- program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
414
+ program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
364
415
  sub main()
365
416
  'should not have any errors
366
417
  DoSomething(1) 'bs:disable-line:1002
@@ -371,8 +422,8 @@ describe('BrsFile', () => {
371
422
  end sub
372
423
  `);
373
424
  program.validate();
374
- chai_1.expect(program.getDiagnostics()).to.be.lengthOf(1);
375
- chai_1.expect(program.getDiagnostics()[0]).to.deep.include({
425
+ (0, chai_1.expect)(program.getDiagnostics()).to.be.lengthOf(1);
426
+ (0, chai_1.expect)(program.getDiagnostics()[0]).to.deep.include({
376
427
  range: vscode_languageserver_1.Range.create(5, 24, 5, 35)
377
428
  });
378
429
  });
@@ -380,20 +431,20 @@ describe('BrsFile', () => {
380
431
  //the current version of BRS causes parse errors after the `parse` keyword, showing error in comments
381
432
  //the program should ignore all diagnostics found in brs:* comment lines EXCEPT
382
433
  //for the diagnostics about using unknown error codes
383
- program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
434
+ program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
384
435
  sub main()
385
436
  stop 'bs:disable-line
386
437
  print "need a valid line to fix stop error"
387
438
  end sub
388
439
  `);
389
440
  program.validate();
390
- chai_1.expect(program.getDiagnostics()).to.be.lengthOf(0);
441
+ (0, chai_1.expect)(program.getDiagnostics()).to.be.lengthOf(0);
391
442
  });
392
443
  });
393
444
  });
394
445
  describe('parse', () => {
395
446
  it('supports iife in assignment', () => {
396
- program.addOrReplaceFile('source/main.brs', `
447
+ program.setFile('source/main.brs', `
397
448
  sub main()
398
449
  result = sub()
399
450
  end sub()
@@ -401,12 +452,12 @@ describe('BrsFile', () => {
401
452
  end sub)()
402
453
  end sub
403
454
  `);
404
- testHelpers_spec_1.expectZeroDiagnostics(program);
455
+ (0, testHelpers_spec_1.expectZeroDiagnostics)(program);
405
456
  });
406
457
  it('uses the proper parse mode based on file extension', () => {
407
458
  function testParseMode(destPath, expectedParseMode) {
408
- const file = program.addOrReplaceFile(destPath, '');
409
- chai_1.expect(file.parseMode).to.equal(expectedParseMode);
459
+ const file = program.setFile(destPath, '');
460
+ (0, chai_1.expect)(file.parseMode).to.equal(expectedParseMode);
410
461
  }
411
462
  testParseMode('source/main.brs', Parser_1.ParseMode.BrightScript);
412
463
  testParseMode('source/main.spec.brs', Parser_1.ParseMode.BrightScript);
@@ -416,26 +467,26 @@ describe('BrsFile', () => {
416
467
  testParseMode('source/main.spec.bs', Parser_1.ParseMode.BrighterScript);
417
468
  });
418
469
  it('supports labels and goto statements', () => {
419
- let file = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
470
+ let file = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
420
471
  sub Main()
421
472
  'multiple goto statements on one line
422
473
  goto myLabel : goto myLabel
423
474
  myLabel:
424
475
  end sub
425
476
  `);
426
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
477
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
427
478
  });
428
479
  it('supports empty print statements', () => {
429
- let file = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
480
+ let file = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
430
481
  sub main()
431
482
  print
432
483
  end sub
433
484
  `);
434
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
485
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
435
486
  });
436
487
  describe('conditional compile', () => {
437
488
  it('works for upper case keywords', () => {
438
- let file = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
489
+ let file = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
439
490
  sub main()
440
491
  #CONST someFlag = true
441
492
  #IF someFlag
@@ -447,10 +498,10 @@ describe('BrsFile', () => {
447
498
  #ENDIF
448
499
  end sub
449
500
  `);
450
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
501
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
451
502
  });
452
503
  it('supports single-word #elseif and #endif', () => {
453
- let file = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
504
+ let file = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
454
505
  sub main()
455
506
  #const someFlag = true
456
507
  #if someFlag
@@ -460,10 +511,10 @@ describe('BrsFile', () => {
460
511
  #endif
461
512
  end sub
462
513
  `);
463
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
514
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
464
515
  });
465
516
  it('supports multi-word #else if and #end if', () => {
466
- let file = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
517
+ let file = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
467
518
  sub main()
468
519
  #const someFlag = true
469
520
  #if someFlag
@@ -473,65 +524,65 @@ describe('BrsFile', () => {
473
524
  #end if
474
525
  end sub
475
526
  `);
476
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
527
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
477
528
  });
478
529
  it('does not choke on invalid code inside a false conditional compile', () => {
479
- let file = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
530
+ let file = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
480
531
  sub main()
481
532
  #if false
482
533
  non-commented code here should not cause parse errors
483
534
  #end if
484
535
  end sub
485
536
  `);
486
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
537
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
487
538
  });
488
539
  it('detects syntax error in #if', () => {
489
- let file = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
540
+ let file = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
490
541
  sub main()
491
542
  #if true1
492
543
  print "true"
493
544
  #end if
494
545
  end sub
495
546
  `);
496
- chai_1.expect(file.getDiagnostics()[0]).to.exist.and.deep.include(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.invalidHashConstValue));
547
+ (0, chai_1.expect)(file.getDiagnostics()[0]).to.exist.and.deep.include(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.invalidHashConstValue));
497
548
  });
498
549
  it('detects syntax error in #const', () => {
499
- let file = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
550
+ let file = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
500
551
  sub main()
501
552
  #if %
502
553
  print "true"
503
554
  #end if
504
555
  end sub
505
556
  `);
506
- chai_1.expect(file.getDiagnostics()[0]).to.exist.and.deep.include(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.unexpectedCharacter('%')));
557
+ (0, chai_1.expect)(file.getDiagnostics()[0]).to.exist.and.deep.include(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.unexpectedCharacter('%')));
507
558
  });
508
559
  it('detects #const name using reserved word', () => {
509
- let file = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
560
+ let file = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
510
561
  sub main()
511
562
  #const function = true
512
563
  end sub
513
564
  `);
514
- chai_1.expect(file.getDiagnostics()[0]).to.exist.and.deep.include(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.constNameCannotBeReservedWord()));
565
+ (0, chai_1.expect)(file.getDiagnostics()[0]).to.exist.and.deep.include(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.constNameCannotBeReservedWord()));
515
566
  });
516
567
  it('detects syntax error in #const', () => {
517
- let file = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
568
+ let file = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
518
569
  sub main()
519
570
  #const someConst = 123
520
571
  end sub
521
572
  `);
522
- chai_1.expect(file.getDiagnostics()[0]).to.exist.and.deep.include(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.invalidHashConstValue()));
573
+ (0, chai_1.expect)(file.getDiagnostics()[0]).to.exist.and.deep.include(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.invalidHashConstValue()));
523
574
  });
524
575
  });
525
576
  it('supports stop statement', () => {
526
- let file = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
577
+ let file = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
527
578
  sub main()
528
579
  stop
529
580
  end sub
530
581
  `);
531
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
582
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
532
583
  });
533
584
  it('supports single-line if statements', () => {
534
- let file = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
585
+ let file = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
535
586
  sub main()
536
587
  if 1 < 2: return true: end if
537
588
  if 1 < 2: return true
@@ -541,7 +592,7 @@ describe('BrsFile', () => {
541
592
  if true then : test = sub() : print "yes" : end sub : end if
542
593
  end sub
543
594
  `);
544
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
595
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
545
596
  });
546
597
  it('supports line_num as global variable', () => {
547
598
  var _a;
@@ -550,7 +601,7 @@ describe('BrsFile', () => {
550
601
  print LINE_NUM
551
602
  end sub
552
603
  `);
553
- chai_1.expect((_a = file.getDiagnostics()[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
604
+ (0, chai_1.expect)((_a = file.getDiagnostics()[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
554
605
  });
555
606
  it('supports many keywords as object property names', () => {
556
607
  file.parse(`
@@ -616,7 +667,7 @@ describe('BrsFile', () => {
616
667
  person.new = true
617
668
  end sub
618
669
  `);
619
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
670
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
620
671
  });
621
672
  it('does not error on numeric literal type designators', () => {
622
673
  file.parse(`
@@ -630,7 +681,7 @@ describe('BrsFile', () => {
630
681
  print 9876543210&
631
682
  end sub
632
683
  `);
633
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
684
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
634
685
  });
635
686
  it('does not error when encountering sub with return type', () => {
636
687
  file.parse(`
@@ -638,7 +689,7 @@ describe('BrsFile', () => {
638
689
  return
639
690
  end sub
640
691
  `);
641
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
692
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
642
693
  });
643
694
  it('does not lose function statements when mismatched end sub', () => {
644
695
  file.parse(`
@@ -650,7 +701,7 @@ describe('BrsFile', () => {
650
701
  print "hello world"
651
702
  end sub
652
703
  `);
653
- chai_1.expect(file.parser.references.functionStatements).to.be.lengthOf(2);
704
+ (0, chai_1.expect)(file.parser.references.functionStatements).to.be.lengthOf(2);
654
705
  });
655
706
  it('does not lose sub scope when mismatched end function', () => {
656
707
  file.parse(`
@@ -662,7 +713,7 @@ describe('BrsFile', () => {
662
713
  print "hello world"
663
714
  end sub
664
715
  `);
665
- chai_1.expect(file.parser.references.functionStatements).to.be.lengthOf(2);
716
+ (0, chai_1.expect)(file.parser.references.functionStatements).to.be.lengthOf(2);
666
717
  });
667
718
  it('does not error with boolean in RHS of set statement', () => {
668
719
  file.parse(`
@@ -673,7 +724,7 @@ describe('BrsFile', () => {
673
724
  foo.bar = true and false or 3 > 4
674
725
  end sub
675
726
  `);
676
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
727
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
677
728
  });
678
729
  it('does not error with boolean in RHS of set statement', () => {
679
730
  file.parse(`
@@ -686,7 +737,7 @@ describe('BrsFile', () => {
686
737
  m.isTrue = m.isTrue = m.isTrue
687
738
  end sub
688
739
  `);
689
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
740
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
690
741
  });
691
742
  it('supports variable names ending with type designators', () => {
692
743
  file.parse(`
@@ -698,7 +749,7 @@ describe('BrsFile', () => {
698
749
  someHex& = 13
699
750
  end sub
700
751
  `);
701
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
752
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
702
753
  });
703
754
  it('supports multiple spaces between two-word keywords', () => {
704
755
  file.parse(`
@@ -710,7 +761,7 @@ describe('BrsFile', () => {
710
761
  end if
711
762
  end sub
712
763
  `);
713
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
764
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
714
765
  });
715
766
  it('does not error with `stop` as object key', () => {
716
767
  file.parse(`
@@ -723,7 +774,7 @@ describe('BrsFile', () => {
723
774
  return obj
724
775
  end function
725
776
  `);
726
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
777
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
727
778
  });
728
779
  it('does not error with `run` as object key', () => {
729
780
  file.parse(`
@@ -736,7 +787,7 @@ describe('BrsFile', () => {
736
787
  return obj
737
788
  end function
738
789
  `);
739
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
790
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
740
791
  });
741
792
  it('supports assignment operators', () => {
742
793
  file.parse(`
@@ -753,7 +804,7 @@ describe('BrsFile', () => {
753
804
  print x
754
805
  end function
755
806
  `);
756
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
807
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
757
808
  });
758
809
  it('supports `then` as object property', () => {
759
810
  file.parse(`
@@ -765,7 +816,7 @@ describe('BrsFile', () => {
765
816
  promise.then()
766
817
  end function
767
818
  `);
768
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
819
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
769
820
  });
770
821
  it('supports function as parameter type', () => {
771
822
  file.parse(`
@@ -774,7 +825,7 @@ describe('BrsFile', () => {
774
825
  end function
775
826
  end sub
776
827
  `);
777
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
828
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
778
829
  });
779
830
  it('supports increment operator', () => {
780
831
  file.parse(`
@@ -784,7 +835,7 @@ describe('BrsFile', () => {
784
835
  end function
785
836
  `);
786
837
  file.getDiagnostics();
787
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
838
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
788
839
  });
789
840
  it('supports decrement operator', () => {
790
841
  file.parse(`
@@ -794,7 +845,7 @@ describe('BrsFile', () => {
794
845
  end function
795
846
  `);
796
847
  file.getDiagnostics();
797
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
848
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
798
849
  });
799
850
  it('supports writing numbers with decimal but no trailing digit', () => {
800
851
  file.parse(`
@@ -803,7 +854,7 @@ describe('BrsFile', () => {
803
854
  print x
804
855
  end function
805
856
  `);
806
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
857
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
807
858
  });
808
859
  it('supports assignment operators against object properties', () => {
809
860
  file.parse(`
@@ -825,7 +876,7 @@ describe('BrsFile', () => {
825
876
  print m.age
826
877
  end function
827
878
  `);
828
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
879
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
829
880
  });
830
881
  //skipped until `brs` supports this
831
882
  it('supports bitshift assignment operators', () => {
@@ -837,7 +888,7 @@ describe('BrsFile', () => {
837
888
  print x
838
889
  end function
839
890
  `);
840
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
891
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
841
892
  });
842
893
  //skipped until `brs` supports this
843
894
  it('supports bitshift assignment operators on objects', () => {
@@ -849,7 +900,7 @@ describe('BrsFile', () => {
849
900
  print m.x
850
901
  end function
851
902
  `);
852
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
903
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
853
904
  });
854
905
  it('supports leading and trailing periods for numeric literals', () => {
855
906
  file.parse(`
@@ -860,7 +911,7 @@ describe('BrsFile', () => {
860
911
  print pointOne
861
912
  end function
862
913
  `);
863
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
914
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
864
915
  });
865
916
  it('supports bitshift assignment operators on object properties accessed by array syntax', () => {
866
917
  file.parse(`
@@ -871,7 +922,7 @@ describe('BrsFile', () => {
871
922
  print m.x
872
923
  end function
873
924
  `);
874
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
925
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
875
926
  });
876
927
  it('supports weird period AA accessor', () => {
877
928
  file.parse(`
@@ -880,15 +931,15 @@ describe('BrsFile', () => {
880
931
  print m.["_uuid"]
881
932
  end function
882
933
  `);
883
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
934
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
884
935
  });
885
936
  it('adds error for library statements NOT at top of file', () => {
886
- let file = program.addOrReplaceFile('source/main.bs', `
937
+ let file = program.setFile('source/main.bs', `
887
938
  sub main()
888
939
  end sub
889
940
  import "file.brs"
890
941
  `);
891
- chai_1.expect(file.getDiagnostics().map(x => x.message)).to.eql([
942
+ (0, chai_1.expect)(file.getDiagnostics().map(x => x.message)).to.eql([
892
943
  DiagnosticMessages_1.DiagnosticMessages.importStatementMustBeDeclaredAtTopOfFile().message
893
944
  ]);
894
945
  });
@@ -896,25 +947,25 @@ describe('BrsFile', () => {
896
947
  file.parse(`
897
948
  Library "v30/bslCore.brs"
898
949
  `);
899
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
950
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
900
951
  });
901
952
  it('adds error for library statements NOT at top of file', () => {
902
- let file = program.addOrReplaceFile('source/main.brs', `
953
+ let file = program.setFile('source/main.brs', `
903
954
  sub main()
904
955
  end sub
905
956
  Library "v30/bslCore.brs"
906
957
  `);
907
- chai_1.expect(file.getDiagnostics().map(x => x.message)).to.eql([
958
+ (0, chai_1.expect)(file.getDiagnostics().map(x => x.message)).to.eql([
908
959
  DiagnosticMessages_1.DiagnosticMessages.libraryStatementMustBeDeclaredAtTopOfFile().message
909
960
  ]);
910
961
  });
911
962
  it('adds error for library statements inside of function body', () => {
912
- let file = program.addOrReplaceFile('source/main.brs', `
963
+ let file = program.setFile('source/main.brs', `
913
964
  sub main()
914
965
  Library "v30/bslCore.brs"
915
966
  end sub
916
967
  `);
917
- chai_1.expect(file.getDiagnostics().map(x => x.message)).to.eql([
968
+ (0, chai_1.expect)(file.getDiagnostics().map(x => x.message)).to.eql([
918
969
  DiagnosticMessages_1.DiagnosticMessages.libraryStatementMustBeDeclaredAtTopOfFile().message
919
970
  ]);
920
971
  });
@@ -924,15 +975,15 @@ describe('BrsFile', () => {
924
975
  obj = {x:0 : y: 1}
925
976
  end sub
926
977
  `);
927
- chai_1.expect(file.getDiagnostics()).to.be.lengthOf(0);
978
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.lengthOf(0);
928
979
  });
929
980
  it('succeeds when finding variables with "sub" in them', () => {
930
- let file = program.addOrReplaceFile('source/main.brs', `
981
+ let file = program.setFile('source/main.brs', `
931
982
  function DoSomething()
932
983
  return value.subType()
933
984
  end function
934
985
  `);
935
- chai_1.expect(file.callables[0]).to.deep.include({
986
+ (0, chai_1.expect)(file.callables[0]).to.deep.include({
936
987
  file: file,
937
988
  nameRange: vscode_languageserver_1.Range.create(1, 25, 1, 36)
938
989
  });
@@ -955,10 +1006,10 @@ describe('BrsFile', () => {
955
1006
  print "B"
956
1007
  end function
957
1008
  `);
958
- chai_1.expect(file.callables[0].name).to.equal('DoA');
959
- chai_1.expect(file.callables[0].nameRange).to.eql(vscode_languageserver_1.Range.create(1, 25, 1, 28));
960
- chai_1.expect(file.callables[1].name).to.equal('DoB');
961
- chai_1.expect(file.callables[1].nameRange).to.eql(vscode_languageserver_1.Range.create(5, 26, 5, 29));
1009
+ (0, chai_1.expect)(file.callables[0].name).to.equal('DoA');
1010
+ (0, chai_1.expect)(file.callables[0].nameRange).to.eql(vscode_languageserver_1.Range.create(1, 25, 1, 28));
1011
+ (0, chai_1.expect)(file.callables[1].name).to.equal('DoB');
1012
+ (0, chai_1.expect)(file.callables[1].nameRange).to.eql(vscode_languageserver_1.Range.create(5, 26, 5, 29));
962
1013
  });
963
1014
  it('throws an error if the file has already been parsed', () => {
964
1015
  let file = new BrsFile_1.BrsFile('abspath', 'relpath', program);
@@ -982,11 +1033,11 @@ describe('BrsFile', () => {
982
1033
  print "A"
983
1034
  end function
984
1035
  `);
985
- chai_1.expect(file.callables.length).to.equal(2);
986
- chai_1.expect(file.callables[0].name).to.equal('DoA');
987
- chai_1.expect(file.callables[0].nameRange.start.line).to.equal(1);
988
- chai_1.expect(file.callables[1].name).to.equal('DoA');
989
- chai_1.expect(file.callables[1].nameRange.start.line).to.equal(5);
1036
+ (0, chai_1.expect)(file.callables.length).to.equal(2);
1037
+ (0, chai_1.expect)(file.callables[0].name).to.equal('DoA');
1038
+ (0, chai_1.expect)(file.callables[0].nameRange.start.line).to.equal(1);
1039
+ (0, chai_1.expect)(file.callables[1].name).to.equal('DoA');
1040
+ (0, chai_1.expect)(file.callables[1].nameRange.start.line).to.equal(5);
990
1041
  });
991
1042
  it('finds function call line and column numbers', () => {
992
1043
  let file = new BrsFile_1.BrsFile('absolute_path/file.brs', 'relative_path/file.brs', program);
@@ -998,11 +1049,11 @@ describe('BrsFile', () => {
998
1049
  DoC()
999
1050
  end function
1000
1051
  `);
1001
- chai_1.expect(file.functionCalls.length).to.equal(2);
1002
- chai_1.expect(file.functionCalls[0].range).to.eql(vscode_languageserver_1.Range.create(2, 20, 2, 28));
1003
- chai_1.expect(file.functionCalls[0].nameRange).to.eql(vscode_languageserver_1.Range.create(2, 20, 2, 23));
1004
- chai_1.expect(file.functionCalls[1].range).to.eql(vscode_languageserver_1.Range.create(5, 20, 5, 25));
1005
- chai_1.expect(file.functionCalls[1].nameRange).to.eql(vscode_languageserver_1.Range.create(5, 20, 5, 23));
1052
+ (0, chai_1.expect)(file.functionCalls.length).to.equal(2);
1053
+ (0, chai_1.expect)(file.functionCalls[0].range).to.eql(vscode_languageserver_1.Range.create(2, 20, 2, 28));
1054
+ (0, chai_1.expect)(file.functionCalls[0].nameRange).to.eql(vscode_languageserver_1.Range.create(2, 20, 2, 23));
1055
+ (0, chai_1.expect)(file.functionCalls[1].range).to.eql(vscode_languageserver_1.Range.create(5, 20, 5, 25));
1056
+ (0, chai_1.expect)(file.functionCalls[1].nameRange).to.eql(vscode_languageserver_1.Range.create(5, 20, 5, 23));
1006
1057
  });
1007
1058
  it('sanitizes brs errors', () => {
1008
1059
  let file = new BrsFile_1.BrsFile('absolute_path/file.brs', 'relative_path/file.brs', program);
@@ -1010,11 +1061,11 @@ describe('BrsFile', () => {
1010
1061
  function DoSomething
1011
1062
  end function
1012
1063
  `);
1013
- chai_1.expect(file.getDiagnostics().length).to.be.greaterThan(0);
1014
- chai_1.expect(file.getDiagnostics()[0]).to.deep.include({
1064
+ (0, chai_1.expect)(file.getDiagnostics().length).to.be.greaterThan(0);
1065
+ (0, chai_1.expect)(file.getDiagnostics()[0]).to.deep.include({
1015
1066
  file: file
1016
1067
  });
1017
- chai_1.expect(file.getDiagnostics()[0].range.start.line).to.equal(1);
1068
+ (0, chai_1.expect)(file.getDiagnostics()[0].range.start.line).to.equal(1);
1018
1069
  });
1019
1070
  it('supports using the `next` keyword in a for loop', () => {
1020
1071
  let file = new BrsFile_1.BrsFile('absolute_path/file.brs', 'relative_path/file.brs', program);
@@ -1025,7 +1076,7 @@ describe('BrsFile', () => {
1025
1076
  next
1026
1077
  end sub
1027
1078
  `);
1028
- chai_1.expect(file.getDiagnostics()).to.be.empty;
1079
+ (0, chai_1.expect)(file.getDiagnostics()).to.be.empty;
1029
1080
  });
1030
1081
  //test is not working yet, but will be enabled when brs supports this syntax
1031
1082
  it('supports assigning functions to objects', () => {
@@ -1038,7 +1089,7 @@ describe('BrsFile', () => {
1038
1089
  end sub
1039
1090
  end function
1040
1091
  `);
1041
- chai_1.expect(file.getDiagnostics().length).to.equal(0);
1092
+ (0, chai_1.expect)(file.getDiagnostics().length).to.equal(0);
1042
1093
  });
1043
1094
  });
1044
1095
  describe('findCallables', () => {
@@ -1050,7 +1101,7 @@ describe('BrsFile', () => {
1050
1101
  end sub
1051
1102
  `);
1052
1103
  let callable = file.callables[0];
1053
- chai_1.expect(callable.range).to.eql(vscode_languageserver_1.Range.create(1, 16, 3, 23));
1104
+ (0, chai_1.expect)(callable.range).to.eql(vscode_languageserver_1.Range.create(1, 16, 3, 23));
1054
1105
  });
1055
1106
  it('finds correct body range even with inner function', () => {
1056
1107
  let file = new BrsFile_1.BrsFile('absolute_path/file.brs', 'relative_path/file.brs', program);
@@ -1063,7 +1114,7 @@ describe('BrsFile', () => {
1063
1114
  end sub
1064
1115
  `);
1065
1116
  let callable = file.callables[0];
1066
- chai_1.expect(callable.range).to.eql(vscode_languageserver_1.Range.create(1, 16, 6, 23));
1117
+ (0, chai_1.expect)(callable.range).to.eql(vscode_languageserver_1.Range.create(1, 16, 6, 23));
1067
1118
  });
1068
1119
  it('finds callable parameters', () => {
1069
1120
  let file = new BrsFile_1.BrsFile('absolute_path/file.brs', 'relative_path/file.brs', program);
@@ -1073,24 +1124,24 @@ describe('BrsFile', () => {
1073
1124
  end function
1074
1125
  `);
1075
1126
  let callable = file.callables[0];
1076
- chai_1.expect(callable.params[0]).to.deep.include({
1127
+ (0, chai_1.expect)(callable.params[0]).to.deep.include({
1077
1128
  name: 'a',
1078
1129
  isOptional: false,
1079
1130
  isRestArgument: false
1080
1131
  });
1081
- chai_1.expect(callable.params[0].type).instanceof(DynamicType_1.DynamicType);
1082
- chai_1.expect(callable.params[1]).to.deep.include({
1132
+ (0, chai_1.expect)(callable.params[0].type).instanceof(DynamicType_1.DynamicType);
1133
+ (0, chai_1.expect)(callable.params[1]).to.deep.include({
1083
1134
  name: 'b',
1084
1135
  isOptional: false,
1085
1136
  isRestArgument: false
1086
1137
  });
1087
- chai_1.expect(callable.params[1].type).instanceof(DynamicType_1.DynamicType);
1088
- chai_1.expect(callable.params[2]).to.deep.include({
1138
+ (0, chai_1.expect)(callable.params[1].type).instanceof(DynamicType_1.DynamicType);
1139
+ (0, chai_1.expect)(callable.params[2]).to.deep.include({
1089
1140
  name: 'c',
1090
1141
  isOptional: false,
1091
1142
  isRestArgument: false
1092
1143
  });
1093
- chai_1.expect(callable.params[2].type).instanceof(DynamicType_1.DynamicType);
1144
+ (0, chai_1.expect)(callable.params[2].type).instanceof(DynamicType_1.DynamicType);
1094
1145
  });
1095
1146
  it('finds optional parameters', () => {
1096
1147
  let file = new BrsFile_1.BrsFile('absolute_path/file.brs', 'relative_path/file.brs', program);
@@ -1100,12 +1151,12 @@ describe('BrsFile', () => {
1100
1151
  end function
1101
1152
  `);
1102
1153
  let callable = file.callables[0];
1103
- chai_1.expect(callable.params[0]).to.deep.include({
1154
+ (0, chai_1.expect)(callable.params[0]).to.deep.include({
1104
1155
  name: 'a',
1105
1156
  isOptional: true,
1106
1157
  isRestArgument: false
1107
1158
  });
1108
- chai_1.expect(callable.params[0].type).instanceof(IntegerType_1.IntegerType);
1159
+ (0, chai_1.expect)(callable.params[0].type).instanceof(IntegerType_1.IntegerType);
1109
1160
  });
1110
1161
  it('finds parameter types', () => {
1111
1162
  let file = new BrsFile_1.BrsFile('absolute_path/file.brs', 'relative_path/file.brs', program);
@@ -1115,24 +1166,24 @@ describe('BrsFile', () => {
1115
1166
  end function
1116
1167
  `);
1117
1168
  let callable = file.callables[0];
1118
- chai_1.expect(callable.params[0]).to.deep.include({
1169
+ (0, chai_1.expect)(callable.params[0]).to.deep.include({
1119
1170
  name: 'a',
1120
1171
  isOptional: false,
1121
1172
  isRestArgument: false
1122
1173
  });
1123
- chai_1.expect(callable.params[0].type).instanceof(DynamicType_1.DynamicType);
1124
- chai_1.expect(callable.params[1]).to.deep.include({
1174
+ (0, chai_1.expect)(callable.params[0].type).instanceof(DynamicType_1.DynamicType);
1175
+ (0, chai_1.expect)(callable.params[1]).to.deep.include({
1125
1176
  name: 'b',
1126
1177
  isOptional: false,
1127
1178
  isRestArgument: false
1128
1179
  });
1129
- chai_1.expect(callable.params[1].type).instanceof(IntegerType_1.IntegerType);
1130
- chai_1.expect(callable.params[2]).to.deep.include({
1180
+ (0, chai_1.expect)(callable.params[1].type).instanceof(IntegerType_1.IntegerType);
1181
+ (0, chai_1.expect)(callable.params[2]).to.deep.include({
1131
1182
  name: 'c',
1132
1183
  isOptional: false,
1133
1184
  isRestArgument: false
1134
1185
  });
1135
- chai_1.expect(callable.params[2].type).instanceof(StringType_1.StringType);
1186
+ (0, chai_1.expect)(callable.params[2].type).instanceof(StringType_1.StringType);
1136
1187
  });
1137
1188
  });
1138
1189
  describe('findCallableInvocations', () => {
@@ -1143,8 +1194,8 @@ describe('BrsFile', () => {
1143
1194
  DoSomething("name", 12, true)
1144
1195
  end function
1145
1196
  `);
1146
- chai_1.expect(file.functionCalls.length).to.equal(1);
1147
- chai_1.expect(file.functionCalls[0].args).to.eql([{
1197
+ (0, chai_1.expect)(file.functionCalls.length).to.equal(1);
1198
+ (0, chai_1.expect)(file.functionCalls[0].args).to.eql([{
1148
1199
  type: new StringType_1.StringType(),
1149
1200
  range: util_1.default.createRange(2, 32, 2, 38),
1150
1201
  text: '"name"'
@@ -1160,7 +1211,7 @@ describe('BrsFile', () => {
1160
1211
  });
1161
1212
  it('finds function calls nested inside statements', () => {
1162
1213
  var _a;
1163
- program.addOrReplaceFile(`source/main.brs`, `
1214
+ program.setFile(`source/main.brs`, `
1164
1215
  sub main()
1165
1216
  if true then
1166
1217
  DoesNotExist(1, 2)
@@ -1168,7 +1219,7 @@ describe('BrsFile', () => {
1168
1219
  end sub
1169
1220
  `);
1170
1221
  program.validate();
1171
- chai_1.expect((_a = program.getDiagnostics()[0]) === null || _a === void 0 ? void 0 : _a.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.callToUnknownFunction('DoesNotExist', 'source').message);
1222
+ (0, chai_1.expect)((_a = program.getDiagnostics()[0]) === null || _a === void 0 ? void 0 : _a.message).to.equal(DiagnosticMessages_1.DiagnosticMessages.callToUnknownFunction('DoesNotExist', 'source').message);
1172
1223
  });
1173
1224
  it('finds arguments with variable values', () => {
1174
1225
  let file = new BrsFile_1.BrsFile('absolute_path/file.brs', 'relative_path/file.brs', program);
@@ -1180,17 +1231,17 @@ describe('BrsFile', () => {
1180
1231
  DoSomething(count, name, isAlive)
1181
1232
  end function
1182
1233
  `);
1183
- chai_1.expect(file.functionCalls.length).to.equal(1);
1184
- chai_1.expect(file.functionCalls[0].args[0]).deep.include({
1185
- type: new DynamicType_1.DynamicType(),
1234
+ (0, chai_1.expect)(file.functionCalls.length).to.equal(1);
1235
+ (0, chai_1.expect)(file.functionCalls[0].args[0]).deep.include({
1236
+ type: new IntegerType_1.IntegerType(),
1186
1237
  text: 'count'
1187
1238
  });
1188
- chai_1.expect(file.functionCalls[0].args[1]).deep.include({
1189
- type: new DynamicType_1.DynamicType(),
1239
+ (0, chai_1.expect)(file.functionCalls[0].args[1]).deep.include({
1240
+ type: new StringType_1.StringType(),
1190
1241
  text: 'name'
1191
1242
  });
1192
- chai_1.expect(file.functionCalls[0].args[2]).deep.include({
1193
- type: new DynamicType_1.DynamicType(),
1243
+ (0, chai_1.expect)(file.functionCalls[0].args[2]).deep.include({
1244
+ type: new BooleanType_1.BooleanType(),
1194
1245
  text: 'isAlive'
1195
1246
  });
1196
1247
  });
@@ -1200,20 +1251,20 @@ describe('BrsFile', () => {
1200
1251
  it('skips top-level statements', () => {
1201
1252
  let file = new BrsFile_1.BrsFile('absolute', 'relative', program);
1202
1253
  file.parse('name = "Bob"');
1203
- chai_1.expect(file.callables.length).to.equal(0);
1254
+ (0, chai_1.expect)(file.callables.length).to.equal(0);
1204
1255
  });
1205
1256
  it('finds return type', () => {
1206
- let file = program.addOrReplaceFile('source/main.brs', `
1257
+ let file = program.setFile('source/main.brs', `
1207
1258
  function DoSomething() as string
1208
1259
  end function
1209
1260
  `);
1210
- chai_1.expect(file.callables[0]).to.deep.include({
1261
+ (0, chai_1.expect)(file.callables[0]).to.deep.include({
1211
1262
  file: file,
1212
1263
  nameRange: vscode_languageserver_1.Range.create(1, 25, 1, 36),
1213
1264
  name: 'DoSomething',
1214
1265
  params: []
1215
1266
  });
1216
- chai_1.expect(file.callables[0].type.returnType).instanceof(StringType_1.StringType);
1267
+ (0, chai_1.expect)(file.callables[0].type.returnType).instanceof(StringType_1.StringType);
1217
1268
  });
1218
1269
  });
1219
1270
  describe('function local variable handling', () => {
@@ -1223,7 +1274,7 @@ describe('BrsFile', () => {
1223
1274
  name = 'bob"
1224
1275
  end sub
1225
1276
  `);
1226
- chai_1.expect(file.parser.references.functionStatements[0].range).to.eql(vscode_languageserver_1.Range.create(1, 16, 3, 23));
1277
+ (0, chai_1.expect)(file.parser.references.functionStatements[0].range).to.eql(vscode_languageserver_1.Range.create(1, 16, 3, 23));
1227
1278
  });
1228
1279
  it('creates scopes for parent and child functions', () => {
1229
1280
  file.parse(`
@@ -1237,7 +1288,7 @@ describe('BrsFile', () => {
1237
1288
  end sub)
1238
1289
  end sub
1239
1290
  `);
1240
- chai_1.expect(file.parser.references.functionExpressions).to.be.length(3);
1291
+ (0, chai_1.expect)(file.parser.references.functionExpressions).to.be.length(3);
1241
1292
  });
1242
1293
  it('finds variables declared in function expressions', () => {
1243
1294
  file.parse(`
@@ -1251,13 +1302,13 @@ describe('BrsFile', () => {
1251
1302
  end sub)
1252
1303
  end sub
1253
1304
  `);
1254
- testHelpers_spec_1.expectSymbolTableEquals(file.parser.references.functionExpressions[0].symbolTable, [
1305
+ (0, testHelpers_spec_1.expectSymbolTableEquals)(file.parser.references.functionExpressions[0].symbolTable, [
1255
1306
  ['sayHi', new FunctionType_1.FunctionType(new VoidType_1.VoidType(), true), util_1.default.createRange(2, 20, 2, 25)]
1256
1307
  ]);
1257
- testHelpers_spec_1.expectSymbolTableEquals(file.parser.references.functionExpressions[1].symbolTable, [
1308
+ (0, testHelpers_spec_1.expectSymbolTableEquals)(file.parser.references.functionExpressions[1].symbolTable, [
1258
1309
  ['age', new IntegerType_1.IntegerType(), util_1.default.createRange(3, 24, 3, 27)]
1259
1310
  ]);
1260
- testHelpers_spec_1.expectSymbolTableEquals(file.parser.references.functionExpressions[2].symbolTable, [
1311
+ (0, testHelpers_spec_1.expectSymbolTableEquals)(file.parser.references.functionExpressions[2].symbolTable, [
1261
1312
  ['name', new StringType_1.StringType(), util_1.default.createRange(7, 24, 7, 28)]
1262
1313
  ]);
1263
1314
  });
@@ -1269,12 +1320,12 @@ describe('BrsFile', () => {
1269
1320
  end if
1270
1321
  end sub
1271
1322
  `);
1272
- testHelpers_spec_1.expectSymbolTableEquals(file.parser.references.functionExpressions[0].symbolTable, [
1323
+ (0, testHelpers_spec_1.expectSymbolTableEquals)(file.parser.references.functionExpressions[0].symbolTable, [
1273
1324
  ['theLength', new IntegerType_1.IntegerType(), util_1.default.createRange(3, 24, 3, 33)]
1274
1325
  ]);
1275
1326
  });
1276
1327
  it('finds value from global return', () => {
1277
- let file = program.addOrReplaceFile('source/main.brs', `
1328
+ let file = program.setFile('source/main.brs', `
1278
1329
  sub Main()
1279
1330
  myName = GetName()
1280
1331
  end sub
@@ -1283,7 +1334,7 @@ describe('BrsFile', () => {
1283
1334
  return "bob"
1284
1335
  end function
1285
1336
  `);
1286
- testHelpers_spec_1.expectSymbolTableEquals(file.parser.references.functionExpressions[0].symbolTable, [
1337
+ (0, testHelpers_spec_1.expectSymbolTableEquals)(file.parser.references.functionExpressions[0].symbolTable, [
1287
1338
  ['myName', new StringType_1.StringType(), util_1.default.createRange(2, 19, 2, 25)]
1288
1339
  ]);
1289
1340
  });
@@ -1294,7 +1345,7 @@ describe('BrsFile', () => {
1294
1345
  nameCopy = name
1295
1346
  end sub
1296
1347
  `);
1297
- testHelpers_spec_1.expectSymbolTableEquals(file.parser.references.functionExpressions[0].symbolTable, [
1348
+ (0, testHelpers_spec_1.expectSymbolTableEquals)(file.parser.references.functionExpressions[0].symbolTable, [
1298
1349
  ['name', new StringType_1.StringType(), util_1.default.createRange(2, 19, 2, 23)],
1299
1350
  ['nameCopy', new StringType_1.StringType(), util_1.default.createRange(3, 19, 3, 27)]
1300
1351
  ]);
@@ -1307,8 +1358,8 @@ describe('BrsFile', () => {
1307
1358
  end function
1308
1359
  end sub
1309
1360
  `);
1310
- chai_1.expect(file.parser.references.functionExpressions).to.be.length(2);
1311
- chai_1.expect(file.parser.references.functionExpressions.map(x => x.range)).to.eql([
1361
+ (0, chai_1.expect)(file.parser.references.functionExpressions).to.be.length(2);
1362
+ (0, chai_1.expect)(file.parser.references.functionExpressions.map(x => x.range)).to.eql([
1312
1363
  util_1.default.createRange(1, 16, 5, 23),
1313
1364
  util_1.default.createRange(2, 30, 4, 32)
1314
1365
  ]);
@@ -1316,7 +1367,7 @@ describe('BrsFile', () => {
1316
1367
  });
1317
1368
  describe('getHover', () => {
1318
1369
  it('works for param types', () => {
1319
- let file = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
1370
+ let file = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
1320
1371
  sub DoSomething(name as string)
1321
1372
  name = 1
1322
1373
  sayMyName = function(name as string)
@@ -1325,28 +1376,28 @@ describe('BrsFile', () => {
1325
1376
  `);
1326
1377
  //hover over the `name = 1` line
1327
1378
  let hover = file.getHover(vscode_languageserver_1.Position.create(2, 24));
1328
- chai_1.expect(hover).to.exist;
1329
- chai_1.expect(hover.range).to.eql(vscode_languageserver_1.Range.create(2, 20, 2, 24));
1379
+ (0, chai_1.expect)(hover).to.exist;
1380
+ (0, chai_1.expect)(hover.range).to.eql(vscode_languageserver_1.Range.create(2, 20, 2, 24));
1330
1381
  //hover over the `name` parameter declaration
1331
1382
  hover = file.getHover(vscode_languageserver_1.Position.create(1, 34));
1332
- chai_1.expect(hover).to.exist;
1333
- chai_1.expect(hover.range).to.eql(vscode_languageserver_1.Range.create(1, 32, 1, 36));
1383
+ (0, chai_1.expect)(hover).to.exist;
1384
+ (0, chai_1.expect)(hover.range).to.eql(vscode_languageserver_1.Range.create(1, 32, 1, 36));
1334
1385
  });
1335
1386
  //ignore this for now...it's not a huge deal
1336
1387
  it('does not match on keywords or data types', () => {
1337
- let file = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
1388
+ let file = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
1338
1389
  sub Main(name as string)
1339
1390
  end sub
1340
1391
  sub as()
1341
1392
  end sub
1342
1393
  `);
1343
1394
  //hover over the `as`
1344
- chai_1.expect(file.getHover(vscode_languageserver_1.Position.create(1, 31))).not.to.exist;
1395
+ (0, chai_1.expect)(file.getHover(vscode_languageserver_1.Position.create(1, 31))).not.to.exist;
1345
1396
  //hover over the `string`
1346
- chai_1.expect(file.getHover(vscode_languageserver_1.Position.create(1, 36))).not.to.exist;
1397
+ (0, chai_1.expect)(file.getHover(vscode_languageserver_1.Position.create(1, 36))).not.to.exist;
1347
1398
  });
1348
1399
  it('finds declared function', () => {
1349
- let file = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
1400
+ let file = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
1350
1401
  function Main(count = 1)
1351
1402
  firstName = "bob"
1352
1403
  age = 21
@@ -1354,12 +1405,12 @@ describe('BrsFile', () => {
1354
1405
  end function
1355
1406
  `);
1356
1407
  let hover = file.getHover(vscode_languageserver_1.Position.create(1, 28));
1357
- chai_1.expect(hover).to.exist;
1358
- chai_1.expect(hover.range).to.eql(vscode_languageserver_1.Range.create(1, 25, 1, 29));
1359
- chai_1.expect(hover.contents).to.equal('function Main(count? as integer) as dynamic');
1408
+ (0, chai_1.expect)(hover).to.exist;
1409
+ (0, chai_1.expect)(hover.range).to.eql(vscode_languageserver_1.Range.create(1, 25, 1, 29));
1410
+ (0, chai_1.expect)(hover.contents).to.equal('function Main(count? as integer) as dynamic');
1360
1411
  });
1361
1412
  it('finds variable function hover in same scope', () => {
1362
- let file = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
1413
+ let file = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
1363
1414
  sub Main()
1364
1415
  sayMyName = sub(name as string)
1365
1416
  end sub
@@ -1368,11 +1419,11 @@ describe('BrsFile', () => {
1368
1419
  end sub
1369
1420
  `);
1370
1421
  let hover = file.getHover(vscode_languageserver_1.Position.create(5, 24));
1371
- chai_1.expect(hover.range).to.eql(vscode_languageserver_1.Range.create(5, 20, 5, 29));
1372
- chai_1.expect(hover.contents).to.equal('sub (name as string) as void');
1422
+ (0, chai_1.expect)(hover.range).to.eql(vscode_languageserver_1.Range.create(5, 20, 5, 29));
1423
+ (0, chai_1.expect)(hover.contents).to.equal('sub (name as string) as void');
1373
1424
  });
1374
1425
  it('finds function hover in file scope', () => {
1375
- let file = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
1426
+ let file = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
1376
1427
  sub Main()
1377
1428
  sayMyName()
1378
1429
  end sub
@@ -1382,82 +1433,82 @@ describe('BrsFile', () => {
1382
1433
  end sub
1383
1434
  `);
1384
1435
  let hover = file.getHover(vscode_languageserver_1.Position.create(2, 25));
1385
- chai_1.expect(hover.range).to.eql(vscode_languageserver_1.Range.create(2, 20, 2, 29));
1386
- chai_1.expect(hover.contents).to.equal('sub sayMyName() as void');
1436
+ (0, chai_1.expect)(hover.range).to.eql(vscode_languageserver_1.Range.create(2, 20, 2, 29));
1437
+ (0, chai_1.expect)(hover.contents).to.equal('sub sayMyName() as void');
1387
1438
  });
1388
1439
  it('finds function hover in scope', () => {
1389
1440
  let rootDir = process.cwd();
1390
1441
  program = new Program_1.Program({
1391
1442
  rootDir: rootDir
1392
1443
  });
1393
- let mainFile = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
1444
+ let mainFile = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
1394
1445
  sub Main()
1395
1446
  sayMyName()
1396
1447
  end sub
1397
1448
  `);
1398
- program.addOrReplaceFile({ src: `${rootDir}/source/lib.brs`, dest: 'source/lib.brs' }, `
1449
+ program.setFile({ src: `${rootDir}/source/lib.brs`, dest: 'source/lib.brs' }, `
1399
1450
  sub sayMyName(name as string)
1400
1451
 
1401
1452
  end sub
1402
1453
  `);
1403
1454
  let hover = mainFile.getHover(vscode_languageserver_1.Position.create(2, 25));
1404
- chai_1.expect(hover).to.exist;
1405
- chai_1.expect(hover.range).to.eql(vscode_languageserver_1.Range.create(2, 20, 2, 29));
1406
- chai_1.expect(hover.contents).to.equal('sub sayMyName(name as string) as void');
1455
+ (0, chai_1.expect)(hover).to.exist;
1456
+ (0, chai_1.expect)(hover.range).to.eql(vscode_languageserver_1.Range.create(2, 20, 2, 29));
1457
+ (0, chai_1.expect)(hover.contents).to.equal('sub sayMyName(name as string) as void');
1407
1458
  });
1408
1459
  it('handles mixed case `then` partions of conditionals', () => {
1409
- let mainFile = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
1460
+ let mainFile = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
1410
1461
  sub Main()
1411
1462
  if true then
1412
1463
  print "works"
1413
1464
  end if
1414
1465
  end sub
1415
1466
  `);
1416
- chai_1.expect(mainFile.getDiagnostics()).to.be.lengthOf(0);
1417
- mainFile = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
1467
+ (0, chai_1.expect)(mainFile.getDiagnostics()).to.be.lengthOf(0);
1468
+ mainFile = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
1418
1469
  sub Main()
1419
1470
  if true Then
1420
1471
  print "works"
1421
1472
  end if
1422
1473
  end sub
1423
1474
  `);
1424
- chai_1.expect(mainFile.getDiagnostics()).to.be.lengthOf(0);
1425
- mainFile = program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
1475
+ (0, chai_1.expect)(mainFile.getDiagnostics()).to.be.lengthOf(0);
1476
+ mainFile = program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
1426
1477
  sub Main()
1427
1478
  if true THEN
1428
1479
  print "works"
1429
1480
  end if
1430
1481
  end sub
1431
1482
  `);
1432
- chai_1.expect(mainFile.getDiagnostics()).to.be.lengthOf(0);
1483
+ (0, chai_1.expect)(mainFile.getDiagnostics()).to.be.lengthOf(0);
1433
1484
  });
1434
1485
  it('displays the context from multiple scopes', () => {
1435
- let commonFile = program.addOrReplaceFile('source/common.brs', `
1486
+ let commonFile = program.setFile('source/common.brs', `
1436
1487
  sub displayPi()
1437
1488
  pi = getPi()
1438
1489
  print pi
1439
1490
  end sub
1440
1491
  `);
1441
- let scope1File = program.addOrReplaceFile('components/comp1/scope1.brs', `
1492
+ let scope1File = program.setFile('components/comp1/scope1.brs', `
1442
1493
  function getPi() as string
1443
1494
  return "apple"
1444
1495
  end function
1445
1496
  `);
1446
- chai_1.expect(scope1File.getDiagnostics()).to.be.lengthOf(0);
1447
- program.addOrReplaceFile('components/comp1/comp1.xml', testHelpers_spec_1.trim `
1497
+ (0, chai_1.expect)(scope1File.getDiagnostics()).to.be.lengthOf(0);
1498
+ program.setFile('components/comp1/comp1.xml', (0, testHelpers_spec_1.trim) `
1448
1499
  <?xml version="1.0" encoding="utf-8" ?>
1449
1500
  <component name="Component1" extends="Group">
1450
1501
  <script type="text/brightscript" uri="scope1.brs" />
1451
1502
  <script type="text/brightscript" uri="pkg:/source/common.brs" />
1452
1503
  </component>
1453
1504
  `);
1454
- let scope2File = program.addOrReplaceFile('components/comp2/scope2.brs', `
1505
+ let scope2File = program.setFile('components/comp2/scope2.brs', `
1455
1506
  function getPi() as float
1456
1507
  return 3.14
1457
1508
  end function
1458
1509
  `);
1459
- chai_1.expect(scope2File.getDiagnostics()).to.be.lengthOf(0);
1460
- program.addOrReplaceFile('components/comp2/comp2.xml', testHelpers_spec_1.trim `
1510
+ (0, chai_1.expect)(scope2File.getDiagnostics()).to.be.lengthOf(0);
1511
+ program.setFile('components/comp2/comp2.xml', (0, testHelpers_spec_1.trim) `
1461
1512
  <?xml version="1.0" encoding="utf-8" ?>
1462
1513
  <component name="Component2" extends="Group">
1463
1514
  <script type="text/brightscript" uri="scope2.brs" />
@@ -1466,15 +1517,15 @@ describe('BrsFile', () => {
1466
1517
  `);
1467
1518
  program.validate();
1468
1519
  let funcCallHover = commonFile.getHover(vscode_languageserver_1.Position.create(2, 27));
1469
- chai_1.expect(funcCallHover).to.exist;
1470
- chai_1.expect(funcCallHover.contents).to.equal('function getPi() as string | function getPi() as float');
1520
+ (0, chai_1.expect)(funcCallHover).to.exist;
1521
+ (0, chai_1.expect)(funcCallHover.contents).to.equal('getPi as uninitialized | function getPi() as string | function getPi() as float');
1471
1522
  let variableHover = commonFile.getHover(vscode_languageserver_1.Position.create(3, 27));
1472
- chai_1.expect(variableHover).to.exist;
1473
- chai_1.expect(variableHover.contents).to.equal('pi as uninitialized | pi as string | pi as float');
1523
+ (0, chai_1.expect)(variableHover).to.exist;
1524
+ (0, chai_1.expect)(variableHover.contents).to.equal('pi as uninitialized | pi as string | pi as float');
1474
1525
  });
1475
1526
  });
1476
1527
  it('does not throw when encountering incomplete import statement', () => {
1477
- program.addOrReplaceFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
1528
+ program.setFile({ src: `${rootDir}/source/main.brs`, dest: 'source/main.brs' }, `
1478
1529
  import
1479
1530
  sub main()
1480
1531
  end sub
@@ -1770,12 +1821,12 @@ describe('BrsFile', () => {
1770
1821
  return consumer.generatedPositionFor({
1771
1822
  line: 3,
1772
1823
  column: 0,
1773
- source: util_1.standardizePath `${rootDir}/source/main.bs`,
1824
+ source: (0, util_1.standardizePath) `${rootDir}/source/main.bs`,
1774
1825
  bias: source_map_1.SourceMapConsumer.LEAST_UPPER_BOUND
1775
1826
  });
1776
1827
  });
1777
- chai_1.expect(location.line).to.eql(2);
1778
- chai_1.expect(location.column).eql(4);
1828
+ (0, chai_1.expect)(location.line).to.eql(2);
1829
+ (0, chai_1.expect)(location.column).eql(4);
1779
1830
  });
1780
1831
  it('computes correct locations for sourcemap', async () => {
1781
1832
  let source = `function abc(name)\n firstName = name\nend function`;
@@ -1803,7 +1854,7 @@ describe('BrsFile', () => {
1803
1854
  originalPosition.line - 1, originalPosition.column)
1804
1855
  };
1805
1856
  });
1806
- chai_1.expect(sourcemapResult).to.eql(tokenResult);
1857
+ (0, chai_1.expect)(sourcemapResult).to.eql(tokenResult);
1807
1858
  });
1808
1859
  });
1809
1860
  it('handles empty if block', () => {
@@ -1997,25 +2048,25 @@ describe('BrsFile', () => {
1997
2048
  `);
1998
2049
  });
1999
2050
  it('simple mapped files include a reference to the source map', () => {
2000
- let file = program.addOrReplaceFile('source/logger.brs', testHelpers_spec_1.trim `
2051
+ let file = program.setFile('source/logger.brs', (0, testHelpers_spec_1.trim) `
2001
2052
  sub logInfo()
2002
2053
  end sub
2003
2054
  `);
2004
2055
  file.needsTranspiled = false;
2005
2056
  const { code } = file.transpile();
2006
- chai_1.expect(code.endsWith(`'//# sourceMappingURL=./logger.brs.map`)).to.be.true;
2057
+ (0, chai_1.expect)(code.endsWith(`'//# sourceMappingURL=./logger.brs.map`)).to.be.true;
2007
2058
  });
2008
2059
  it('AST generated files include a reference to the source map', () => {
2009
- let file = program.addOrReplaceFile('source/logger.brs', testHelpers_spec_1.trim `
2060
+ let file = program.setFile('source/logger.brs', (0, testHelpers_spec_1.trim) `
2010
2061
  sub logInfo()
2011
2062
  end sub
2012
2063
  `);
2013
2064
  file.needsTranspiled = true;
2014
2065
  const { code } = file.transpile();
2015
- chai_1.expect(code.endsWith(`'//# sourceMappingURL=./logger.brs.map`)).to.be.true;
2066
+ (0, chai_1.expect)(code.endsWith(`'//# sourceMappingURL=./logger.brs.map`)).to.be.true;
2016
2067
  });
2017
2068
  it('replaces custom types in parameter types and return types', () => {
2018
- program.addOrReplaceFile('source/SomeKlass.bs', `
2069
+ program.setFile('source/SomeKlass.bs', `
2019
2070
  class SomeKlass
2020
2071
  end class
2021
2072
  `);
@@ -2040,13 +2091,13 @@ describe('BrsFile', () => {
2040
2091
  describe('transpile', () => {
2041
2092
  it('does not produce diagnostics', () => {
2042
2093
  var _a;
2043
- program.addOrReplaceFile('source/main.bs', `
2094
+ program.setFile('source/main.bs', `
2044
2095
  sub main()
2045
2096
  someObject@.someFunction(paramObject.value)
2046
2097
  end sub
2047
2098
  `);
2048
2099
  program.validate();
2049
- chai_1.expect((_a = program.getDiagnostics()[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
2100
+ (0, chai_1.expect)((_a = program.getDiagnostics()[0]) === null || _a === void 0 ? void 0 : _a.message).not.to.exist;
2050
2101
  });
2051
2102
  it('sets invalid on empty callfunc', () => {
2052
2103
  testTranspile(`
@@ -2086,116 +2137,116 @@ describe('BrsFile', () => {
2086
2137
  name: 'transform callback',
2087
2138
  afterFileParse: onParsed
2088
2139
  });
2089
- file = program.addOrReplaceFile(`source/file.${ext}`, `
2140
+ file = program.setFile(`source/file.${ext}`, `
2090
2141
  sub Sum()
2091
2142
  print "hello world"
2092
2143
  end sub
2093
2144
  `);
2094
- chai_1.expect(file.extension).to.equal(ext);
2145
+ (0, chai_1.expect)(file.extension).to.equal(ext);
2095
2146
  return file;
2096
2147
  }
2097
2148
  it('called for BRS file', () => {
2098
2149
  const onParsed = sinon.spy();
2099
2150
  parseFileWithCallback('.brs', onParsed);
2100
- chai_1.expect(onParsed.callCount).to.equal(1);
2151
+ (0, chai_1.expect)(onParsed.callCount).to.equal(1);
2101
2152
  });
2102
2153
  it('called for BS file', () => {
2103
2154
  const onParsed = sinon.spy();
2104
2155
  parseFileWithCallback('.bs', onParsed);
2105
- chai_1.expect(onParsed.callCount).to.equal(1);
2156
+ (0, chai_1.expect)(onParsed.callCount).to.equal(1);
2106
2157
  });
2107
2158
  });
2108
2159
  describe('typedefKey', () => {
2109
2160
  it('works for .brs files', () => {
2110
- chai_1.expect(util_1.standardizePath((program.addOrReplaceFile('source/main.brs', '')).typedefKey)).to.equal(util_1.standardizePath `${rootDir.toLowerCase()}/source/main.d.bs`);
2161
+ (0, chai_1.expect)((0, util_1.standardizePath)((program.setFile('source/main.brs', '')).typedefSrcPath)).to.equal((0, util_1.standardizePath) `${rootDir.toLowerCase()}/source/main.d.bs`);
2111
2162
  });
2112
2163
  it('returns undefined for files that should not have a typedef', () => {
2113
- chai_1.expect((program.addOrReplaceFile('source/main.bs', '')).typedefKey).to.be.undefined;
2114
- chai_1.expect((program.addOrReplaceFile('source/main.d.bs', '')).typedefKey).to.be.undefined;
2115
- const xmlFile = program.addOrReplaceFile('components/comp.xml', '');
2116
- chai_1.expect(xmlFile.typedefKey).to.be.undefined;
2164
+ (0, chai_1.expect)((program.setFile('source/main.bs', '')).typedefSrcPath).to.be.undefined;
2165
+ (0, chai_1.expect)((program.setFile('source/main.d.bs', '')).typedefSrcPath).to.be.undefined;
2166
+ const xmlFile = program.setFile('components/comp.xml', '');
2167
+ (0, chai_1.expect)(xmlFile.typedefSrcPath).to.be.undefined;
2117
2168
  });
2118
2169
  });
2119
2170
  describe('type definitions', () => {
2120
2171
  it('only exposes defined functions even if source has more', () => {
2121
2172
  //parse the .brs file first so it doesn't know about the typedef
2122
- program.addOrReplaceFile('source/main.brs', `
2173
+ program.setFile('source/main.brs', `
2123
2174
  sub main()
2124
2175
  end sub
2125
2176
  sub speak()
2126
2177
  end sub
2127
2178
  `);
2128
- program.addOrReplaceFile('source/main.d.bs', `
2179
+ program.setFile('source/main.d.bs', `
2129
2180
  sub main()
2130
2181
  end sub
2131
2182
  `);
2132
2183
  const sourceScope = program.getScopeByName('source');
2133
2184
  const functionNames = sourceScope.getAllCallables().map(x => x.callable.name);
2134
- chai_1.expect(functionNames).to.include('main');
2135
- chai_1.expect(functionNames).not.to.include('speak');
2185
+ (0, chai_1.expect)(functionNames).to.include('main');
2186
+ (0, chai_1.expect)(functionNames).not.to.include('speak');
2136
2187
  });
2137
2188
  it('reacts to typedef file changes', () => {
2138
- let file = program.addOrReplaceFile('source/main.brs', `
2189
+ let file = program.setFile('source/main.brs', `
2139
2190
  sub main()
2140
2191
  end sub
2141
2192
  sub speak()
2142
2193
  end sub
2143
2194
  `);
2144
- chai_1.expect(file.hasTypedef).to.be.false;
2145
- chai_1.expect(file.typedefFile).not.to.exist;
2146
- program.addOrReplaceFile('source/main.d.bs', `
2195
+ (0, chai_1.expect)(file.hasTypedef).to.be.false;
2196
+ (0, chai_1.expect)(file.typedefFile).not.to.exist;
2197
+ program.setFile('source/main.d.bs', `
2147
2198
  sub main()
2148
2199
  end sub
2149
2200
  `);
2150
- chai_1.expect(file.hasTypedef).to.be.true;
2151
- chai_1.expect(file.typedefFile).to.exist;
2201
+ (0, chai_1.expect)(file.hasTypedef).to.be.true;
2202
+ (0, chai_1.expect)(file.typedefFile).to.exist;
2152
2203
  //add replace file, does it still find the typedef
2153
- file = program.addOrReplaceFile('source/main.brs', `
2204
+ file = program.setFile('source/main.brs', `
2154
2205
  sub main()
2155
2206
  end sub
2156
2207
  sub speak()
2157
2208
  end sub
2158
2209
  `);
2159
- chai_1.expect(file.hasTypedef).to.be.true;
2160
- chai_1.expect(file.typedefFile).to.exist;
2161
- program.removeFile(util_1.standardizePath `${rootDir}/source/main.d.bs`);
2162
- chai_1.expect(file.hasTypedef).to.be.false;
2163
- chai_1.expect(file.typedefFile).not.to.exist;
2210
+ (0, chai_1.expect)(file.hasTypedef).to.be.true;
2211
+ (0, chai_1.expect)(file.typedefFile).to.exist;
2212
+ program.removeFile((0, util_1.standardizePath) `${rootDir}/source/main.d.bs`);
2213
+ (0, chai_1.expect)(file.hasTypedef).to.be.false;
2214
+ (0, chai_1.expect)(file.typedefFile).not.to.exist;
2164
2215
  });
2165
2216
  });
2166
2217
  describe('typedef', () => {
2167
2218
  it('sets typedef path properly', () => {
2168
- chai_1.expect((program.addOrReplaceFile('source/main1.brs', '')).typedefKey).to.equal(util_1.standardizePath `${rootDir}/source/main1.d.bs`.toLowerCase());
2169
- chai_1.expect((program.addOrReplaceFile('source/main2.d.bs', '')).typedefKey).to.equal(undefined);
2170
- chai_1.expect((program.addOrReplaceFile('source/main3.bs', '')).typedefKey).to.equal(undefined);
2219
+ (0, chai_1.expect)((program.setFile('source/main1.brs', '')).typedefSrcPath).to.equal((0, util_1.standardizePath) `${rootDir}/source/main1.d.bs`.toLowerCase());
2220
+ (0, chai_1.expect)((program.setFile('source/main2.d.bs', '')).typedefSrcPath).to.equal(undefined);
2221
+ (0, chai_1.expect)((program.setFile('source/main3.bs', '')).typedefSrcPath).to.equal(undefined);
2171
2222
  //works for dest with `.brs` extension
2172
- chai_1.expect((program.addOrReplaceFile({ src: 'source/main4.bs', dest: 'source/main4.brs' }, '')).typedefKey).to.equal(undefined);
2223
+ (0, chai_1.expect)((program.setFile({ src: 'source/main4.bs', dest: 'source/main4.brs' }, '')).typedefSrcPath).to.equal(undefined);
2173
2224
  });
2174
2225
  it('does not link when missing from program', () => {
2175
- const file = program.addOrReplaceFile('source/main.brs', ``);
2176
- chai_1.expect(file.typedefFile).not.to.exist;
2226
+ const file = program.setFile('source/main.brs', ``);
2227
+ (0, chai_1.expect)(file.typedefFile).not.to.exist;
2177
2228
  });
2178
2229
  it('links typedef when added BEFORE .brs file', () => {
2179
- const typedef = program.addOrReplaceFile('source/main.d.bs', ``);
2180
- const file = program.addOrReplaceFile('source/main.brs', ``);
2181
- chai_1.expect(file.typedefFile).to.equal(typedef);
2230
+ const typedef = program.setFile('source/main.d.bs', ``);
2231
+ const file = program.setFile('source/main.brs', ``);
2232
+ (0, chai_1.expect)(file.typedefFile).to.equal(typedef);
2182
2233
  });
2183
2234
  it('links typedef when added AFTER .brs file', () => {
2184
- const file = program.addOrReplaceFile('source/main.brs', ``);
2185
- const typedef = program.addOrReplaceFile('source/main.d.bs', ``);
2186
- chai_1.expect(file.typedefFile).to.eql(typedef);
2235
+ const file = program.setFile('source/main.brs', ``);
2236
+ const typedef = program.setFile('source/main.d.bs', ``);
2237
+ (0, chai_1.expect)(file.typedefFile).to.eql(typedef);
2187
2238
  });
2188
2239
  it('removes typedef link when typedef is removed', () => {
2189
- const typedef = program.addOrReplaceFile('source/main.d.bs', ``);
2190
- const file = program.addOrReplaceFile('source/main.brs', ``);
2191
- program.removeFile(typedef.pathAbsolute);
2192
- chai_1.expect(file.typedefFile).to.be.undefined;
2240
+ const typedef = program.setFile('source/main.d.bs', ``);
2241
+ const file = program.setFile('source/main.brs', ``);
2242
+ program.removeFile(typedef.srcPath);
2243
+ (0, chai_1.expect)(file.typedefFile).to.be.undefined;
2193
2244
  });
2194
2245
  });
2195
2246
  describe('getTypedef', () => {
2196
2247
  function testTypedef(original, expected) {
2197
- let file = program.addOrReplaceFile('source/main.brs', original);
2198
- chai_1.expect(file.getTypedef()).to.eql(expected);
2248
+ let file = program.setFile('source/main.brs', original);
2249
+ (0, chai_1.expect)(file.getTypedef()).to.eql(expected);
2199
2250
  }
2200
2251
  it('includes namespace on extend class names', () => {
2201
2252
  testTypedef(`
@@ -2204,7 +2255,7 @@ describe('BrsFile', () => {
2204
2255
  end class
2205
2256
  class Duck extends Bird
2206
2257
  end class
2207
- end namespace`, testHelpers_spec_1.trim `
2258
+ end namespace`, (0, testHelpers_spec_1.trim) `
2208
2259
  namespace AnimalKingdom
2209
2260
  class Bird
2210
2261
  end class
@@ -2218,7 +2269,7 @@ describe('BrsFile', () => {
2218
2269
  sub main(param1 as string)
2219
2270
  print "main"
2220
2271
  end sub
2221
- `, testHelpers_spec_1.trim `
2272
+ `, (0, testHelpers_spec_1.trim) `
2222
2273
  sub main(param1 as string)
2223
2274
  end sub
2224
2275
  `);
@@ -2241,7 +2292,7 @@ describe('BrsFile', () => {
2241
2292
  end function
2242
2293
  end class
2243
2294
  end namespace
2244
- `, testHelpers_spec_1.trim `
2295
+ `, (0, testHelpers_spec_1.trim) `
2245
2296
  namespace test
2246
2297
  @an
2247
2298
  @anFunc("value")
@@ -2262,7 +2313,7 @@ describe('BrsFile', () => {
2262
2313
  it('includes import statements', () => {
2263
2314
  testTypedef(`
2264
2315
  import "pkg:/source/lib.brs"
2265
- `, testHelpers_spec_1.trim `
2316
+ `, (0, testHelpers_spec_1.trim) `
2266
2317
  import "pkg:/source/lib.brs"
2267
2318
  `);
2268
2319
  });
@@ -2276,7 +2327,7 @@ describe('BrsFile', () => {
2276
2327
  sub logInfo()
2277
2328
  end sub
2278
2329
  end namespace
2279
- `, testHelpers_spec_1.trim `
2330
+ `, (0, testHelpers_spec_1.trim) `
2280
2331
  namespace Name
2281
2332
  sub logInfo()
2282
2333
  end sub
@@ -2305,7 +2356,7 @@ describe('BrsFile', () => {
2305
2356
  end sub
2306
2357
  end class
2307
2358
  end namespace
2308
- `, testHelpers_spec_1.trim `
2359
+ `, (0, testHelpers_spec_1.trim) `
2309
2360
  class Person
2310
2361
  public name as string
2311
2362
  public age as integer
@@ -2328,7 +2379,7 @@ describe('BrsFile', () => {
2328
2379
  public firstName = invalid
2329
2380
  public lastName as string = invalid
2330
2381
  end class
2331
- `, testHelpers_spec_1.trim `
2382
+ `, (0, testHelpers_spec_1.trim) `
2332
2383
  class Human
2333
2384
  public firstName as dynamic
2334
2385
  public lastName as string
@@ -2347,7 +2398,7 @@ describe('BrsFile', () => {
2347
2398
  super(name)
2348
2399
  end sub
2349
2400
  end class
2350
- `, testHelpers_spec_1.trim `
2401
+ `, (0, testHelpers_spec_1.trim) `
2351
2402
  class Human
2352
2403
  sub new(name as string)
2353
2404
  end sub
@@ -2374,7 +2425,7 @@ describe('BrsFile', () => {
2374
2425
  return m.lastName
2375
2426
  end function
2376
2427
  end class
2377
- `, testHelpers_spec_1.trim `
2428
+ `, (0, testHelpers_spec_1.trim) `
2378
2429
  class Human
2379
2430
  public firstName as string
2380
2431
  protected middleName as string
@@ -2400,7 +2451,7 @@ describe('BrsFile', () => {
2400
2451
  print "Hello Dog"
2401
2452
  end sub
2402
2453
  end class
2403
- `, testHelpers_spec_1.trim `
2454
+ `, (0, testHelpers_spec_1.trim) `
2404
2455
  class Animal
2405
2456
  public sub speak()
2406
2457
  end sub
@@ -2427,7 +2478,7 @@ describe('BrsFile', () => {
2427
2478
  end sub
2428
2479
  end class
2429
2480
  end namespace
2430
- `, testHelpers_spec_1.trim `
2481
+ `, (0, testHelpers_spec_1.trim) `
2431
2482
  namespace NameA
2432
2483
  class Human
2433
2484
  sub new(name as string)
@@ -2445,7 +2496,7 @@ describe('BrsFile', () => {
2445
2496
  });
2446
2497
  describe('parser getter', () => {
2447
2498
  it('recreates the parser when missing', () => {
2448
- const file = program.addOrReplaceFile('source/main.brs', `
2499
+ const file = program.setFile('source/main.brs', `
2449
2500
  sub main()
2450
2501
  end sub
2451
2502
  `);
@@ -2454,25 +2505,25 @@ describe('BrsFile', () => {
2454
2505
  file['_parser'] = undefined;
2455
2506
  //force the file to get a new instance of parser
2456
2507
  const newParser = file.parser;
2457
- chai_1.expect(newParser).to.exist.and.to.not.equal(parser);
2508
+ (0, chai_1.expect)(newParser).to.exist.and.to.not.equal(parser);
2458
2509
  //reference shouldn't change in subsequent accesses
2459
- chai_1.expect(file.parser).to.equal(newParser);
2510
+ (0, chai_1.expect)(file.parser).to.equal(newParser);
2460
2511
  });
2461
2512
  it('call parse when previously skipped', () => {
2462
- program.addOrReplaceFile('source/main.d.bs', `
2513
+ program.setFile('source/main.d.bs', `
2463
2514
  sub main()
2464
2515
  end sub
2465
2516
  `);
2466
- const file = program.addOrReplaceFile('source/main.brs', `
2517
+ const file = program.setFile('source/main.brs', `
2467
2518
  sub main()
2468
2519
  end sub
2469
2520
  `);
2470
2521
  //no functions should be found since the parser was skipped
2471
- chai_1.expect(file['_parser']).to.not.exist;
2522
+ (0, chai_1.expect)(file['_parser']).to.not.exist;
2472
2523
  const stub = sinon.stub(file, 'parse').callThrough();
2473
2524
  //`file.parser` is a getter, so that should force the parse to occur
2474
- chai_1.expect(file.parser.references.functionStatements).to.be.lengthOf(1);
2475
- chai_1.expect(stub.called).to.be.true;
2525
+ (0, chai_1.expect)(file.parser.references.functionStatements).to.be.lengthOf(1);
2526
+ (0, chai_1.expect)(stub.called).to.be.true;
2476
2527
  //parse should have been called
2477
2528
  });
2478
2529
  });