brighterscript 0.72.0 → 0.72.2

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 (335) hide show
  1. package/bsconfig.schema.json +62 -0
  2. package/dist/BsConfig.d.ts +56 -1
  3. package/dist/CommentFlagProcessor.d.ts +16 -12
  4. package/dist/CommentFlagProcessor.js +141 -59
  5. package/dist/CommentFlagProcessor.js.map +1 -1
  6. package/dist/DiagnosticMessages.d.ts +27 -1
  7. package/dist/DiagnosticMessages.js +32 -2
  8. package/dist/DiagnosticMessages.js.map +1 -1
  9. package/dist/Program.d.ts +4 -0
  10. package/dist/Program.js +2 -0
  11. package/dist/Program.js.map +1 -1
  12. package/dist/ProgramBuilder.d.ts +1 -8
  13. package/dist/ProgramBuilder.js +31 -11
  14. package/dist/ProgramBuilder.js.map +1 -1
  15. package/dist/bscPlugin/codeActions/CodeActionsProcessor.d.ts +38 -0
  16. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +257 -14
  17. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
  18. package/dist/bscPlugin/validation/BrsFileValidator.js +13 -0
  19. package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -1
  20. package/dist/cli.js +13 -0
  21. package/dist/cli.js.map +1 -1
  22. package/dist/diagnosticUtils.d.ts +51 -1
  23. package/dist/diagnosticUtils.js +222 -1
  24. package/dist/diagnosticUtils.js.map +1 -1
  25. package/dist/files/BrsFile.js +4 -2
  26. package/dist/files/BrsFile.js.map +1 -1
  27. package/dist/files/XmlFile.js +2 -1
  28. package/dist/files/XmlFile.js.map +1 -1
  29. package/dist/interfaces.d.ts +15 -1
  30. package/dist/lexer/TokenKind.d.ts +8 -0
  31. package/dist/lexer/TokenKind.js +21 -1
  32. package/dist/lexer/TokenKind.js.map +1 -1
  33. package/dist/lsp/LspProject.d.ts +19 -0
  34. package/dist/lsp/Project.d.ts +14 -0
  35. package/dist/lsp/Project.js +9 -1
  36. package/dist/lsp/Project.js.map +1 -1
  37. package/dist/lsp/ProjectManager.js +15 -1
  38. package/dist/lsp/ProjectManager.js.map +1 -1
  39. package/dist/lsp/worker/WorkerThreadProject.d.ts +14 -0
  40. package/dist/lsp/worker/WorkerThreadProject.js +7 -0
  41. package/dist/lsp/worker/WorkerThreadProject.js.map +1 -1
  42. package/dist/parser/Parser.d.ts +13 -1
  43. package/dist/parser/Parser.js +40 -14
  44. package/dist/parser/Parser.js.map +1 -1
  45. package/dist/util.js +20 -9
  46. package/dist/util.js.map +1 -1
  47. package/package.json +17 -14
  48. package/dist/astUtils/AstEditor.spec.d.ts +0 -1
  49. package/dist/astUtils/AstEditor.spec.js +0 -254
  50. package/dist/astUtils/AstEditor.spec.js.map +0 -1
  51. package/dist/astUtils/creators.spec.d.ts +0 -1
  52. package/dist/astUtils/creators.spec.js +0 -21
  53. package/dist/astUtils/creators.spec.js.map +0 -1
  54. package/dist/astUtils/reflection.spec.d.ts +0 -1
  55. package/dist/astUtils/reflection.spec.js +0 -308
  56. package/dist/astUtils/reflection.spec.js.map +0 -1
  57. package/dist/astUtils/stackedVisitor.spec.d.ts +0 -1
  58. package/dist/astUtils/stackedVisitor.spec.js +0 -79
  59. package/dist/astUtils/stackedVisitor.spec.js.map +0 -1
  60. package/dist/astUtils/visitors.spec.d.ts +0 -1
  61. package/dist/astUtils/visitors.spec.js +0 -1197
  62. package/dist/astUtils/visitors.spec.js.map +0 -1
  63. package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.d.ts +0 -1
  64. package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js +0 -887
  65. package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js.map +0 -1
  66. package/dist/bscPlugin/definition/DefinitionProvider.spec.d.ts +0 -1
  67. package/dist/bscPlugin/definition/DefinitionProvider.spec.js +0 -171
  68. package/dist/bscPlugin/definition/DefinitionProvider.spec.js.map +0 -1
  69. package/dist/bscPlugin/hover/HoverProcessor.spec.d.ts +0 -1
  70. package/dist/bscPlugin/hover/HoverProcessor.spec.js +0 -201
  71. package/dist/bscPlugin/hover/HoverProcessor.spec.js.map +0 -1
  72. package/dist/bscPlugin/references/ReferencesProvider.spec.d.ts +0 -1
  73. package/dist/bscPlugin/references/ReferencesProvider.spec.js +0 -51
  74. package/dist/bscPlugin/references/ReferencesProvider.spec.js.map +0 -1
  75. package/dist/bscPlugin/selectionRanges/SelectionRangesProcessor.spec.d.ts +0 -1
  76. package/dist/bscPlugin/selectionRanges/SelectionRangesProcessor.spec.js +0 -298
  77. package/dist/bscPlugin/selectionRanges/SelectionRangesProcessor.spec.js.map +0 -1
  78. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.d.ts +0 -1
  79. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js +0 -399
  80. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js.map +0 -1
  81. package/dist/bscPlugin/symbols/DocumentSymbolProcessor.spec.d.ts +0 -1
  82. package/dist/bscPlugin/symbols/DocumentSymbolProcessor.spec.js +0 -290
  83. package/dist/bscPlugin/symbols/DocumentSymbolProcessor.spec.js.map +0 -1
  84. package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.spec.d.ts +0 -1
  85. package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.spec.js +0 -245
  86. package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.spec.js.map +0 -1
  87. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.d.ts +0 -1
  88. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js +0 -46
  89. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js.map +0 -1
  90. package/dist/bscPlugin/validation/BrsFileValidator.spec.d.ts +0 -1
  91. package/dist/bscPlugin/validation/BrsFileValidator.spec.js +0 -487
  92. package/dist/bscPlugin/validation/BrsFileValidator.spec.js.map +0 -1
  93. package/dist/common/Sequencer.spec.d.ts +0 -1
  94. package/dist/common/Sequencer.spec.js +0 -75
  95. package/dist/common/Sequencer.spec.js.map +0 -1
  96. package/dist/files/BrsFile.Class.spec.d.ts +0 -1
  97. package/dist/files/BrsFile.Class.spec.js +0 -1805
  98. package/dist/files/BrsFile.Class.spec.js.map +0 -1
  99. package/dist/files/BrsFile.spec.d.ts +0 -1
  100. package/dist/files/BrsFile.spec.js +0 -4420
  101. package/dist/files/BrsFile.spec.js.map +0 -1
  102. package/dist/files/XmlFile.spec.d.ts +0 -1
  103. package/dist/files/XmlFile.spec.js +0 -1169
  104. package/dist/files/XmlFile.spec.js.map +0 -1
  105. package/dist/files/tests/imports.spec.d.ts +0 -1
  106. package/dist/files/tests/imports.spec.js +0 -241
  107. package/dist/files/tests/imports.spec.js.map +0 -1
  108. package/dist/files/tests/optionalChaning.spec.d.ts +0 -1
  109. package/dist/files/tests/optionalChaning.spec.js +0 -152
  110. package/dist/files/tests/optionalChaning.spec.js.map +0 -1
  111. package/dist/lexer/Character.spec.d.ts +0 -1
  112. package/dist/lexer/Character.spec.js +0 -27
  113. package/dist/lexer/Character.spec.js.map +0 -1
  114. package/dist/lexer/Lexer.spec.d.ts +0 -1
  115. package/dist/lexer/Lexer.spec.js +0 -1300
  116. package/dist/lexer/Lexer.spec.js.map +0 -1
  117. package/dist/lsp/ActionQueue.spec.d.ts +0 -1
  118. package/dist/lsp/ActionQueue.spec.js +0 -80
  119. package/dist/lsp/ActionQueue.spec.js.map +0 -1
  120. package/dist/lsp/DocumentManager.spec.d.ts +0 -1
  121. package/dist/lsp/DocumentManager.spec.js +0 -103
  122. package/dist/lsp/DocumentManager.spec.js.map +0 -1
  123. package/dist/lsp/PathFilterer.spec.d.ts +0 -1
  124. package/dist/lsp/PathFilterer.spec.js +0 -182
  125. package/dist/lsp/PathFilterer.spec.js.map +0 -1
  126. package/dist/lsp/Project.spec.d.ts +0 -1
  127. package/dist/lsp/Project.spec.js +0 -400
  128. package/dist/lsp/Project.spec.js.map +0 -1
  129. package/dist/lsp/ProjectManager.spec.d.ts +0 -1
  130. package/dist/lsp/ProjectManager.spec.js +0 -1147
  131. package/dist/lsp/ProjectManager.spec.js.map +0 -1
  132. package/dist/lsp/worker/MessageHandler.spec.d.ts +0 -1
  133. package/dist/lsp/worker/MessageHandler.spec.js +0 -64
  134. package/dist/lsp/worker/MessageHandler.spec.js.map +0 -1
  135. package/dist/lsp/worker/WorkerPool.spec.d.ts +0 -1
  136. package/dist/lsp/worker/WorkerPool.spec.js +0 -59
  137. package/dist/lsp/worker/WorkerPool.spec.js.map +0 -1
  138. package/dist/lsp/worker/WorkerThreadProject.spec.d.ts +0 -2
  139. package/dist/lsp/worker/WorkerThreadProject.spec.js +0 -72
  140. package/dist/lsp/worker/WorkerThreadProject.spec.js.map +0 -1
  141. package/dist/parser/AstNode.spec.d.ts +0 -1
  142. package/dist/parser/AstNode.spec.js +0 -1452
  143. package/dist/parser/AstNode.spec.js.map +0 -1
  144. package/dist/parser/Expression.spec.d.ts +0 -1
  145. package/dist/parser/Expression.spec.js +0 -40
  146. package/dist/parser/Expression.spec.js.map +0 -1
  147. package/dist/parser/Parser.Class.spec.d.ts +0 -1
  148. package/dist/parser/Parser.Class.spec.js +0 -495
  149. package/dist/parser/Parser.Class.spec.js.map +0 -1
  150. package/dist/parser/Parser.spec.d.ts +0 -4
  151. package/dist/parser/Parser.spec.js +0 -1857
  152. package/dist/parser/Parser.spec.js.map +0 -1
  153. package/dist/parser/SGParser.spec.d.ts +0 -1
  154. package/dist/parser/SGParser.spec.js +0 -131
  155. package/dist/parser/SGParser.spec.js.map +0 -1
  156. package/dist/parser/Statement.spec.d.ts +0 -1
  157. package/dist/parser/Statement.spec.js +0 -118
  158. package/dist/parser/Statement.spec.js.map +0 -1
  159. package/dist/parser/tests/Parser.spec.d.ts +0 -19
  160. package/dist/parser/tests/Parser.spec.js +0 -38
  161. package/dist/parser/tests/Parser.spec.js.map +0 -1
  162. package/dist/parser/tests/controlFlow/For.spec.d.ts +0 -1
  163. package/dist/parser/tests/controlFlow/For.spec.js +0 -161
  164. package/dist/parser/tests/controlFlow/For.spec.js.map +0 -1
  165. package/dist/parser/tests/controlFlow/ForEach.spec.d.ts +0 -1
  166. package/dist/parser/tests/controlFlow/ForEach.spec.js +0 -106
  167. package/dist/parser/tests/controlFlow/ForEach.spec.js.map +0 -1
  168. package/dist/parser/tests/controlFlow/If.spec.d.ts +0 -1
  169. package/dist/parser/tests/controlFlow/If.spec.js +0 -570
  170. package/dist/parser/tests/controlFlow/If.spec.js.map +0 -1
  171. package/dist/parser/tests/controlFlow/While.spec.d.ts +0 -1
  172. package/dist/parser/tests/controlFlow/While.spec.js +0 -107
  173. package/dist/parser/tests/controlFlow/While.spec.js.map +0 -1
  174. package/dist/parser/tests/expression/Additive.spec.d.ts +0 -1
  175. package/dist/parser/tests/expression/Additive.spec.js +0 -99
  176. package/dist/parser/tests/expression/Additive.spec.js.map +0 -1
  177. package/dist/parser/tests/expression/ArrayLiterals.spec.d.ts +0 -1
  178. package/dist/parser/tests/expression/ArrayLiterals.spec.js +0 -291
  179. package/dist/parser/tests/expression/ArrayLiterals.spec.js.map +0 -1
  180. package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.d.ts +0 -1
  181. package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js +0 -401
  182. package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js.map +0 -1
  183. package/dist/parser/tests/expression/Boolean.spec.d.ts +0 -1
  184. package/dist/parser/tests/expression/Boolean.spec.js +0 -83
  185. package/dist/parser/tests/expression/Boolean.spec.js.map +0 -1
  186. package/dist/parser/tests/expression/Call.spec.d.ts +0 -1
  187. package/dist/parser/tests/expression/Call.spec.js +0 -242
  188. package/dist/parser/tests/expression/Call.spec.js.map +0 -1
  189. package/dist/parser/tests/expression/Exponential.spec.d.ts +0 -1
  190. package/dist/parser/tests/expression/Exponential.spec.js +0 -37
  191. package/dist/parser/tests/expression/Exponential.spec.js.map +0 -1
  192. package/dist/parser/tests/expression/Function.spec.d.ts +0 -1
  193. package/dist/parser/tests/expression/Function.spec.js +0 -403
  194. package/dist/parser/tests/expression/Function.spec.js.map +0 -1
  195. package/dist/parser/tests/expression/Indexing.spec.d.ts +0 -1
  196. package/dist/parser/tests/expression/Indexing.spec.js +0 -289
  197. package/dist/parser/tests/expression/Indexing.spec.js.map +0 -1
  198. package/dist/parser/tests/expression/Multiplicative.spec.d.ts +0 -1
  199. package/dist/parser/tests/expression/Multiplicative.spec.js +0 -67
  200. package/dist/parser/tests/expression/Multiplicative.spec.js.map +0 -1
  201. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.d.ts +0 -1
  202. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +0 -346
  203. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +0 -1
  204. package/dist/parser/tests/expression/PrefixUnary.spec.d.ts +0 -1
  205. package/dist/parser/tests/expression/PrefixUnary.spec.js +0 -105
  206. package/dist/parser/tests/expression/PrefixUnary.spec.js.map +0 -1
  207. package/dist/parser/tests/expression/Primary.spec.d.ts +0 -1
  208. package/dist/parser/tests/expression/Primary.spec.js +0 -149
  209. package/dist/parser/tests/expression/Primary.spec.js.map +0 -1
  210. package/dist/parser/tests/expression/RegexLiteralExpression.spec.d.ts +0 -1
  211. package/dist/parser/tests/expression/RegexLiteralExpression.spec.js +0 -171
  212. package/dist/parser/tests/expression/RegexLiteralExpression.spec.js.map +0 -1
  213. package/dist/parser/tests/expression/Relational.spec.d.ts +0 -1
  214. package/dist/parser/tests/expression/Relational.spec.js +0 -83
  215. package/dist/parser/tests/expression/Relational.spec.js.map +0 -1
  216. package/dist/parser/tests/expression/SourceLiteralExpression.spec.d.ts +0 -1
  217. package/dist/parser/tests/expression/SourceLiteralExpression.spec.js +0 -201
  218. package/dist/parser/tests/expression/SourceLiteralExpression.spec.js.map +0 -1
  219. package/dist/parser/tests/expression/TemplateStringExpression.spec.d.ts +0 -1
  220. package/dist/parser/tests/expression/TemplateStringExpression.spec.js +0 -389
  221. package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +0 -1
  222. package/dist/parser/tests/expression/TernaryExpression.spec.d.ts +0 -1
  223. package/dist/parser/tests/expression/TernaryExpression.spec.js +0 -876
  224. package/dist/parser/tests/expression/TernaryExpression.spec.js.map +0 -1
  225. package/dist/parser/tests/expression/UnaryExpression.spec.d.ts +0 -1
  226. package/dist/parser/tests/expression/UnaryExpression.spec.js +0 -52
  227. package/dist/parser/tests/expression/UnaryExpression.spec.js.map +0 -1
  228. package/dist/parser/tests/statement/AssignmentOperators.spec.d.ts +0 -1
  229. package/dist/parser/tests/statement/AssignmentOperators.spec.js +0 -79
  230. package/dist/parser/tests/statement/AssignmentOperators.spec.js.map +0 -1
  231. package/dist/parser/tests/statement/ConstStatement.spec.d.ts +0 -1
  232. package/dist/parser/tests/statement/ConstStatement.spec.js +0 -708
  233. package/dist/parser/tests/statement/ConstStatement.spec.js.map +0 -1
  234. package/dist/parser/tests/statement/Continue.spec.d.ts +0 -1
  235. package/dist/parser/tests/statement/Continue.spec.js +0 -119
  236. package/dist/parser/tests/statement/Continue.spec.js.map +0 -1
  237. package/dist/parser/tests/statement/Declaration.spec.d.ts +0 -1
  238. package/dist/parser/tests/statement/Declaration.spec.js +0 -108
  239. package/dist/parser/tests/statement/Declaration.spec.js.map +0 -1
  240. package/dist/parser/tests/statement/Dim.spec.d.ts +0 -1
  241. package/dist/parser/tests/statement/Dim.spec.js +0 -73
  242. package/dist/parser/tests/statement/Dim.spec.js.map +0 -1
  243. package/dist/parser/tests/statement/Enum.spec.d.ts +0 -1
  244. package/dist/parser/tests/statement/Enum.spec.js +0 -1307
  245. package/dist/parser/tests/statement/Enum.spec.js.map +0 -1
  246. package/dist/parser/tests/statement/For.spec.d.ts +0 -1
  247. package/dist/parser/tests/statement/For.spec.js +0 -45
  248. package/dist/parser/tests/statement/For.spec.js.map +0 -1
  249. package/dist/parser/tests/statement/ForEach.spec.d.ts +0 -1
  250. package/dist/parser/tests/statement/ForEach.spec.js +0 -36
  251. package/dist/parser/tests/statement/ForEach.spec.js.map +0 -1
  252. package/dist/parser/tests/statement/Function.spec.d.ts +0 -1
  253. package/dist/parser/tests/statement/Function.spec.js +0 -342
  254. package/dist/parser/tests/statement/Function.spec.js.map +0 -1
  255. package/dist/parser/tests/statement/Goto.spec.d.ts +0 -1
  256. package/dist/parser/tests/statement/Goto.spec.js +0 -51
  257. package/dist/parser/tests/statement/Goto.spec.js.map +0 -1
  258. package/dist/parser/tests/statement/Increment.spec.d.ts +0 -1
  259. package/dist/parser/tests/statement/Increment.spec.js +0 -117
  260. package/dist/parser/tests/statement/Increment.spec.js.map +0 -1
  261. package/dist/parser/tests/statement/InterfaceStatement.spec.d.ts +0 -1
  262. package/dist/parser/tests/statement/InterfaceStatement.spec.js +0 -102
  263. package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +0 -1
  264. package/dist/parser/tests/statement/LibraryStatement.spec.d.ts +0 -1
  265. package/dist/parser/tests/statement/LibraryStatement.spec.js +0 -74
  266. package/dist/parser/tests/statement/LibraryStatement.spec.js.map +0 -1
  267. package/dist/parser/tests/statement/Misc.spec.d.ts +0 -1
  268. package/dist/parser/tests/statement/Misc.spec.js +0 -335
  269. package/dist/parser/tests/statement/Misc.spec.js.map +0 -1
  270. package/dist/parser/tests/statement/PrintStatement.spec.d.ts +0 -1
  271. package/dist/parser/tests/statement/PrintStatement.spec.js +0 -195
  272. package/dist/parser/tests/statement/PrintStatement.spec.js.map +0 -1
  273. package/dist/parser/tests/statement/ReturnStatement.spec.d.ts +0 -1
  274. package/dist/parser/tests/statement/ReturnStatement.spec.js +0 -94
  275. package/dist/parser/tests/statement/ReturnStatement.spec.js.map +0 -1
  276. package/dist/parser/tests/statement/Set.spec.d.ts +0 -1
  277. package/dist/parser/tests/statement/Set.spec.js +0 -218
  278. package/dist/parser/tests/statement/Set.spec.js.map +0 -1
  279. package/dist/parser/tests/statement/Stop.spec.d.ts +0 -1
  280. package/dist/parser/tests/statement/Stop.spec.js +0 -38
  281. package/dist/parser/tests/statement/Stop.spec.js.map +0 -1
  282. package/dist/parser/tests/statement/Throw.spec.d.ts +0 -1
  283. package/dist/parser/tests/statement/Throw.spec.js +0 -35
  284. package/dist/parser/tests/statement/Throw.spec.js.map +0 -1
  285. package/dist/parser/tests/statement/TryCatch.spec.d.ts +0 -1
  286. package/dist/parser/tests/statement/TryCatch.spec.js +0 -142
  287. package/dist/parser/tests/statement/TryCatch.spec.js.map +0 -1
  288. package/dist/preprocessor/Manifest.spec.d.ts +0 -1
  289. package/dist/preprocessor/Manifest.spec.js +0 -80
  290. package/dist/preprocessor/Manifest.spec.js.map +0 -1
  291. package/dist/preprocessor/Preprocessor.spec.d.ts +0 -1
  292. package/dist/preprocessor/Preprocessor.spec.js +0 -152
  293. package/dist/preprocessor/Preprocessor.spec.js.map +0 -1
  294. package/dist/preprocessor/PreprocessorParser.spec.d.ts +0 -1
  295. package/dist/preprocessor/PreprocessorParser.spec.js +0 -116
  296. package/dist/preprocessor/PreprocessorParser.spec.js.map +0 -1
  297. package/dist/types/ArrayType.spec.d.ts +0 -1
  298. package/dist/types/ArrayType.spec.js +0 -30
  299. package/dist/types/ArrayType.spec.js.map +0 -1
  300. package/dist/types/BooleanType.spec.d.ts +0 -1
  301. package/dist/types/BooleanType.spec.js +0 -12
  302. package/dist/types/BooleanType.spec.js.map +0 -1
  303. package/dist/types/DoubleType.spec.d.ts +0 -1
  304. package/dist/types/DoubleType.spec.js +0 -12
  305. package/dist/types/DoubleType.spec.js.map +0 -1
  306. package/dist/types/DynamicType.spec.d.ts +0 -1
  307. package/dist/types/DynamicType.spec.js +0 -12
  308. package/dist/types/DynamicType.spec.js.map +0 -1
  309. package/dist/types/FloatType.spec.d.ts +0 -1
  310. package/dist/types/FloatType.spec.js +0 -12
  311. package/dist/types/FloatType.spec.js.map +0 -1
  312. package/dist/types/FunctionType.spec.d.ts +0 -1
  313. package/dist/types/FunctionType.spec.js +0 -23
  314. package/dist/types/FunctionType.spec.js.map +0 -1
  315. package/dist/types/IntegerType.spec.d.ts +0 -1
  316. package/dist/types/IntegerType.spec.js +0 -12
  317. package/dist/types/IntegerType.spec.js.map +0 -1
  318. package/dist/types/InterfaceType.spec.d.ts +0 -1
  319. package/dist/types/InterfaceType.spec.js +0 -175
  320. package/dist/types/InterfaceType.spec.js.map +0 -1
  321. package/dist/types/InvalidType.spec.d.ts +0 -1
  322. package/dist/types/InvalidType.spec.js +0 -12
  323. package/dist/types/InvalidType.spec.js.map +0 -1
  324. package/dist/types/LongIntegerType.spec.d.ts +0 -1
  325. package/dist/types/LongIntegerType.spec.js +0 -12
  326. package/dist/types/LongIntegerType.spec.js.map +0 -1
  327. package/dist/types/ObjectType.spec.d.ts +0 -1
  328. package/dist/types/ObjectType.spec.js +0 -12
  329. package/dist/types/ObjectType.spec.js.map +0 -1
  330. package/dist/types/StringType.spec.d.ts +0 -1
  331. package/dist/types/StringType.spec.js +0 -12
  332. package/dist/types/StringType.spec.js.map +0 -1
  333. package/dist/types/VoidType.spec.d.ts +0 -1
  334. package/dist/types/VoidType.spec.js +0 -12
  335. package/dist/types/VoidType.spec.js.map +0 -1
@@ -1,708 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const testHelpers_spec_1 = require("../../../testHelpers.spec");
4
- const util_1 = require("../../../util");
5
- const Program_1 = require("../../../Program");
6
- const sinon_1 = require("sinon");
7
- const Parser_1 = require("../../Parser");
8
- const chai_config_spec_1 = require("../../../chai-config.spec");
9
- const TokenKind_1 = require("../../../lexer/TokenKind");
10
- const Expression_1 = require("../../Expression");
11
- const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
12
- const DiagnosticMessages_1 = require("../../../DiagnosticMessages");
13
- const testHelpers_spec_2 = require("../../../testHelpers.spec");
14
- const sinon = (0, sinon_1.createSandbox)();
15
- describe('ConstStatement', () => {
16
- let program;
17
- let parser;
18
- let testTranspile = (0, testHelpers_spec_1.getTestTranspile)(() => [program, testHelpers_spec_2.rootDir]);
19
- let testGetTypedef = (0, testHelpers_spec_1.getTestGetTypedef)(() => [program, testHelpers_spec_2.rootDir]);
20
- beforeEach(() => {
21
- program = new Program_1.Program({ rootDir: testHelpers_spec_2.rootDir, sourceMap: true });
22
- parser = new Parser_1.Parser();
23
- });
24
- afterEach(() => {
25
- sinon.restore();
26
- program.dispose();
27
- });
28
- it('does not prevent using `const` as a variable name in .brs files', () => {
29
- program.setFile('source/main.brs', `
30
- sub main()
31
- const = {
32
- name: "Bob"
33
- }
34
- print const.name = {}
35
- end sub
36
- `);
37
- program.validate();
38
- (0, testHelpers_spec_1.expectZeroDiagnostics)(program);
39
- });
40
- it('supports basic structure', () => {
41
- var _a, _b;
42
- parser.parse('const API_KEY = "abc"', { mode: Parser_1.ParseMode.BrighterScript });
43
- (0, testHelpers_spec_1.expectZeroDiagnostics)(parser);
44
- const statement = parser.ast.statements[0];
45
- (0, chai_config_spec_1.expect)((_a = statement.tokens.const) === null || _a === void 0 ? void 0 : _a.kind).to.eql(TokenKind_1.TokenKind.Const);
46
- (0, chai_config_spec_1.expect)(statement.tokens.name).to.include({
47
- kind: TokenKind_1.TokenKind.Identifier,
48
- text: 'API_KEY'
49
- });
50
- const value = statement.value;
51
- (0, chai_config_spec_1.expect)(value).to.be.instanceof(Expression_1.LiteralExpression);
52
- (0, chai_config_spec_1.expect)((_b = value.token) === null || _b === void 0 ? void 0 : _b.text).to.eql('"abc"');
53
- //ensure range is correct
54
- (0, chai_config_spec_1.expect)(statement.range).to.eql(util_1.util.createRange(0, 0, 0, 21));
55
- });
56
- it('produces typedef', () => {
57
- testGetTypedef(`
58
- const API_KEY = "abc"
59
- const SOME_OBJ = {}
60
- const SOME_ARR = []
61
- `);
62
- });
63
- it('allows const with the name `optional`', () => {
64
- program.setFile('source/main.bs', `
65
- const optional = true
66
- namespace alpha
67
- const optional = true
68
- end namespace
69
- sub main()
70
- print optional
71
- print alpha.optional
72
- end sub
73
- `);
74
- program.validate();
75
- (0, testHelpers_spec_1.expectZeroDiagnostics)(program);
76
- });
77
- describe('transpile', () => {
78
- it('transpiles simple consts', () => {
79
- testTranspile(`
80
- const API_KEY = "abc"
81
- sub main()
82
- print API_KEY
83
- end sub
84
- `, `
85
- sub main()
86
- print "abc"
87
- end sub
88
- `);
89
- });
90
- it('transpiles arrays', () => {
91
- testTranspile(`
92
- const WORDS = [
93
- "alpha"
94
- "beta"
95
- ]
96
- sub main()
97
- print WORDS
98
- end sub
99
- `, `
100
- sub main()
101
- print ([
102
- "alpha"
103
- "beta"
104
- ])
105
- end sub
106
- `);
107
- });
108
- it('transpiles objects', () => {
109
- testTranspile(`
110
- const DEFAULTS = {
111
- alpha: true
112
- beta: true
113
- }
114
- sub main()
115
- print DEFAULTS
116
- end sub
117
- `, `
118
- sub main()
119
- print ({
120
- alpha: true
121
- beta: true
122
- })
123
- end sub
124
- `);
125
- });
126
- it('supports consts inside namespaces', () => {
127
- testTranspile(`
128
- namespace network
129
- const API_KEY = "abc"
130
- sub get()
131
- print API_KEY
132
- end sub
133
- end namespace
134
- sub main()
135
- print network.API_KEY
136
- end sub
137
- `, `
138
- sub network_get()
139
- print "abc"
140
- end sub
141
-
142
- sub main()
143
- print "abc"
144
- end sub
145
- `);
146
- });
147
- it('supports property access on complex objects', () => {
148
- testTranspile(`
149
- const DEFAULTS = {
150
- enabled: true
151
- }
152
- sub main()
153
- print DEFAULTS.enabled
154
- end sub
155
- `, `
156
- sub main()
157
- print ({
158
- enabled: true
159
- }).enabled
160
- end sub
161
- `);
162
- });
163
- it('supports calling methods on consts', () => {
164
- testTranspile(`
165
- const API_KEY ="ABC"
166
- sub main()
167
- print API_KEY.toString()
168
- end sub
169
- `, `
170
- sub main()
171
- print "ABC".toString()
172
- end sub
173
- `);
174
- });
175
- it('transpiles within += operator', () => {
176
- testTranspile(`
177
- namespace constants
178
- const API_KEY = "test"
179
- end namespace
180
- const API_URL = "url"
181
- sub main()
182
- value = ""
183
- value += constants.API_KEY
184
- value += API_URL
185
- end sub
186
- `, `
187
- sub main()
188
- value = ""
189
- value += "test"
190
- value += "url"
191
- end sub
192
- `);
193
- });
194
- it('transpiles nested consts that reference other consts within same namespace', () => {
195
- testTranspile(`
196
- namespace theming
197
- const FLAG_A = "A"
198
- const FLAG_B = "B"
199
- const AD_BREAK_START = { a: FLAG_A, b: FLAG_B }
200
- end namespace
201
- sub main()
202
- print theming.AD_BREAK_START
203
- end sub
204
- `, `
205
- sub main()
206
- print ({
207
- a: "A"
208
- b: "B"
209
- })
210
- end sub
211
- `);
212
- });
213
- it('transpiles nested consts that reference other consts in different namespaces', () => {
214
- testTranspile(`
215
- namespace aa.bb
216
- const FLAG_A = "A"
217
- end namespace
218
- namespace main
219
- const FLAG_B = "B"
220
- const AD_BREAK_START = { a: aa.bb.FLAG_A, b: FLAG_B }
221
- end namespace
222
- sub main()
223
- print main.AD_BREAK_START
224
- end sub
225
- `, `
226
- sub main()
227
- print ({
228
- a: "A"
229
- b: "B"
230
- })
231
- end sub
232
- `);
233
- });
234
- it('transpiles nested consts that reference other consts across files', () => {
235
- program.setFile('source/constants.bs', `
236
- namespace theming
237
- const PRIMARY_COLOR = "blue"
238
- end namespace
239
- const FLAG_B = "B"
240
- `);
241
- testTranspile(`
242
- const SECONDARY_COLOR = theming.PRIMARY_COLOR
243
- const AD_BREAK_START = { a: SECONDARY_COLOR, b: FLAG_B }
244
- sub main()
245
- print AD_BREAK_START
246
- end sub
247
- `, `
248
- sub main()
249
- print ({
250
- a: "blue"
251
- b: "B"
252
- })
253
- end sub
254
- `);
255
- });
256
- it('recursively resolves nested consts that reference other consts', () => {
257
- testTranspile(`
258
- const FLAG_A = "A"
259
- const FLAG_B = FLAG_A
260
- const AD_BREAK_START = { a: FLAG_A, b: FLAG_B }
261
- sub main()
262
- print AD_BREAK_START
263
- end sub
264
- `, `
265
- sub main()
266
- print ({
267
- a: "A"
268
- b: "A"
269
- })
270
- end sub
271
- `);
272
- });
273
- it('handles the exact example from the issue - nested consts with namespace references', () => {
274
- testTranspile(`
275
- namespace aa.bb
276
- const FLAG_A = "test"
277
- end namespace
278
- const FLAG_B = "another"
279
- const AD_BREAK_START = { a: aa.bb.FLAG_A, b: FLAG_B }
280
- sub main()
281
- print AD_BREAK_START
282
- end sub
283
- `, `
284
- sub main()
285
- print ({
286
- a: "test"
287
- b: "another"
288
- })
289
- end sub
290
- `);
291
- });
292
- it('handles cyclical const references without infinite loop', () => {
293
- //the cycle is also reported via a diagnostic; this test only verifies
294
- //the transpile output doesn't recurse forever.
295
- testTranspile(`
296
- const A = B
297
- const B = C
298
- const C = A
299
- sub main()
300
- print A
301
- end sub
302
- `, `
303
- sub main()
304
- print A
305
- end sub
306
- `, 'trim', 'source/main.bs', false);
307
- });
308
- it('resolves consts inside array literals', () => {
309
- testTranspile(`
310
- const FLAG_A = "A"
311
- const FLAG_B = "B"
312
- const MY_ARRAY = [FLAG_A, FLAG_B, "C"]
313
- sub main()
314
- print MY_ARRAY
315
- end sub
316
- `, `
317
- sub main()
318
- print ([
319
- "A"
320
- "B"
321
- "C"
322
- ])
323
- end sub
324
- `);
325
- });
326
- it('resolves enum used in const - same file', () => {
327
- testTranspile(`
328
- namespace Theming
329
- enum Color
330
- RED = "#FF0000"
331
- BLUE = "#0000FF"
332
- end enum
333
- const PRIMARY_COLOR = Theming.Color.BLUE
334
- end namespace
335
- sub main()
336
- a = Theming.PRIMARY_COLOR
337
- end sub
338
- `, `
339
- sub main()
340
- a = "#0000FF"
341
- end sub
342
- `);
343
- });
344
- it('resolves enum used in const - cross file', () => {
345
- program.setFile('source/theming.bs', `
346
- namespace Theming
347
- enum Color
348
- BLACK = "#000000"
349
- BLUE = "#0000FF"
350
- end enum
351
- end namespace
352
- `);
353
- testTranspile(`
354
- namespace Theming
355
- const PRIMARY_COLOR = Theming.Color.BLUE
356
- end namespace
357
- sub main()
358
- a = Theming.PRIMARY_COLOR
359
- end sub
360
- `, `
361
- sub main()
362
- a = "#0000FF"
363
- end sub
364
- `);
365
- });
366
- it('resolves const -> enum -> const -> enum chain across files', () => {
367
- program.setFile('source/theming1.bs', `
368
- namespace Theming
369
- const BACKGROUND_COLOR = Theming.Color.BLACK
370
- end namespace
371
- `);
372
- program.setFile('source/theming2.bs', `
373
- namespace Theming
374
- enum Color
375
- BLACK = "#000000"
376
- WHITE = "#FFFFFF"
377
- end enum
378
- end namespace
379
- `);
380
- program.setFile('source/theming3.bs', `
381
- namespace Theming
382
- const OVERLAY_COLOR = Theming.BACKGROUND_COLOR
383
- end namespace
384
- `);
385
- testTranspile(`
386
- sub test()
387
- aa = {
388
- backgroundOverlay: {
389
- color: Theming.OVERLAY_COLOR
390
- }
391
- }
392
- end sub
393
- `, `
394
- sub test()
395
- aa = {
396
- backgroundOverlay: {
397
- color: "#000000"
398
- }
399
- }
400
- end sub
401
- `);
402
- });
403
- it('resolves enum refs inside an aa-literal const used cross-file (issue #1618)', () => {
404
- program.setFile('source/map.bs', `
405
- namespace name.space
406
- enum someEnum
407
- one = "val1"
408
- two = "val2"
409
- three = "val3"
410
- end enum
411
-
412
- const myMap = {
413
- "key1": someEnum.one
414
- "key2": someEnum.two
415
- "key3": someEnum.three
416
- }
417
- end namespace
418
- `);
419
- testTranspile(`
420
- namespace name.space
421
- class someClass
422
- public function someFunc(key as dynamic) as object
423
- return name.space.myMap[key]
424
- end function
425
- end class
426
- end namespace
427
- `, `
428
- sub __name_space_someClass_method_new()
429
- end sub
430
- function __name_space_someClass_method_someFunc(key as dynamic) as object
431
- return ({
432
- "key1": "val1"
433
- "key2": "val2"
434
- "key3": "val3"
435
- })[key]
436
- end function
437
- function __name_space_someClass_builder()
438
- instance = {}
439
- instance.new = __name_space_someClass_method_new
440
- instance.someFunc = __name_space_someClass_method_someFunc
441
- return instance
442
- end function
443
- function name_space_someClass()
444
- instance = __name_space_someClass_builder()
445
- instance.new()
446
- return instance
447
- end function
448
- `);
449
- });
450
- it('resolves enum refs in computed keys of an aa-literal const used cross-file', () => {
451
- program.setFile('source/map.bs', `
452
- namespace name.space
453
- enum someEnum
454
- one = "key1"
455
- two = "key2"
456
- end enum
457
-
458
- const myMap = {
459
- [someEnum.one]: "val1"
460
- [someEnum.two]: "val2"
461
- }
462
- end namespace
463
- `);
464
- testTranspile(`
465
- namespace name.space
466
- sub useMap(key as dynamic) as object
467
- return name.space.myMap[key]
468
- end sub
469
- end namespace
470
- `, `
471
- sub name_space_useMap(key as dynamic) as object
472
- return ({
473
- "key1": "val1"
474
- "key2": "val2"
475
- })[key]
476
- end sub
477
- `);
478
- });
479
- it('inlines a const aa-literal at multiple consumer call sites in the same file', () => {
480
- program.setFile('source/consts.bs', `
481
- namespace ns
482
- enum E
483
- X = "X"
484
- end enum
485
- const M = { "x": ns.E.X }
486
- end namespace
487
- `);
488
- testTranspile(`
489
- sub main()
490
- a = ns.M
491
- b = ns.M
492
- end sub
493
- `, `
494
- sub main()
495
- a = ({
496
- "x": "X"
497
- })
498
- b = ({
499
- "x": "X"
500
- })
501
- end sub
502
- `);
503
- });
504
- it('handles diamond const reference graph (one base const reached via two paths)', () => {
505
- program.setFile('source/consts.bs', `
506
- namespace ns
507
- enum E
508
- X = "X"
509
- end enum
510
- const C = { "c": ns.E.X }
511
- const A = { "a": ns.C }
512
- const B = { "b": ns.C }
513
- end namespace
514
- `);
515
- testTranspile(`
516
- sub main()
517
- print ns.A
518
- print ns.B
519
- end sub
520
- `, `
521
- sub main()
522
- print ({
523
- "a": ({
524
- "c": "X"
525
- })
526
- })
527
- print ({
528
- "b": ({
529
- "c": "X"
530
- })
531
- })
532
- end sub
533
- `);
534
- });
535
- it('does not infinite-loop on circular const-of-aa references', function () {
536
- this.timeout(2000);
537
- program.setFile('source/consts.bs', `
538
- namespace ns
539
- const A = { "x": ns.B }
540
- const B = { "y": ns.A }
541
- end namespace
542
- `);
543
- //the inner-most cyclic ref is left as the original namespace path so
544
- //transpile completes without recursing forever. The runtime semantics
545
- //of the cyclic ref are inherently broken, but the compile must not hang.
546
- //(A diagnostic is also emitted; see the dedicated cycle-diagnostic tests.)
547
- testTranspile(`
548
- sub main()
549
- print ns.A
550
- end sub
551
- `, `
552
- sub main()
553
- print ({
554
- "x": ({
555
- "y": ns_A
556
- })
557
- })
558
- end sub
559
- `, 'trim', 'source/main.bs', false);
560
- });
561
- it('flags scalar circular const reference', () => {
562
- program.setFile('source/main.bs', `
563
- const A = B
564
- const B = A
565
- `);
566
- program.validate();
567
- //matches the class-hierarchy convention: one diagnostic per const in the cycle,
568
- //each rotated so the diagnostic's const is at the head of the chain
569
- (0, testHelpers_spec_1.expectDiagnostics)(program, [
570
- DiagnosticMessages_1.DiagnosticMessages.circularReferenceDetected(['A', 'B', 'A'], 'source').message,
571
- DiagnosticMessages_1.DiagnosticMessages.circularReferenceDetected(['B', 'A', 'B'], 'source').message
572
- ]);
573
- });
574
- it('flags aggregate circular const reference', () => {
575
- program.setFile('source/main.bs', `
576
- namespace ns
577
- const A = { "x": ns.B }
578
- const B = { "y": ns.A }
579
- end namespace
580
- `);
581
- program.validate();
582
- (0, testHelpers_spec_1.expectDiagnostics)(program, [
583
- DiagnosticMessages_1.DiagnosticMessages.circularReferenceDetected(['ns.A', 'ns.B', 'ns.A'], 'source').message,
584
- DiagnosticMessages_1.DiagnosticMessages.circularReferenceDetected(['ns.B', 'ns.A', 'ns.B'], 'source').message
585
- ]);
586
- });
587
- it('flags three-cycle const reference once per node', () => {
588
- program.setFile('source/main.bs', `
589
- namespace ns
590
- const A = { "x": ns.B }
591
- const B = { "y": ns.C }
592
- const C = { "z": ns.A }
593
- end namespace
594
- `);
595
- program.validate();
596
- (0, testHelpers_spec_1.expectDiagnostics)(program, [
597
- DiagnosticMessages_1.DiagnosticMessages.circularReferenceDetected(['ns.A', 'ns.B', 'ns.C', 'ns.A'], 'source').message,
598
- DiagnosticMessages_1.DiagnosticMessages.circularReferenceDetected(['ns.B', 'ns.C', 'ns.A', 'ns.B'], 'source').message,
599
- DiagnosticMessages_1.DiagnosticMessages.circularReferenceDetected(['ns.C', 'ns.A', 'ns.B', 'ns.C'], 'source').message
600
- ]);
601
- });
602
- it('does not flag diamond const reference graph', () => {
603
- program.setFile('source/main.bs', `
604
- namespace ns
605
- enum E
606
- X = "X"
607
- end enum
608
- const Base = { "c": ns.E.X }
609
- const A = { "a": ns.Base }
610
- const B = { "b": ns.Base }
611
- const Root = { "left": ns.A, "right": ns.B }
612
- end namespace
613
- `);
614
- program.validate();
615
- (0, testHelpers_spec_1.expectZeroDiagnostics)(program);
616
- });
617
- it('resolves complex multi-file const-enum chain', () => {
618
- program.setFile('source/colors.bs', `
619
- namespace Theme
620
- enum Color
621
- PRIMARY = "#0000FF"
622
- SECONDARY = "#00FF00"
623
- end enum
624
- end namespace
625
- `);
626
- program.setFile('source/constants.bs', `
627
- namespace Theme
628
- const MAIN_COLOR = Theme.Color.PRIMARY
629
- const ALT_COLOR = Theme.MAIN_COLOR
630
- end namespace
631
- `);
632
- testTranspile(`
633
- sub main()
634
- colors = {
635
- main: Theme.ALT_COLOR
636
- secondary: Theme.Color.SECONDARY
637
- }
638
- end sub
639
- `, `
640
- sub main()
641
- colors = {
642
- main: "#0000FF"
643
- secondary: "#00FF00"
644
- }
645
- end sub
646
- `);
647
- });
648
- });
649
- describe('completions', () => {
650
- it('shows up in standard completions', () => {
651
- program.setFile('source/main.bs', `
652
- const API_KEY = "123"
653
- sub log(message)
654
- log()
655
- end sub
656
- `);
657
- (0, testHelpers_spec_1.expectCompletionsIncludes)(
658
- // log(|)
659
- program.getCompletions('source/main.bs', util_1.util.createPosition(3, 24)), [{
660
- label: 'API_KEY',
661
- kind: vscode_languageserver_protocol_1.CompletionItemKind.Constant
662
- }]);
663
- });
664
- it('transpiles simple const in a unary expression', () => {
665
- testTranspile(`
666
- const foo = 1
667
- sub main()
668
- bar = -foo
669
- end sub
670
- `, `
671
- sub main()
672
- bar = -1
673
- end sub
674
- `, undefined, 'source/main.bs');
675
- });
676
- it('transpiles complex const in a unary expression', () => {
677
- testTranspile(`
678
- namespace some.consts
679
- const foo = 1
680
- end namespace
681
- sub main()
682
- bar = -some.consts.foo
683
- end sub
684
- `, `
685
- sub main()
686
- bar = - 1
687
- end sub
688
- `, undefined, 'source/main.bs');
689
- });
690
- it('shows up in namespace completions', () => {
691
- program.setFile('source/main.bs', `
692
- namespace constants
693
- const API_KEY = "123"
694
- end namespace
695
- sub log(message)
696
- log(constants.)
697
- end sub
698
- `);
699
- (0, testHelpers_spec_1.expectCompletionsIncludes)(
700
- // log(|)
701
- program.getCompletions('source/main.bs', util_1.util.createPosition(5, 34)), [{
702
- label: 'API_KEY',
703
- kind: vscode_languageserver_protocol_1.CompletionItemKind.Constant
704
- }]);
705
- });
706
- });
707
- });
708
- //# sourceMappingURL=ConstStatement.spec.js.map