brighterscript 1.0.0-alpha.5 → 1.0.0-alpha.50

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 (715) hide show
  1. package/README.md +76 -138
  2. package/bsconfig.schema.json +121 -5
  3. package/dist/ActionPipeline.d.ts +10 -0
  4. package/dist/ActionPipeline.js +40 -0
  5. package/dist/ActionPipeline.js.map +1 -0
  6. package/dist/AstValidationSegmenter.d.ts +45 -0
  7. package/dist/AstValidationSegmenter.js +322 -0
  8. package/dist/AstValidationSegmenter.js.map +1 -0
  9. package/dist/BsConfig.d.ts +72 -39
  10. package/dist/BusyStatusTracker.d.ts +61 -0
  11. package/dist/BusyStatusTracker.js +148 -0
  12. package/dist/BusyStatusTracker.js.map +1 -0
  13. package/dist/Cache.d.ts +3 -8
  14. package/dist/Cache.js +9 -14
  15. package/dist/Cache.js.map +1 -1
  16. package/dist/CacheVerifier.d.ts +7 -0
  17. package/dist/CacheVerifier.js +20 -0
  18. package/dist/CacheVerifier.js.map +1 -0
  19. package/dist/CodeActionUtil.d.ts +12 -4
  20. package/dist/CodeActionUtil.js +22 -5
  21. package/dist/CodeActionUtil.js.map +1 -1
  22. package/dist/CommentFlagProcessor.d.ts +7 -6
  23. package/dist/CommentFlagProcessor.js +11 -8
  24. package/dist/CommentFlagProcessor.js.map +1 -1
  25. package/dist/CrossScopeValidator.d.ts +68 -0
  26. package/dist/CrossScopeValidator.js +642 -0
  27. package/dist/CrossScopeValidator.js.map +1 -0
  28. package/dist/DependencyGraph.d.ts +8 -3
  29. package/dist/DependencyGraph.js +49 -16
  30. package/dist/DependencyGraph.js.map +1 -1
  31. package/dist/DiagnosticCollection.d.ts +21 -5
  32. package/dist/DiagnosticCollection.js +77 -24
  33. package/dist/DiagnosticCollection.js.map +1 -1
  34. package/dist/DiagnosticFilterer.d.ts +27 -6
  35. package/dist/DiagnosticFilterer.js +273 -60
  36. package/dist/DiagnosticFilterer.js.map +1 -1
  37. package/dist/DiagnosticManager.d.ts +82 -0
  38. package/dist/DiagnosticManager.js +406 -0
  39. package/dist/DiagnosticManager.js.map +1 -0
  40. package/dist/DiagnosticMessages.d.ts +558 -196
  41. package/dist/DiagnosticMessages.js +870 -340
  42. package/dist/DiagnosticMessages.js.map +1 -1
  43. package/dist/DiagnosticSeverityAdjuster.d.ts +7 -0
  44. package/dist/DiagnosticSeverityAdjuster.js +45 -0
  45. package/dist/DiagnosticSeverityAdjuster.js.map +1 -0
  46. package/dist/FunctionScope.d.ts +28 -0
  47. package/dist/FunctionScope.js +52 -0
  48. package/dist/FunctionScope.js.map +1 -0
  49. package/dist/KeyedThrottler.d.ts +3 -3
  50. package/dist/KeyedThrottler.js +3 -3
  51. package/dist/KeyedThrottler.js.map +1 -1
  52. package/dist/LanguageServer.d.ts +100 -105
  53. package/dist/LanguageServer.js +444 -745
  54. package/dist/LanguageServer.js.map +1 -1
  55. package/dist/Logger.d.ts +17 -13
  56. package/dist/Logger.js +64 -34
  57. package/dist/Logger.js.map +1 -1
  58. package/dist/PluginInterface.d.ts +32 -10
  59. package/dist/PluginInterface.js +117 -7
  60. package/dist/PluginInterface.js.map +1 -1
  61. package/dist/Program.d.ts +241 -98
  62. package/dist/Program.js +1432 -717
  63. package/dist/Program.js.map +1 -1
  64. package/dist/ProgramBuilder.d.ts +47 -23
  65. package/dist/ProgramBuilder.js +224 -178
  66. package/dist/ProgramBuilder.js.map +1 -1
  67. package/dist/Scope.d.ts +149 -109
  68. package/dist/Scope.js +557 -550
  69. package/dist/Scope.js.map +1 -1
  70. package/dist/SemanticTokenUtils.js +5 -1
  71. package/dist/SemanticTokenUtils.js.map +1 -1
  72. package/dist/Stopwatch.d.ts +4 -0
  73. package/dist/Stopwatch.js +8 -1
  74. package/dist/Stopwatch.js.map +1 -1
  75. package/dist/SymbolTable.d.ts +136 -24
  76. package/dist/SymbolTable.js +565 -64
  77. package/dist/SymbolTable.js.map +1 -1
  78. package/dist/SymbolTypeFlag.d.ts +9 -0
  79. package/dist/SymbolTypeFlag.js +14 -0
  80. package/dist/SymbolTypeFlag.js.map +1 -0
  81. package/dist/Throttler.d.ts +12 -0
  82. package/dist/Throttler.js +39 -0
  83. package/dist/Throttler.js.map +1 -1
  84. package/dist/Watcher.d.ts +0 -3
  85. package/dist/Watcher.js +0 -3
  86. package/dist/Watcher.js.map +1 -1
  87. package/dist/XmlScope.d.ts +5 -15
  88. package/dist/XmlScope.js +34 -90
  89. package/dist/XmlScope.js.map +1 -1
  90. package/dist/astUtils/CachedLookups.d.ts +50 -0
  91. package/dist/astUtils/CachedLookups.js +334 -0
  92. package/dist/astUtils/CachedLookups.js.map +1 -0
  93. package/dist/astUtils/CachedLookups.spec.js +39 -0
  94. package/dist/astUtils/CachedLookups.spec.js.map +1 -0
  95. package/dist/astUtils/Editor.d.ts +69 -0
  96. package/dist/astUtils/Editor.js +245 -0
  97. package/dist/astUtils/Editor.js.map +1 -0
  98. package/dist/astUtils/Editor.spec.js +258 -0
  99. package/dist/astUtils/Editor.spec.js.map +1 -0
  100. package/dist/astUtils/creators.d.ts +54 -19
  101. package/dist/astUtils/creators.js +242 -42
  102. package/dist/astUtils/creators.js.map +1 -1
  103. package/dist/astUtils/creators.spec.js +5 -5
  104. package/dist/astUtils/creators.spec.js.map +1 -1
  105. package/dist/astUtils/reflection.d.ts +196 -85
  106. package/dist/astUtils/reflection.js +497 -144
  107. package/dist/astUtils/reflection.js.map +1 -1
  108. package/dist/astUtils/reflection.spec.js +267 -167
  109. package/dist/astUtils/reflection.spec.js.map +1 -1
  110. package/dist/astUtils/stackedVisitor.js.map +1 -1
  111. package/dist/astUtils/stackedVisitor.spec.js +14 -14
  112. package/dist/astUtils/stackedVisitor.spec.js.map +1 -1
  113. package/dist/astUtils/visitors.d.ts +116 -53
  114. package/dist/astUtils/visitors.js +95 -15
  115. package/dist/astUtils/visitors.js.map +1 -1
  116. package/dist/astUtils/visitors.spec.js +629 -51
  117. package/dist/astUtils/visitors.spec.js.map +1 -1
  118. package/dist/astUtils/xml.d.ts +9 -8
  119. package/dist/astUtils/xml.js +12 -7
  120. package/dist/astUtils/xml.js.map +1 -1
  121. package/dist/bscPlugin/BscPlugin.d.ts +24 -4
  122. package/dist/bscPlugin/BscPlugin.js +88 -4
  123. package/dist/bscPlugin/BscPlugin.js.map +1 -1
  124. package/dist/bscPlugin/CallExpressionInfo.d.ts +36 -0
  125. package/dist/bscPlugin/CallExpressionInfo.js +143 -0
  126. package/dist/bscPlugin/CallExpressionInfo.js.map +1 -0
  127. package/dist/bscPlugin/FileWriter.d.ts +6 -0
  128. package/dist/bscPlugin/FileWriter.js +24 -0
  129. package/dist/bscPlugin/FileWriter.js.map +1 -0
  130. package/dist/bscPlugin/SignatureHelpUtil.d.ts +10 -0
  131. package/dist/bscPlugin/SignatureHelpUtil.js +137 -0
  132. package/dist/bscPlugin/SignatureHelpUtil.js.map +1 -0
  133. package/dist/bscPlugin/codeActions/CodeActionsProcessor.d.ts +6 -5
  134. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +173 -27
  135. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
  136. package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js +138 -21
  137. package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js.map +1 -1
  138. package/dist/bscPlugin/completions/CompletionsProcessor.d.ts +65 -0
  139. package/dist/bscPlugin/completions/CompletionsProcessor.js +633 -0
  140. package/dist/bscPlugin/completions/CompletionsProcessor.js.map +1 -0
  141. package/dist/bscPlugin/completions/CompletionsProcessor.spec.js +2512 -0
  142. package/dist/bscPlugin/completions/CompletionsProcessor.spec.js.map +1 -0
  143. package/dist/bscPlugin/definition/DefinitionProvider.d.ts +13 -0
  144. package/dist/bscPlugin/definition/DefinitionProvider.js +212 -0
  145. package/dist/bscPlugin/definition/DefinitionProvider.js.map +1 -0
  146. package/dist/bscPlugin/definition/DefinitionProvider.spec.js +87 -0
  147. package/dist/bscPlugin/definition/DefinitionProvider.spec.js.map +1 -0
  148. package/dist/bscPlugin/fileProviders/FileProvider.d.ts +9 -0
  149. package/dist/bscPlugin/fileProviders/FileProvider.js +51 -0
  150. package/dist/bscPlugin/fileProviders/FileProvider.js.map +1 -0
  151. package/dist/bscPlugin/hover/HoverProcessor.d.ts +18 -0
  152. package/dist/bscPlugin/hover/HoverProcessor.js +230 -0
  153. package/dist/bscPlugin/hover/HoverProcessor.js.map +1 -0
  154. package/dist/bscPlugin/hover/HoverProcessor.spec.js +991 -0
  155. package/dist/bscPlugin/hover/HoverProcessor.spec.js.map +1 -0
  156. package/dist/bscPlugin/references/ReferencesProvider.d.ts +12 -0
  157. package/dist/bscPlugin/references/ReferencesProvider.js +57 -0
  158. package/dist/bscPlugin/references/ReferencesProvider.js.map +1 -0
  159. package/dist/bscPlugin/references/ReferencesProvider.spec.d.ts +1 -0
  160. package/dist/bscPlugin/references/ReferencesProvider.spec.js +51 -0
  161. package/dist/bscPlugin/references/ReferencesProvider.spec.js.map +1 -0
  162. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.d.ts +14 -0
  163. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +164 -0
  164. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -0
  165. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.d.ts +1 -0
  166. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js +564 -0
  167. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js.map +1 -0
  168. package/dist/bscPlugin/serialize/BslibInjector.spec.d.ts +1 -0
  169. package/dist/bscPlugin/serialize/BslibInjector.spec.js +33 -0
  170. package/dist/bscPlugin/serialize/BslibInjector.spec.js.map +1 -0
  171. package/dist/bscPlugin/serialize/BslibManager.d.ts +12 -0
  172. package/dist/bscPlugin/serialize/BslibManager.js +46 -0
  173. package/dist/bscPlugin/serialize/BslibManager.js.map +1 -0
  174. package/dist/bscPlugin/serialize/FileSerializer.d.ts +9 -0
  175. package/dist/bscPlugin/serialize/FileSerializer.js +75 -0
  176. package/dist/bscPlugin/serialize/FileSerializer.js.map +1 -0
  177. package/dist/bscPlugin/symbols/DocumentSymbolProcessor.d.ts +7 -0
  178. package/dist/bscPlugin/symbols/DocumentSymbolProcessor.js +22 -0
  179. package/dist/bscPlugin/symbols/DocumentSymbolProcessor.js.map +1 -0
  180. package/dist/bscPlugin/symbols/DocumentSymbolProcessor.spec.d.ts +1 -0
  181. package/dist/bscPlugin/symbols/DocumentSymbolProcessor.spec.js +291 -0
  182. package/dist/bscPlugin/symbols/DocumentSymbolProcessor.spec.js.map +1 -0
  183. package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.d.ts +7 -0
  184. package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.js +26 -0
  185. package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.js.map +1 -0
  186. package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.spec.d.ts +1 -0
  187. package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.spec.js +245 -0
  188. package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.spec.js.map +1 -0
  189. package/dist/bscPlugin/symbols/symbolUtils.d.ts +5 -0
  190. package/dist/bscPlugin/symbols/symbolUtils.js +141 -0
  191. package/dist/bscPlugin/symbols/symbolUtils.js.map +1 -0
  192. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.d.ts +27 -0
  193. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js +418 -0
  194. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js.map +1 -0
  195. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.d.ts +1 -0
  196. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js +75 -0
  197. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js.map +1 -0
  198. package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.d.ts +12 -0
  199. package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.js +99 -0
  200. package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.js.map +1 -0
  201. package/dist/bscPlugin/validation/BrsFileAfterValidator.d.ts +7 -0
  202. package/dist/bscPlugin/validation/BrsFileAfterValidator.js +18 -0
  203. package/dist/bscPlugin/validation/BrsFileAfterValidator.js.map +1 -0
  204. package/dist/bscPlugin/validation/BrsFileValidator.d.ts +37 -0
  205. package/dist/bscPlugin/validation/BrsFileValidator.js +638 -0
  206. package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -0
  207. package/dist/bscPlugin/validation/BrsFileValidator.spec.d.ts +1 -0
  208. package/dist/bscPlugin/validation/BrsFileValidator.spec.js +1517 -0
  209. package/dist/bscPlugin/validation/BrsFileValidator.spec.js.map +1 -0
  210. package/dist/bscPlugin/validation/ProgramValidator.d.ts +11 -0
  211. package/dist/bscPlugin/validation/ProgramValidator.js +33 -0
  212. package/dist/bscPlugin/validation/ProgramValidator.js.map +1 -0
  213. package/dist/bscPlugin/validation/ScopeValidator.d.ts +141 -0
  214. package/dist/bscPlugin/validation/ScopeValidator.js +1323 -0
  215. package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -0
  216. package/dist/bscPlugin/validation/ScopeValidator.spec.d.ts +1 -0
  217. package/dist/bscPlugin/validation/ScopeValidator.spec.js +6135 -0
  218. package/dist/bscPlugin/validation/ScopeValidator.spec.js.map +1 -0
  219. package/dist/bscPlugin/validation/XmlFileValidator.d.ts +8 -0
  220. package/dist/bscPlugin/validation/XmlFileValidator.js +36 -0
  221. package/dist/bscPlugin/validation/XmlFileValidator.js.map +1 -0
  222. package/dist/cli.js +126 -27
  223. package/dist/cli.js.map +1 -1
  224. package/dist/common/Sequencer.d.ts +53 -0
  225. package/dist/common/Sequencer.js +233 -0
  226. package/dist/common/Sequencer.js.map +1 -0
  227. package/dist/common/Sequencer.spec.d.ts +1 -0
  228. package/dist/common/Sequencer.spec.js +75 -0
  229. package/dist/common/Sequencer.spec.js.map +1 -0
  230. package/dist/deferred.d.ts +5 -3
  231. package/dist/deferred.js +10 -0
  232. package/dist/deferred.js.map +1 -1
  233. package/dist/diagnosticUtils.d.ts +10 -3
  234. package/dist/diagnosticUtils.js +64 -25
  235. package/dist/diagnosticUtils.js.map +1 -1
  236. package/dist/examples/plugins/removePrint.d.ts +2 -2
  237. package/dist/examples/plugins/removePrint.js +8 -12
  238. package/dist/examples/plugins/removePrint.js.map +1 -1
  239. package/dist/files/AssetFile.d.ts +24 -0
  240. package/dist/files/AssetFile.js +25 -0
  241. package/dist/files/AssetFile.js.map +1 -0
  242. package/dist/files/BrsFile.Class.spec.js +1213 -259
  243. package/dist/files/BrsFile.Class.spec.js.map +1 -1
  244. package/dist/files/BrsFile.d.ts +145 -87
  245. package/dist/files/BrsFile.js +836 -934
  246. package/dist/files/BrsFile.js.map +1 -1
  247. package/dist/files/BrsFile.spec.js +4226 -902
  248. package/dist/files/BrsFile.spec.js.map +1 -1
  249. package/dist/files/BscFile.d.ts +102 -0
  250. package/dist/files/BscFile.js +15 -0
  251. package/dist/files/BscFile.js.map +1 -0
  252. package/dist/files/Factory.d.ts +25 -0
  253. package/dist/files/Factory.js +22 -0
  254. package/dist/files/Factory.js.map +1 -0
  255. package/dist/files/LazyFileData.d.ts +21 -0
  256. package/dist/files/LazyFileData.js +54 -0
  257. package/dist/files/LazyFileData.js.map +1 -0
  258. package/dist/files/LazyFileData.spec.d.ts +1 -0
  259. package/dist/files/LazyFileData.spec.js +27 -0
  260. package/dist/files/LazyFileData.spec.js.map +1 -0
  261. package/dist/files/XmlFile.d.ts +80 -41
  262. package/dist/files/XmlFile.js +161 -137
  263. package/dist/files/XmlFile.js.map +1 -1
  264. package/dist/files/XmlFile.spec.js +444 -336
  265. package/dist/files/XmlFile.spec.js.map +1 -1
  266. package/dist/files/tests/imports.spec.js +62 -52
  267. package/dist/files/tests/imports.spec.js.map +1 -1
  268. package/dist/files/tests/optionalChaning.spec.d.ts +1 -0
  269. package/dist/files/tests/optionalChaning.spec.js +152 -0
  270. package/dist/files/tests/optionalChaning.spec.js.map +1 -0
  271. package/dist/globalCallables.d.ts +3 -1
  272. package/dist/globalCallables.js +424 -184
  273. package/dist/globalCallables.js.map +1 -1
  274. package/dist/index.d.ts +32 -4
  275. package/dist/index.js +54 -7
  276. package/dist/index.js.map +1 -1
  277. package/dist/interfaces.d.ts +942 -125
  278. package/dist/interfaces.js +21 -0
  279. package/dist/interfaces.js.map +1 -1
  280. package/dist/lexer/Character.spec.js +5 -5
  281. package/dist/lexer/Character.spec.js.map +1 -1
  282. package/dist/lexer/Lexer.d.ts +51 -12
  283. package/dist/lexer/Lexer.js +215 -65
  284. package/dist/lexer/Lexer.js.map +1 -1
  285. package/dist/lexer/Lexer.spec.js +812 -568
  286. package/dist/lexer/Lexer.spec.js.map +1 -1
  287. package/dist/lexer/Token.d.ts +27 -11
  288. package/dist/lexer/Token.js +10 -2
  289. package/dist/lexer/Token.js.map +1 -1
  290. package/dist/lexer/TokenKind.d.ts +40 -2
  291. package/dist/lexer/TokenKind.js +147 -10
  292. package/dist/lexer/TokenKind.js.map +1 -1
  293. package/dist/logging.d.ts +14 -0
  294. package/dist/logging.js +29 -0
  295. package/dist/logging.js.map +1 -0
  296. package/dist/lsp/ActionQueue.d.ts +35 -0
  297. package/dist/lsp/ActionQueue.js +115 -0
  298. package/dist/lsp/ActionQueue.js.map +1 -0
  299. package/dist/lsp/ActionQueue.spec.d.ts +1 -0
  300. package/dist/lsp/ActionQueue.spec.js +80 -0
  301. package/dist/lsp/ActionQueue.spec.js.map +1 -0
  302. package/dist/lsp/DocumentManager.d.ts +63 -0
  303. package/dist/lsp/DocumentManager.js +122 -0
  304. package/dist/lsp/DocumentManager.js.map +1 -0
  305. package/dist/lsp/DocumentManager.spec.d.ts +1 -0
  306. package/dist/lsp/DocumentManager.spec.js +103 -0
  307. package/dist/lsp/DocumentManager.spec.js.map +1 -0
  308. package/dist/lsp/LspProject.d.ts +239 -0
  309. package/dist/lsp/LspProject.js +3 -0
  310. package/dist/lsp/LspProject.js.map +1 -0
  311. package/dist/lsp/PathFilterer.d.ts +75 -0
  312. package/dist/lsp/PathFilterer.js +196 -0
  313. package/dist/lsp/PathFilterer.js.map +1 -0
  314. package/dist/lsp/PathFilterer.spec.d.ts +1 -0
  315. package/dist/lsp/PathFilterer.spec.js +182 -0
  316. package/dist/lsp/PathFilterer.spec.js.map +1 -0
  317. package/dist/lsp/Project.d.ts +168 -0
  318. package/dist/lsp/Project.js +437 -0
  319. package/dist/lsp/Project.js.map +1 -0
  320. package/dist/lsp/Project.spec.d.ts +1 -0
  321. package/dist/lsp/Project.spec.js +267 -0
  322. package/dist/lsp/Project.spec.js.map +1 -0
  323. package/dist/lsp/ProjectManager.d.ts +242 -0
  324. package/dist/lsp/ProjectManager.js +824 -0
  325. package/dist/lsp/ProjectManager.js.map +1 -0
  326. package/dist/lsp/ProjectManager.spec.d.ts +1 -0
  327. package/dist/lsp/ProjectManager.spec.js +913 -0
  328. package/dist/lsp/ProjectManager.spec.js.map +1 -0
  329. package/dist/lsp/ReaderWriterManager.d.ts +21 -0
  330. package/dist/lsp/ReaderWriterManager.js +60 -0
  331. package/dist/lsp/ReaderWriterManager.js.map +1 -0
  332. package/dist/lsp/worker/MessageHandler.d.ts +99 -0
  333. package/dist/lsp/worker/MessageHandler.js +138 -0
  334. package/dist/lsp/worker/MessageHandler.js.map +1 -0
  335. package/dist/lsp/worker/MessageHandler.spec.d.ts +1 -0
  336. package/dist/lsp/worker/MessageHandler.spec.js +64 -0
  337. package/dist/lsp/worker/MessageHandler.spec.js.map +1 -0
  338. package/dist/lsp/worker/WorkerPool.d.ts +38 -0
  339. package/dist/lsp/worker/WorkerPool.js +78 -0
  340. package/dist/lsp/worker/WorkerPool.js.map +1 -0
  341. package/dist/lsp/worker/WorkerPool.spec.d.ts +1 -0
  342. package/dist/lsp/worker/WorkerPool.spec.js +59 -0
  343. package/dist/lsp/worker/WorkerPool.spec.js.map +1 -0
  344. package/dist/lsp/worker/WorkerThreadProject.d.ts +143 -0
  345. package/dist/lsp/worker/WorkerThreadProject.js +189 -0
  346. package/dist/lsp/worker/WorkerThreadProject.js.map +1 -0
  347. package/dist/lsp/worker/WorkerThreadProject.spec.d.ts +2 -0
  348. package/dist/lsp/worker/WorkerThreadProject.spec.js +71 -0
  349. package/dist/lsp/worker/WorkerThreadProject.spec.js.map +1 -0
  350. package/dist/lsp/worker/WorkerThreadProjectRunner.d.ts +15 -0
  351. package/dist/lsp/worker/WorkerThreadProjectRunner.js +58 -0
  352. package/dist/lsp/worker/WorkerThreadProjectRunner.js.map +1 -0
  353. package/dist/lsp/worker/run.d.ts +1 -0
  354. package/dist/lsp/worker/run.js +14 -0
  355. package/dist/lsp/worker/run.js.map +1 -0
  356. package/dist/parser/AstNode.d.ts +203 -0
  357. package/dist/parser/AstNode.js +303 -0
  358. package/dist/parser/AstNode.js.map +1 -0
  359. package/dist/parser/AstNode.spec.d.ts +1 -0
  360. package/dist/parser/AstNode.spec.js +1455 -0
  361. package/dist/parser/AstNode.spec.js.map +1 -0
  362. package/dist/parser/BrightScriptDocParser.d.ts +56 -0
  363. package/dist/parser/BrightScriptDocParser.js +294 -0
  364. package/dist/parser/BrightScriptDocParser.js.map +1 -0
  365. package/dist/parser/BrightScriptDocParser.spec.d.ts +1 -0
  366. package/dist/parser/BrightScriptDocParser.spec.js +310 -0
  367. package/dist/parser/BrightScriptDocParser.spec.js.map +1 -0
  368. package/dist/parser/BrsTranspileState.d.ts +22 -3
  369. package/dist/parser/BrsTranspileState.js +19 -0
  370. package/dist/parser/BrsTranspileState.js.map +1 -1
  371. package/dist/parser/Expression.d.ts +553 -221
  372. package/dist/parser/Expression.js +1414 -505
  373. package/dist/parser/Expression.js.map +1 -1
  374. package/dist/parser/Expression.spec.d.ts +1 -0
  375. package/dist/parser/Expression.spec.js +40 -0
  376. package/dist/parser/Expression.spec.js.map +1 -0
  377. package/dist/parser/Parser.Class.spec.js +255 -125
  378. package/dist/parser/Parser.Class.spec.js.map +1 -1
  379. package/dist/parser/Parser.d.ts +117 -124
  380. package/dist/parser/Parser.js +1669 -982
  381. package/dist/parser/Parser.js.map +1 -1
  382. package/dist/parser/Parser.spec.d.ts +3 -1
  383. package/dist/parser/Parser.spec.js +2111 -525
  384. package/dist/parser/Parser.spec.js.map +1 -1
  385. package/dist/parser/SGParser.d.ts +29 -13
  386. package/dist/parser/SGParser.js +85 -56
  387. package/dist/parser/SGParser.js.map +1 -1
  388. package/dist/parser/SGParser.spec.js +30 -45
  389. package/dist/parser/SGParser.spec.js.map +1 -1
  390. package/dist/parser/SGTypes.d.ts +134 -46
  391. package/dist/parser/SGTypes.js +206 -115
  392. package/dist/parser/SGTypes.js.map +1 -1
  393. package/dist/parser/Statement.d.ts +849 -267
  394. package/dist/parser/Statement.js +2412 -625
  395. package/dist/parser/Statement.js.map +1 -1
  396. package/dist/parser/Statement.spec.js +133 -36
  397. package/dist/parser/Statement.spec.js.map +1 -1
  398. package/dist/parser/TranspileState.d.ts +26 -12
  399. package/dist/parser/TranspileState.js +115 -24
  400. package/dist/parser/TranspileState.js.map +1 -1
  401. package/dist/parser/tests/Parser.spec.d.ts +3 -9
  402. package/dist/parser/tests/Parser.spec.js +7 -13
  403. package/dist/parser/tests/Parser.spec.js.map +1 -1
  404. package/dist/parser/tests/controlFlow/For.spec.js +83 -75
  405. package/dist/parser/tests/controlFlow/For.spec.js.map +1 -1
  406. package/dist/parser/tests/controlFlow/ForEach.spec.js +85 -51
  407. package/dist/parser/tests/controlFlow/ForEach.spec.js.map +1 -1
  408. package/dist/parser/tests/controlFlow/If.spec.js +382 -239
  409. package/dist/parser/tests/controlFlow/If.spec.js.map +1 -1
  410. package/dist/parser/tests/controlFlow/While.spec.js +52 -45
  411. package/dist/parser/tests/controlFlow/While.spec.js.map +1 -1
  412. package/dist/parser/tests/expression/Additive.spec.js +51 -43
  413. package/dist/parser/tests/expression/Additive.spec.js.map +1 -1
  414. package/dist/parser/tests/expression/ArrayLiterals.spec.js +192 -142
  415. package/dist/parser/tests/expression/ArrayLiterals.spec.js.map +1 -1
  416. package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js +236 -160
  417. package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js.map +1 -1
  418. package/dist/parser/tests/expression/Boolean.spec.js +41 -34
  419. package/dist/parser/tests/expression/Boolean.spec.js.map +1 -1
  420. package/dist/parser/tests/expression/Call.spec.js +173 -55
  421. package/dist/parser/tests/expression/Call.spec.js.map +1 -1
  422. package/dist/parser/tests/expression/Exponential.spec.js +20 -20
  423. package/dist/parser/tests/expression/Exponential.spec.js.map +1 -1
  424. package/dist/parser/tests/expression/Function.spec.js +291 -282
  425. package/dist/parser/tests/expression/Function.spec.js.map +1 -1
  426. package/dist/parser/tests/expression/Indexing.spec.js +193 -110
  427. package/dist/parser/tests/expression/Indexing.spec.js.map +1 -1
  428. package/dist/parser/tests/expression/Multiplicative.spec.js +42 -42
  429. package/dist/parser/tests/expression/Multiplicative.spec.js.map +1 -1
  430. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +260 -115
  431. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +1 -1
  432. package/dist/parser/tests/expression/PrefixUnary.spec.js +58 -52
  433. package/dist/parser/tests/expression/PrefixUnary.spec.js.map +1 -1
  434. package/dist/parser/tests/expression/Primary.spec.js +76 -60
  435. package/dist/parser/tests/expression/Primary.spec.js.map +1 -1
  436. package/dist/parser/tests/expression/RegexLiteralExpression.spec.d.ts +1 -0
  437. package/dist/parser/tests/expression/RegexLiteralExpression.spec.js +171 -0
  438. package/dist/parser/tests/expression/RegexLiteralExpression.spec.js.map +1 -0
  439. package/dist/parser/tests/expression/Relational.spec.js +50 -50
  440. package/dist/parser/tests/expression/Relational.spec.js.map +1 -1
  441. package/dist/parser/tests/expression/SourceLiteralExpression.spec.js +31 -31
  442. package/dist/parser/tests/expression/SourceLiteralExpression.spec.js.map +1 -1
  443. package/dist/parser/tests/expression/TemplateStringExpression.spec.js +281 -94
  444. package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +1 -1
  445. package/dist/parser/tests/expression/TernaryExpression.spec.js +747 -192
  446. package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
  447. package/dist/parser/tests/expression/TypeExpression.spec.d.ts +1 -0
  448. package/dist/parser/tests/expression/TypeExpression.spec.js +126 -0
  449. package/dist/parser/tests/expression/TypeExpression.spec.js.map +1 -0
  450. package/dist/parser/tests/expression/UnaryExpression.spec.d.ts +1 -0
  451. package/dist/parser/tests/expression/UnaryExpression.spec.js +52 -0
  452. package/dist/parser/tests/expression/UnaryExpression.spec.js.map +1 -0
  453. package/dist/parser/tests/statement/AssignmentOperators.spec.js +44 -44
  454. package/dist/parser/tests/statement/AssignmentOperators.spec.js.map +1 -1
  455. package/dist/parser/tests/statement/ConstStatement.spec.d.ts +1 -0
  456. package/dist/parser/tests/statement/ConstStatement.spec.js +500 -0
  457. package/dist/parser/tests/statement/ConstStatement.spec.js.map +1 -0
  458. package/dist/parser/tests/statement/Continue.spec.d.ts +1 -0
  459. package/dist/parser/tests/statement/Continue.spec.js +119 -0
  460. package/dist/parser/tests/statement/Continue.spec.js.map +1 -0
  461. package/dist/parser/tests/statement/Declaration.spec.js +61 -55
  462. package/dist/parser/tests/statement/Declaration.spec.js.map +1 -1
  463. package/dist/parser/tests/statement/Dim.spec.js +29 -22
  464. package/dist/parser/tests/statement/Dim.spec.js.map +1 -1
  465. package/dist/parser/tests/statement/Enum.spec.d.ts +1 -0
  466. package/dist/parser/tests/statement/Enum.spec.js +744 -0
  467. package/dist/parser/tests/statement/Enum.spec.js.map +1 -0
  468. package/dist/parser/tests/statement/For.spec.d.ts +1 -0
  469. package/dist/parser/tests/statement/For.spec.js +45 -0
  470. package/dist/parser/tests/statement/For.spec.js.map +1 -0
  471. package/dist/parser/tests/statement/ForEach.spec.d.ts +1 -0
  472. package/dist/parser/tests/statement/ForEach.spec.js +36 -0
  473. package/dist/parser/tests/statement/ForEach.spec.js.map +1 -0
  474. package/dist/parser/tests/statement/Function.spec.js +226 -215
  475. package/dist/parser/tests/statement/Function.spec.js.map +1 -1
  476. package/dist/parser/tests/statement/Goto.spec.js +16 -15
  477. package/dist/parser/tests/statement/Goto.spec.js.map +1 -1
  478. package/dist/parser/tests/statement/Increment.spec.js +64 -61
  479. package/dist/parser/tests/statement/Increment.spec.js.map +1 -1
  480. package/dist/parser/tests/statement/InterfaceStatement.spec.d.ts +1 -0
  481. package/dist/parser/tests/statement/InterfaceStatement.spec.js +110 -0
  482. package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +1 -0
  483. package/dist/parser/tests/statement/LibraryStatement.spec.js +22 -22
  484. package/dist/parser/tests/statement/LibraryStatement.spec.js.map +1 -1
  485. package/dist/parser/tests/statement/Misc.spec.js +127 -168
  486. package/dist/parser/tests/statement/Misc.spec.js.map +1 -1
  487. package/dist/parser/tests/statement/PrintStatement.spec.js +133 -114
  488. package/dist/parser/tests/statement/PrintStatement.spec.js.map +1 -1
  489. package/dist/parser/tests/statement/ReturnStatement.spec.js +57 -54
  490. package/dist/parser/tests/statement/ReturnStatement.spec.js.map +1 -1
  491. package/dist/parser/tests/statement/Set.spec.js +131 -117
  492. package/dist/parser/tests/statement/Set.spec.js.map +1 -1
  493. package/dist/parser/tests/statement/Stop.spec.js +14 -13
  494. package/dist/parser/tests/statement/Stop.spec.js.map +1 -1
  495. package/dist/parser/tests/statement/Throw.spec.js +11 -8
  496. package/dist/parser/tests/statement/Throw.spec.js.map +1 -1
  497. package/dist/parser/tests/statement/TryCatch.spec.js +26 -15
  498. package/dist/parser/tests/statement/TryCatch.spec.js.map +1 -1
  499. package/dist/preprocessor/Manifest.d.ts +6 -6
  500. package/dist/preprocessor/Manifest.js +17 -38
  501. package/dist/preprocessor/Manifest.js.map +1 -1
  502. package/dist/preprocessor/Manifest.spec.d.ts +1 -0
  503. package/dist/preprocessor/Manifest.spec.js +78 -103
  504. package/dist/preprocessor/Manifest.spec.js.map +1 -1
  505. package/dist/roku-types/data.json +20347 -0
  506. package/dist/roku-types/index.d.ts +5726 -0
  507. package/dist/roku-types/index.js +11 -0
  508. package/dist/roku-types/index.js.map +1 -0
  509. package/dist/types/ArrayType.d.ts +12 -5
  510. package/dist/types/ArrayType.js +89 -24
  511. package/dist/types/ArrayType.js.map +1 -1
  512. package/dist/types/ArrayType.spec.js +39 -11
  513. package/dist/types/ArrayType.spec.js.map +1 -1
  514. package/dist/types/AssociativeArrayType.d.ts +15 -0
  515. package/dist/types/AssociativeArrayType.js +64 -0
  516. package/dist/types/AssociativeArrayType.js.map +1 -0
  517. package/dist/types/BaseFunctionType.d.ts +10 -0
  518. package/dist/types/BaseFunctionType.js +26 -0
  519. package/dist/types/BaseFunctionType.js.map +1 -0
  520. package/dist/types/BooleanType.d.ts +9 -5
  521. package/dist/types/BooleanType.js +19 -8
  522. package/dist/types/BooleanType.js.map +1 -1
  523. package/dist/types/BooleanType.spec.js +10 -4
  524. package/dist/types/BooleanType.spec.js.map +1 -1
  525. package/dist/types/BscType.d.ts +41 -3
  526. package/dist/types/BscType.js +152 -0
  527. package/dist/types/BscType.js.map +1 -1
  528. package/dist/types/BscTypeKind.d.ts +28 -0
  529. package/dist/types/BscTypeKind.js +33 -0
  530. package/dist/types/BscTypeKind.js.map +1 -0
  531. package/dist/types/BuiltInInterfaceAdder.d.ts +28 -0
  532. package/dist/types/BuiltInInterfaceAdder.js +212 -0
  533. package/dist/types/BuiltInInterfaceAdder.js.map +1 -0
  534. package/dist/types/BuiltInInterfaceAdder.spec.d.ts +1 -0
  535. package/dist/types/BuiltInInterfaceAdder.spec.js +115 -0
  536. package/dist/types/BuiltInInterfaceAdder.spec.js.map +1 -0
  537. package/dist/types/CallFuncableType.d.ts +24 -0
  538. package/dist/types/CallFuncableType.js +91 -0
  539. package/dist/types/CallFuncableType.js.map +1 -0
  540. package/dist/types/ClassType.d.ts +17 -0
  541. package/dist/types/ClassType.js +60 -0
  542. package/dist/types/ClassType.js.map +1 -0
  543. package/dist/types/ClassType.spec.d.ts +1 -0
  544. package/dist/types/ClassType.spec.js +76 -0
  545. package/dist/types/ClassType.spec.js.map +1 -0
  546. package/dist/types/ComponentType.d.ts +22 -0
  547. package/dist/types/ComponentType.js +107 -0
  548. package/dist/types/ComponentType.js.map +1 -0
  549. package/dist/types/DoubleType.d.ts +10 -5
  550. package/dist/types/DoubleType.js +21 -17
  551. package/dist/types/DoubleType.js.map +1 -1
  552. package/dist/types/DoubleType.spec.js +12 -4
  553. package/dist/types/DoubleType.spec.js.map +1 -1
  554. package/dist/types/DynamicType.d.ts +13 -5
  555. package/dist/types/DynamicType.js +26 -5
  556. package/dist/types/DynamicType.js.map +1 -1
  557. package/dist/types/DynamicType.spec.js +16 -5
  558. package/dist/types/DynamicType.spec.js.map +1 -1
  559. package/dist/types/EnumType.d.ts +42 -0
  560. package/dist/types/EnumType.js +98 -0
  561. package/dist/types/EnumType.js.map +1 -0
  562. package/dist/types/EnumType.spec.d.ts +1 -0
  563. package/dist/types/EnumType.spec.js +33 -0
  564. package/dist/types/EnumType.spec.js.map +1 -0
  565. package/dist/types/FloatType.d.ts +10 -5
  566. package/dist/types/FloatType.js +21 -17
  567. package/dist/types/FloatType.js.map +1 -1
  568. package/dist/types/FloatType.spec.js +4 -4
  569. package/dist/types/FloatType.spec.js.map +1 -1
  570. package/dist/types/FunctionType.d.ts +8 -22
  571. package/dist/types/FunctionType.js +25 -63
  572. package/dist/types/FunctionType.js.map +1 -1
  573. package/dist/types/InheritableType.d.ts +29 -0
  574. package/dist/types/InheritableType.js +173 -0
  575. package/dist/types/InheritableType.js.map +1 -0
  576. package/dist/types/InlineInterfaceType.d.ts +5 -0
  577. package/dist/types/InlineInterfaceType.js +17 -0
  578. package/dist/types/InlineInterfaceType.js.map +1 -0
  579. package/dist/types/IntegerType.d.ts +10 -5
  580. package/dist/types/IntegerType.js +21 -17
  581. package/dist/types/IntegerType.js.map +1 -1
  582. package/dist/types/IntegerType.spec.js +8 -4
  583. package/dist/types/IntegerType.spec.js.map +1 -1
  584. package/dist/types/InterfaceType.d.ts +14 -6
  585. package/dist/types/InterfaceType.js +30 -15
  586. package/dist/types/InterfaceType.js.map +1 -1
  587. package/dist/types/InterfaceType.spec.d.ts +1 -0
  588. package/dist/types/InterfaceType.spec.js +227 -0
  589. package/dist/types/InterfaceType.spec.js.map +1 -0
  590. package/dist/types/IntersectionType.d.ts +29 -0
  591. package/dist/types/IntersectionType.js +253 -0
  592. package/dist/types/IntersectionType.js.map +1 -0
  593. package/dist/types/IntersectionType.spec.d.ts +1 -0
  594. package/dist/types/IntersectionType.spec.js +150 -0
  595. package/dist/types/IntersectionType.spec.js.map +1 -0
  596. package/dist/types/InvalidType.d.ts +10 -5
  597. package/dist/types/InvalidType.js +21 -9
  598. package/dist/types/InvalidType.js.map +1 -1
  599. package/dist/types/InvalidType.spec.js +8 -4
  600. package/dist/types/InvalidType.spec.js.map +1 -1
  601. package/dist/types/LongIntegerType.d.ts +10 -5
  602. package/dist/types/LongIntegerType.js +21 -17
  603. package/dist/types/LongIntegerType.js.map +1 -1
  604. package/dist/types/LongIntegerType.spec.js +10 -4
  605. package/dist/types/LongIntegerType.spec.js.map +1 -1
  606. package/dist/types/NamespaceType.d.ts +12 -0
  607. package/dist/types/NamespaceType.js +28 -0
  608. package/dist/types/NamespaceType.js.map +1 -0
  609. package/dist/types/ObjectType.d.ts +12 -5
  610. package/dist/types/ObjectType.js +25 -8
  611. package/dist/types/ObjectType.js.map +1 -1
  612. package/dist/types/ObjectType.spec.js +3 -3
  613. package/dist/types/ObjectType.spec.js.map +1 -1
  614. package/dist/types/ReferenceType.d.ts +123 -0
  615. package/dist/types/ReferenceType.js +720 -0
  616. package/dist/types/ReferenceType.js.map +1 -0
  617. package/dist/types/ReferenceType.spec.d.ts +1 -0
  618. package/dist/types/ReferenceType.spec.js +151 -0
  619. package/dist/types/ReferenceType.spec.js.map +1 -0
  620. package/dist/types/StringType.d.ts +12 -5
  621. package/dist/types/StringType.js +23 -8
  622. package/dist/types/StringType.js.map +1 -1
  623. package/dist/types/StringType.spec.js +3 -3
  624. package/dist/types/StringType.spec.js.map +1 -1
  625. package/dist/types/TypeStatementType.d.ts +18 -0
  626. package/dist/types/TypeStatementType.js +45 -0
  627. package/dist/types/TypeStatementType.js.map +1 -0
  628. package/dist/types/TypedFunctionType.d.ts +34 -0
  629. package/dist/types/TypedFunctionType.js +147 -0
  630. package/dist/types/TypedFunctionType.js.map +1 -0
  631. package/dist/types/TypedFunctionType.spec.d.ts +1 -0
  632. package/dist/types/TypedFunctionType.spec.js +122 -0
  633. package/dist/types/TypedFunctionType.spec.js.map +1 -0
  634. package/dist/types/UninitializedType.d.ts +11 -6
  635. package/dist/types/UninitializedType.js +20 -11
  636. package/dist/types/UninitializedType.js.map +1 -1
  637. package/dist/types/UnionType.d.ts +27 -0
  638. package/dist/types/UnionType.js +193 -0
  639. package/dist/types/UnionType.js.map +1 -0
  640. package/dist/types/UnionType.spec.d.ts +1 -0
  641. package/dist/types/UnionType.spec.js +205 -0
  642. package/dist/types/UnionType.spec.js.map +1 -0
  643. package/dist/types/VoidType.d.ts +11 -5
  644. package/dist/types/VoidType.js +22 -8
  645. package/dist/types/VoidType.js.map +1 -1
  646. package/dist/types/VoidType.spec.js +3 -3
  647. package/dist/types/VoidType.spec.js.map +1 -1
  648. package/dist/types/helper.spec.d.ts +1 -0
  649. package/dist/types/helper.spec.js +174 -0
  650. package/dist/types/helper.spec.js.map +1 -0
  651. package/dist/types/helpers.d.ts +51 -0
  652. package/dist/types/helpers.js +323 -0
  653. package/dist/types/helpers.js.map +1 -0
  654. package/dist/types/index.d.ts +22 -0
  655. package/dist/types/index.js +39 -0
  656. package/dist/types/index.js.map +1 -0
  657. package/dist/types/roFunctionType.d.ts +11 -0
  658. package/dist/types/roFunctionType.js +37 -0
  659. package/dist/types/roFunctionType.js.map +1 -0
  660. package/dist/types/roFunctionType.spec.d.ts +1 -0
  661. package/dist/types/roFunctionType.spec.js +20 -0
  662. package/dist/types/roFunctionType.spec.js.map +1 -0
  663. package/dist/util.d.ts +288 -187
  664. package/dist/util.js +2018 -575
  665. package/dist/util.js.map +1 -1
  666. package/dist/validators/ClassValidator.d.ts +9 -15
  667. package/dist/validators/ClassValidator.js +93 -138
  668. package/dist/validators/ClassValidator.js.map +1 -1
  669. package/package.json +185 -138
  670. package/CHANGELOG.md +0 -1188
  671. package/dist/astUtils/index.d.ts +0 -7
  672. package/dist/astUtils/index.js +0 -26
  673. package/dist/astUtils/index.js.map +0 -1
  674. package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.d.ts +0 -7
  675. package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.js +0 -63
  676. package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.js.map +0 -1
  677. package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.spec.js +0 -45
  678. package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.spec.js.map +0 -1
  679. package/dist/lexer/index.d.ts +0 -3
  680. package/dist/lexer/index.js +0 -17
  681. package/dist/lexer/index.js.map +0 -1
  682. package/dist/parser/SGTypes.spec.js +0 -351
  683. package/dist/parser/SGTypes.spec.js.map +0 -1
  684. package/dist/parser/index.d.ts +0 -3
  685. package/dist/parser/index.js +0 -16
  686. package/dist/parser/index.js.map +0 -1
  687. package/dist/preprocessor/Chunk.d.ts +0 -82
  688. package/dist/preprocessor/Chunk.js +0 -77
  689. package/dist/preprocessor/Chunk.js.map +0 -1
  690. package/dist/preprocessor/Preprocessor.d.ts +0 -60
  691. package/dist/preprocessor/Preprocessor.js +0 -156
  692. package/dist/preprocessor/Preprocessor.js.map +0 -1
  693. package/dist/preprocessor/Preprocessor.spec.js +0 -152
  694. package/dist/preprocessor/Preprocessor.spec.js.map +0 -1
  695. package/dist/preprocessor/PreprocessorParser.d.ts +0 -61
  696. package/dist/preprocessor/PreprocessorParser.js +0 -194
  697. package/dist/preprocessor/PreprocessorParser.js.map +0 -1
  698. package/dist/preprocessor/PreprocessorParser.spec.js +0 -116
  699. package/dist/preprocessor/PreprocessorParser.spec.js.map +0 -1
  700. package/dist/preprocessor/index.d.ts +0 -3
  701. package/dist/preprocessor/index.js +0 -16
  702. package/dist/preprocessor/index.js.map +0 -1
  703. package/dist/types/CustomType.d.ts +0 -10
  704. package/dist/types/CustomType.js +0 -35
  705. package/dist/types/CustomType.js.map +0 -1
  706. package/dist/types/FunctionType.spec.js +0 -29
  707. package/dist/types/FunctionType.spec.js.map +0 -1
  708. package/dist/types/LazyType.d.ts +0 -15
  709. package/dist/types/LazyType.js +0 -32
  710. package/dist/types/LazyType.js.map +0 -1
  711. /package/dist/{bscPlugin/semanticTokens/SemanticTokensProcessor.spec.d.ts → astUtils/CachedLookups.spec.d.ts} +0 -0
  712. /package/dist/{parser/SGTypes.spec.d.ts → astUtils/Editor.spec.d.ts} +0 -0
  713. /package/dist/{preprocessor/Preprocessor.spec.d.ts → bscPlugin/completions/CompletionsProcessor.spec.d.ts} +0 -0
  714. /package/dist/{preprocessor/PreprocessorParser.spec.d.ts → bscPlugin/definition/DefinitionProvider.spec.d.ts} +0 -0
  715. /package/dist/{types/FunctionType.spec.d.ts → bscPlugin/hover/HoverProcessor.spec.d.ts} +0 -0
@@ -1,86 +1,204 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KeywordCompletions = exports.BrsFile = void 0;
3
+ exports.BrsFile = void 0;
4
4
  const source_map_1 = require("source-map");
5
5
  const vscode_languageserver_1 = require("vscode-languageserver");
6
+ const vscode_languageserver_2 = require("vscode-languageserver");
6
7
  const chalk_1 = require("chalk");
7
8
  const path = require("path");
8
9
  const DiagnosticMessages_1 = require("../DiagnosticMessages");
9
- const lexer_1 = require("../lexer");
10
- const parser_1 = require("../parser");
10
+ const FunctionScope_1 = require("../FunctionScope");
11
+ const Lexer_1 = require("../lexer/Lexer");
12
+ const TokenKind_1 = require("../lexer/TokenKind");
13
+ const Parser_1 = require("../parser/Parser");
11
14
  const util_1 = require("../util");
12
15
  const BrsTranspileState_1 = require("../parser/BrsTranspileState");
13
- const Preprocessor_1 = require("../preprocessor/Preprocessor");
14
- const Logger_1 = require("../Logger");
15
16
  const serialize_error_1 = require("serialize-error");
16
17
  const reflection_1 = require("../astUtils/reflection");
17
18
  const visitors_1 = require("../astUtils/visitors");
18
19
  const CommentFlagProcessor_1 = require("../CommentFlagProcessor");
20
+ const ReferencesProvider_1 = require("../bscPlugin/references/ReferencesProvider");
21
+ const DocumentSymbolProcessor_1 = require("../bscPlugin/symbols/DocumentSymbolProcessor");
22
+ const WorkspaceSymbolProcessor_1 = require("../bscPlugin/symbols/WorkspaceSymbolProcessor");
23
+ const AstValidationSegmenter_1 = require("../AstValidationSegmenter");
24
+ const Logger_1 = require("../Logger");
25
+ const SymbolTable_1 = require("../SymbolTable");
26
+ const CachedLookups_1 = require("../astUtils/CachedLookups");
27
+ const Editor_1 = require("../astUtils/Editor");
28
+ const Manifest_1 = require("../preprocessor/Manifest");
29
+ const types_1 = require("../types");
30
+ const DefinitionProvider_1 = require("../bscPlugin/definition/DefinitionProvider");
19
31
  /**
20
32
  * Holds all details about this file within the scope of the whole program
21
33
  */
22
34
  class BrsFile {
23
- constructor(
24
- /**
25
- * The absolute path to the source file on disk (e.g. '/usr/you/projects/RokuApp/source/main.brs' or 'c:/projects/RokuApp/source/main.brs').
26
- */
27
- srcPath,
28
- /**
29
- * The full pkg path (i.e. `pkg:/path/to/file.brs`)
30
- */
31
- pkgPath, program) {
32
- var _a;
33
- this.srcPath = srcPath;
34
- this.pkgPath = pkgPath;
35
- this.program = program;
35
+ constructor(options) {
36
+ var _a, _b, _c;
37
+ this.type = 'BrsFile';
36
38
  /**
37
39
  * The parseMode used for the parser for this file
38
40
  */
39
- this.parseMode = parser_1.ParseMode.BrightScript;
41
+ this.parseMode = Parser_1.ParseMode.BrightScript;
40
42
  /**
41
43
  * Indicates whether this file needs to be validated.
44
+ * Files are only ever validated a single time
42
45
  */
43
46
  this.isValidated = false;
44
- this.diagnostics = [];
45
47
  this.commentFlags = [];
46
- this.callables = [];
47
- this.functionCalls = [];
48
- /**
49
- * files referenced by import statements
50
- */
51
- this.ownScriptImports = [];
52
- /**
53
- * Does this file need to be transpiled?
54
- */
55
- this.needsTranspiled = false;
56
- this.srcPath = util_1.standardizePath `${this.srcPath}`;
57
- this.dependencyGraphKey = this.pkgPath.toLowerCase();
58
- this.extension = util_1.util.getExtension(this.srcPath);
59
- //all BrighterScript files need to be transpiled
60
- if ((_a = this.extension) === null || _a === void 0 ? void 0 : _a.endsWith('.bs')) {
61
- this.needsTranspiled = true;
62
- this.parseMode = parser_1.ParseMode.BrighterScript;
63
- }
64
- this.isTypedef = this.extension === '.d.bs';
65
- if (!this.isTypedef) {
66
- this.typedefSrcPath = util_1.util.getTypedefPath(this.srcPath);
48
+ this.scopesByFunc = new Map();
49
+ this.validationSegmenter = new AstValidationSegmenter_1.AstValidationSegmenter(this);
50
+ this.linkSymbolTableDisposables = [];
51
+ if (options) {
52
+ this.srcPath = (0, util_1.standardizePath) `${options.srcPath}`;
53
+ this.destPath = (0, util_1.standardizePath) `${options.destPath}`;
54
+ this.program = options.program;
55
+ this._cachedLookups = new CachedLookups_1.CachedLookups(this);
56
+ this.extension = util_1.util.getExtension(this.srcPath);
57
+ if (options.pkgPath) {
58
+ this.pkgPath = options.pkgPath;
59
+ }
60
+ else {
61
+ //don't rename .d.bs files to .d.brs
62
+ if (this.extension === '.d.bs') {
63
+ this.pkgPath = this.destPath;
64
+ }
65
+ else {
66
+ this.pkgPath = this.destPath.replace(/\.bs$/i, '.brs');
67
+ }
68
+ }
69
+ //all BrighterScript files need to be transpiled
70
+ if (((_a = this.extension) === null || _a === void 0 ? void 0 : _a.endsWith('.bs')) || ((_c = (_b = this.program) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.allowBrighterScriptInBrightScript)) {
71
+ this.parseMode = Parser_1.ParseMode.BrighterScript;
72
+ }
73
+ this.isTypedef = this.extension === '.d.bs';
74
+ if (!this.isTypedef) {
75
+ this.typedefKey = util_1.util.getTypedefPath(this.srcPath);
76
+ }
77
+ //global file doesn't have a program, so only resolve typedef info if we have a program
78
+ if (this.program) {
79
+ this.resolveTypedef();
80
+ }
67
81
  }
68
- //global file doesn't have a program, so only resolve typedef info if we have a program
69
- if (this.program) {
70
- this.resolveTypedef();
82
+ }
83
+ /**
84
+ * Will this file result in only comment or whitespace output? If so, it can be excluded from the output if that bsconfig setting is enabled.
85
+ */
86
+ get canBePruned() {
87
+ let canPrune = true;
88
+ this.ast.walk((0, visitors_1.createVisitor)({
89
+ FunctionStatement: () => {
90
+ canPrune = false;
91
+ },
92
+ ClassStatement: () => {
93
+ canPrune = false;
94
+ }
95
+ }), {
96
+ walkMode: visitors_1.WalkMode.visitStatements
97
+ });
98
+ return canPrune;
99
+ }
100
+ get functionScopes() {
101
+ if (!this._functionScopes) {
102
+ this.createFunctionScopes();
71
103
  }
104
+ return this._functionScopes;
105
+ }
106
+ get cache() {
107
+ // eslint-disable-next-line @typescript-eslint/dot-notation
108
+ return this._cachedLookups['cache'];
109
+ }
110
+ /**
111
+ * files referenced by import statements
112
+ */
113
+ get ownScriptImports() {
114
+ var _a, _b;
115
+ const result = (_b = (_a = this.cache) === null || _a === void 0 ? void 0 : _a.getOrAdd('BrsFile_ownScriptImports', () => {
116
+ var _a, _b, _c;
117
+ const result = [];
118
+ for (const statement of (_b = (_a = this._cachedLookups) === null || _a === void 0 ? void 0 : _a.importStatements) !== null && _b !== void 0 ? _b : []) {
119
+ //register import statements
120
+ if ((0, reflection_1.isImportStatement)(statement) && statement.tokens.path) {
121
+ result.push({
122
+ filePathRange: (_c = statement.tokens.path.location) === null || _c === void 0 ? void 0 : _c.range,
123
+ destPath: util_1.util.getPkgPathFromTarget(this.destPath, statement.filePath),
124
+ sourceFile: this,
125
+ text: statement.tokens.path.text
126
+ });
127
+ }
128
+ }
129
+ return result;
130
+ })) !== null && _b !== void 0 ? _b : [];
131
+ return result;
72
132
  }
73
- getDiagnostics() {
74
- return [...this.diagnostics];
133
+ /**
134
+ * Does this file need to be transpiled?
135
+ * @deprecated use the `.editor` property to push changes to the file, which will force transpilation
136
+ */
137
+ get needsTranspiled() {
138
+ var _a, _b, _c, _d;
139
+ if (this._needsTranspiled !== undefined) {
140
+ return this._needsTranspiled;
141
+ }
142
+ return !!(((_a = this.extension) === null || _a === void 0 ? void 0 : _a.endsWith('.bs')) || ((_c = (_b = this.program) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.allowBrighterScriptInBrightScript) || ((_d = this.editor) === null || _d === void 0 ? void 0 : _d.hasChanges));
75
143
  }
76
- addDiagnostics(diagnostics) {
77
- this.diagnostics.push(...diagnostics);
144
+ set needsTranspiled(value) {
145
+ this._needsTranspiled = value;
78
146
  }
79
147
  /**
80
148
  * The AST for this file
81
149
  */
82
150
  get ast() {
83
- return this.parser.ast;
151
+ var _a;
152
+ return (_a = this.parser) === null || _a === void 0 ? void 0 : _a.ast;
153
+ }
154
+ /**
155
+ * Get the token at the specified position
156
+ */
157
+ getTokenAt(position) {
158
+ var _a;
159
+ for (let token of this.parser.tokens) {
160
+ if (util_1.util.rangeContains((_a = token.location) === null || _a === void 0 ? void 0 : _a.range, position)) {
161
+ return token;
162
+ }
163
+ }
164
+ }
165
+ /**
166
+ * Get the token at the specified position, or the next token
167
+ */
168
+ getCurrentOrNextTokenAt(position) {
169
+ var _a;
170
+ for (let token of this.parser.tokens) {
171
+ if (util_1.util.comparePositionToRange(position, (_a = token.location) === null || _a === void 0 ? void 0 : _a.range) < 0) {
172
+ return token;
173
+ }
174
+ }
175
+ }
176
+ /**
177
+ * Walk the AST and find the expression that this token is most specifically contained within
178
+ */
179
+ getClosestExpression(position) {
180
+ if (typeof (position === null || position === void 0 ? void 0 : position.line) !== 'number') {
181
+ return undefined;
182
+ }
183
+ const handle = new vscode_languageserver_1.CancellationTokenSource();
184
+ let containingNode;
185
+ this.ast.walk((node) => {
186
+ var _a, _b;
187
+ const latestContainer = containingNode;
188
+ //bsc walks depth-first
189
+ if (((_a = node.location) === null || _a === void 0 ? void 0 : _a.range) && util_1.util.rangeContains((_b = node.location) === null || _b === void 0 ? void 0 : _b.range, position)) {
190
+ containingNode = node;
191
+ }
192
+ //we had a match before, and don't now. this means we've finished walking down the whole way, and found our match
193
+ if (latestContainer && !containingNode) {
194
+ containingNode = latestContainer;
195
+ handle.cancel();
196
+ }
197
+ }, {
198
+ walkMode: visitors_1.WalkMode.visitAllRecursive,
199
+ cancel: handle.token
200
+ });
201
+ return containingNode;
84
202
  }
85
203
  get parser() {
86
204
  if (!this._parser) {
@@ -98,130 +216,68 @@ class BrsFile {
98
216
  * Find and set the typedef variables (if a matching typedef file exists)
99
217
  */
100
218
  resolveTypedef() {
101
- this.typedefFile = this.program.getFile(this.typedefSrcPath);
219
+ this.typedefFile = this.program.getFile(this.typedefKey);
102
220
  this.hasTypedef = !!this.typedefFile;
103
221
  }
222
+ onDependenciesChanged(event) {
223
+ this.resolveTypedef();
224
+ }
104
225
  /**
105
226
  * Attach the file to the dependency graph so it can monitor changes.
106
227
  * Also notify the dependency graph of our current dependencies so other dependents can be notified.
228
+ * @deprecated this does nothing. This functionality is now handled by the file api and will be deleted in v1
107
229
  */
108
- attachDependencyGraph(dependencyGraph) {
109
- if (this.unsubscribeFromDependencyGraph) {
110
- this.unsubscribeFromDependencyGraph();
111
- }
112
- //event that fires anytime a dependency changes
113
- this.unsubscribeFromDependencyGraph = dependencyGraph.onchange(this.dependencyGraphKey, () => {
114
- this.resolveTypedef();
115
- });
116
- const dependencies = this.ownScriptImports.filter(x => !!x.pkgPath).map(x => x.pkgPath.toLowerCase());
230
+ attachDependencyGraph(dependencyGraph) { }
231
+ /**
232
+ * The list of files that this file depends on
233
+ */
234
+ get dependencies() {
235
+ const result = this.ownScriptImports.filter(x => !!x.destPath).map(x => x.destPath.toLowerCase());
117
236
  //if this is a .brs file, watch for typedef changes
118
237
  if (this.extension === '.brs') {
119
- dependencies.push(util_1.util.getTypedefPath(this.pkgPath));
238
+ result.push(util_1.util.getTypedefPath(this.destPath));
120
239
  }
121
- dependencyGraph.addOrReplace(this.dependencyGraphKey, dependencies);
240
+ return result;
122
241
  }
123
242
  /**
124
243
  * Calculate the AST for this file
125
- * @param fileContents
244
+ * @param fileContents the raw source code to parse
126
245
  */
127
246
  parse(fileContents) {
247
+ var _a;
248
+ const diagnostics = [];
128
249
  try {
129
250
  this.fileContents = fileContents;
130
- this.diagnostics = [];
131
251
  //if we have a typedef file, skip parsing this file
132
252
  if (this.hasTypedef) {
253
+ //skip validation since the typedef is shadowing this file
254
+ this.isValidated = true;
133
255
  return;
134
256
  }
135
257
  //tokenize the input file
136
- let lexer = this.program.logger.time(Logger_1.LogLevel.debug, ['lexer.lex', chalk_1.default.green(this.srcPath)], () => {
137
- return lexer_1.Lexer.scan(fileContents, {
138
- includeWhitespace: false
258
+ let lexer = this.program.logger.time('debug', ['lexer.lex', chalk_1.default.green(this.srcPath)], () => {
259
+ return Lexer_1.Lexer.scan(fileContents, {
260
+ includeWhitespace: false,
261
+ srcPath: this.srcPath
139
262
  });
140
263
  });
141
264
  this.getCommentFlags(lexer.tokens);
142
- let preprocessor = new Preprocessor_1.Preprocessor();
143
- //remove all code inside false-resolved conditional compilation statements.
144
- //TODO preprocessor should go away in favor of the AST handling this internally (because it affects transpile)
145
- //currently the preprocessor throws exceptions on syntax errors...so we need to catch it
146
- try {
147
- this.program.logger.time(Logger_1.LogLevel.debug, ['preprocessor.process', chalk_1.default.green(this.srcPath)], () => {
148
- preprocessor.process(lexer.tokens, this.program.getManifest());
149
- });
150
- }
151
- catch (error) {
152
- //if the thrown error is DIFFERENT than any errors from the preprocessor, add that error to the list as well
153
- if (this.diagnostics.find((x) => x === error) === undefined) {
154
- this.diagnostics.push(error);
155
- }
156
- }
157
- //if the preprocessor generated tokens, use them.
158
- let tokens = preprocessor.processedTokens.length > 0 ? preprocessor.processedTokens : lexer.tokens;
159
265
  this.program.logger.time(Logger_1.LogLevel.debug, ['parser.parse', chalk_1.default.green(this.srcPath)], () => {
160
- this._parser = parser_1.Parser.parse(tokens, {
266
+ this._parser = Parser_1.Parser.parse(lexer.tokens, {
267
+ srcPath: this.srcPath,
161
268
  mode: this.parseMode,
162
- logger: this.program.logger
269
+ logger: this.program.logger,
270
+ bsConsts: (0, Manifest_1.getBsConst)(this.program.getManifest())
163
271
  });
164
272
  });
165
273
  //absorb all lexing/preprocessing/parsing diagnostics
166
- this.diagnostics.push(...lexer.diagnostics, ...preprocessor.diagnostics, ...this._parser.diagnostics);
167
- //extract all callables from this file
168
- this.findCallables();
169
- //find all places where a sub/function is being called
170
- this.findFunctionCalls();
171
- this.findAndValidateImportAndImportStatements();
172
- //attach this file to every diagnostic
173
- for (let diagnostic of this.diagnostics) {
174
- diagnostic.file = this;
175
- }
274
+ diagnostics.push(...lexer.diagnostics, ...this._parser.diagnostics);
176
275
  }
177
276
  catch (e) {
178
- this._parser = new parser_1.Parser();
179
- this.diagnostics.push(Object.assign({ file: this, range: util_1.util.createRange(0, 0, 0, Number.MAX_VALUE) }, DiagnosticMessages_1.DiagnosticMessages.genericParserMessage('Critical error parsing file: ' + JSON.stringify(serialize_error_1.serializeError(e)))));
180
- }
181
- }
182
- validate() { }
183
- findAndValidateImportAndImportStatements() {
184
- var _a;
185
- let topOfFileIncludeStatements = [];
186
- for (let stmt of this.ast.statements) {
187
- //skip comments
188
- if (reflection_1.isCommentStatement(stmt)) {
189
- continue;
190
- }
191
- //if we found a non-library statement, this statement is not at the top of the file
192
- if (reflection_1.isLibraryStatement(stmt) || reflection_1.isImportStatement(stmt)) {
193
- topOfFileIncludeStatements.push(stmt);
194
- }
195
- else {
196
- //break out of the loop, we found all of our library statements
197
- break;
198
- }
199
- }
200
- let statements = [
201
- ...this._parser.references.libraryStatements,
202
- ...this._parser.references.importStatements
203
- ];
204
- for (let result of statements) {
205
- //register import statements
206
- if (reflection_1.isImportStatement(result) && result.filePathToken) {
207
- this.ownScriptImports.push({
208
- filePathRange: result.filePathToken.range,
209
- pkgPath: util_1.util.getPkgPathFromTarget(this.pkgPath, result.filePath),
210
- sourceFile: this,
211
- text: (_a = result.filePathToken) === null || _a === void 0 ? void 0 : _a.text
212
- });
213
- }
214
- //if this statement is not one of the top-of-file statements,
215
- //then add a diagnostic explaining that it is invalid
216
- if (!topOfFileIncludeStatements.includes(result)) {
217
- if (reflection_1.isLibraryStatement(result)) {
218
- this.diagnostics.push(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.libraryStatementMustBeDeclaredAtTopOfFile()), { range: result.range, file: this }));
219
- }
220
- else if (reflection_1.isImportStatement(result)) {
221
- this.diagnostics.push(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.importStatementMustBeDeclaredAtTopOfFile()), { range: result.range, file: this }));
222
- }
223
- }
277
+ this._parser = new Parser_1.Parser();
278
+ diagnostics.push(Object.assign({ location: util_1.util.createLocationFromFileRange(this, util_1.util.createRange(0, 0, 0, Number.MAX_VALUE)) }, DiagnosticMessages_1.DiagnosticMessages.genericParserMessage('Critical error parsing file: ' + JSON.stringify((0, serialize_error_1.serializeError)(e)))));
224
279
  }
280
+ (_a = this.program) === null || _a === void 0 ? void 0 : _a.diagnostics.register(diagnostics);
225
281
  }
226
282
  /**
227
283
  * Find a class. This scans all scopes for this file, and returns the first matching class that is found.
@@ -244,12 +300,12 @@ class BrsFile {
244
300
  }
245
301
  findPropertyNameCompletions() {
246
302
  //Build completion items from all the "properties" found in the file
247
- const { propertyHints } = this.parser.references;
303
+ const { propertyHints } = this._cachedLookups;
248
304
  const results = [];
249
305
  for (const key of Object.keys(propertyHints)) {
250
306
  results.push({
251
307
  label: propertyHints[key],
252
- kind: vscode_languageserver_1.CompletionItemKind.Text
308
+ kind: vscode_languageserver_2.CompletionItemKind.Text
253
309
  });
254
310
  }
255
311
  return results;
@@ -262,415 +318,193 @@ class BrsFile {
262
318
  }
263
319
  /**
264
320
  * Find all comment flags in the source code. These enable or disable diagnostic messages.
265
- * @param lines - the lines of the program
321
+ * @param tokens - an array of tokens of which to find `TokenKind.Comment` from
266
322
  */
267
323
  getCommentFlags(tokens) {
268
- const processor = new CommentFlagProcessor_1.CommentFlagProcessor(this, ['rem', `'`], DiagnosticMessages_1.diagnosticCodes, [DiagnosticMessages_1.DiagnosticCodeMap.unknownDiagnosticCode]);
324
+ var _a, _b, _c;
325
+ const processor = new CommentFlagProcessor_1.CommentFlagProcessor(this, ['rem', `'`], DiagnosticMessages_1.diagnosticCodes, [DiagnosticMessages_1.DiagnosticCodeMap.unknownDiagnosticCode, DiagnosticMessages_1.DiagnosticLegacyCodeMap.unknownDiagnosticCode]);
269
326
  this.commentFlags = [];
270
- for (let token of tokens) {
271
- if (token.kind === lexer_1.TokenKind.Comment) {
272
- processor.tryAdd(token.text, token.range);
273
- }
274
- }
275
- this.commentFlags.push(...processor.commentFlags);
276
- this.diagnostics.push(...processor.diagnostics);
277
- }
278
- findCallables() {
279
- var _a;
280
- for (let statement of (_a = this.parser.references.functionStatements) !== null && _a !== void 0 ? _a : []) {
281
- let functionType = statement.func.getFunctionType();
282
- functionType.setName(statement.name.text);
283
- this.callables.push({
284
- isSub: statement.func.functionType.text.toLowerCase() === 'sub',
285
- name: statement.name.text,
286
- nameRange: statement.name.range,
287
- file: this,
288
- params: functionType.params,
289
- range: statement.func.range,
290
- type: functionType,
291
- getName: statement.getName.bind(statement),
292
- hasNamespace: !!statement.namespaceName,
293
- functionStatement: statement
294
- });
295
- }
296
- }
297
- findFunctionCalls() {
298
- this.functionCalls = [];
299
- //for every function in the file
300
- for (let func of this._parser.references.functionExpressions) {
301
- //for all function calls in this function
302
- for (let expression of func.callExpressions) {
303
- if (
304
- //filter out dotted function invocations (i.e. object.doSomething()) (not currently supported. TODO support it)
305
- expression.callee.obj ||
306
- //filter out method calls on method calls for now (i.e. getSomething().getSomethingElse())
307
- expression.callee.callee ||
308
- //filter out callees without a name (immediately-invoked function expressions)
309
- !expression.callee.name) {
310
- continue;
311
- }
312
- let functionName = expression.callee.name.text;
313
- //callee is the name of the function being called
314
- let callee = expression.callee;
315
- let columnIndexBegin = callee.range.start.character;
316
- let columnIndexEnd = callee.range.end.character;
317
- let args = [];
318
- //TODO convert if stmts to use instanceof instead
319
- for (let arg of expression.args) {
320
- let impliedType = parser_1.getBscTypeFromExpression(arg, func);
321
- let argText = '';
322
- // Get the text to display for the arg
323
- if (arg.token) {
324
- argText = arg.token.text;
325
- //is a function call being passed into argument
326
- }
327
- else if (arg.name) {
328
- if (lexer_1.isToken(arg.name)) {
329
- argText = arg.name.text;
330
- }
331
- }
332
- else if (arg.value) {
333
- /* istanbul ignore next: TODO figure out why value is undefined sometimes */
334
- if (arg.value.value) {
335
- argText = arg.value.value.toString();
336
- }
337
- //wrap the value in quotes because that's how it appears in the code
338
- if (reflection_1.isStringType(impliedType)) {
339
- argText = '"' + argText + '"';
340
- }
341
- }
342
- args.push({
343
- range: arg.range,
344
- type: impliedType,
345
- text: argText
346
- });
347
- }
348
- let functionCall = {
349
- range: util_1.util.createRangeFromPositions(expression.range.start, expression.closingParen.range.end),
350
- functionExpression: this.getFunctionExpressionAtPosition(callee.range.start),
351
- file: this,
352
- name: functionName,
353
- nameRange: util_1.util.createRange(callee.range.start.line, columnIndexBegin, callee.range.start.line, columnIndexEnd),
354
- //TODO keep track of parameters
355
- args: args
356
- };
357
- this.functionCalls.push(functionCall);
358
- }
359
- }
360
- }
361
- /**
362
- * Find the function expression at the given position.
363
- */
364
- getFunctionExpressionAtPosition(position, functionExpressions) {
365
- if (!functionExpressions) {
366
- functionExpressions = this.parser.references.functionExpressions;
367
- }
368
- for (let functionExpression of functionExpressions) {
369
- if (util_1.util.rangeContains(functionExpression.range, position)) {
370
- //see if any of that scope's children match the position also, and give them priority
371
- let childFunc = this.getFunctionExpressionAtPosition(position, functionExpression.childFunctionExpressions);
372
- if (childFunc) {
373
- return childFunc;
374
- }
375
- else {
376
- return functionExpression;
327
+ for (let lexerToken of tokens) {
328
+ for (let triviaToken of (_a = lexerToken.leadingTrivia) !== null && _a !== void 0 ? _a : []) {
329
+ if (triviaToken.kind === TokenKind_1.TokenKind.Comment) {
330
+ processor.tryAdd(triviaToken.text, (_b = triviaToken.location) === null || _b === void 0 ? void 0 : _b.range);
377
331
  }
378
332
  }
379
333
  }
334
+ this.commentFlags.push(...processor.commentFlags);
335
+ (_c = this.program) === null || _c === void 0 ? void 0 : _c.diagnostics.register(processor.diagnostics);
380
336
  }
381
337
  /**
382
- * Get completions available at the given cursor. This aggregates all values from this file and the current scope.
338
+ * Create a scope for every function in this file
383
339
  */
384
- getCompletions(position, scope) {
385
- let result = [];
386
- //a map of lower-case names of all added options
387
- let names = {};
388
- //handle script import completions
389
- let scriptImport = util_1.util.getScriptImportAtPosition(this.ownScriptImports, position);
390
- if (scriptImport) {
391
- return this.program.getScriptImportCompletions(this.pkgPath, scriptImport);
392
- }
393
- //if cursor is within a comment, disable completions
394
- let currentToken = this.parser.getTokenAt(position);
395
- const tokenKind = currentToken === null || currentToken === void 0 ? void 0 : currentToken.kind;
396
- if (tokenKind === lexer_1.TokenKind.Comment) {
397
- return [];
398
- }
399
- else if (tokenKind === lexer_1.TokenKind.StringLiteral || tokenKind === lexer_1.TokenKind.TemplateStringQuasi) {
400
- const match = /^("?)(pkg|libpkg):/.exec(currentToken.text);
401
- if (match) {
402
- const [, openingQuote, fileProtocol] = match;
403
- //include every pkgPath from this scope
404
- for (const file of scope.getAllFiles()) {
405
- const pkgPath = `${fileProtocol}:/${file.pkgPath.replace('pkg:/', '')}`;
406
- result.push({
407
- label: pkgPath,
408
- textEdit: vscode_languageserver_1.TextEdit.replace(util_1.util.createRange(currentToken.range.start.line,
409
- //+1 to step past the opening quote
410
- currentToken.range.start.character + (openingQuote ? 1 : 0), currentToken.range.end.line,
411
- //-1 to exclude the closing quotemark (or the end character if there is no closing quotemark)
412
- currentToken.range.end.character + (currentToken.text.endsWith('"') ? -1 : 0)), pkgPath),
413
- kind: vscode_languageserver_1.CompletionItemKind.File
414
- });
340
+ createFunctionScopes() {
341
+ var _a, _b, _c, _d, _e, _f, _g;
342
+ //find every function
343
+ let functions = this._cachedLookups.functionExpressions;
344
+ //create a functionScope for every function
345
+ this._functionScopes = [];
346
+ for (let func of functions) {
347
+ let scope = new FunctionScope_1.FunctionScope(func);
348
+ //find parent function, and add this scope to it if found
349
+ {
350
+ let parentScope = this.scopesByFunc.get(func.findAncestor(reflection_1.isFunctionExpression));
351
+ //add this child scope to its parent
352
+ if (parentScope) {
353
+ parentScope.childrenScopes.push(scope);
415
354
  }
416
- return result;
417
- }
418
- else {
419
- //do nothing. we don't want to show completions inside of strings...
420
- return [];
421
- }
422
- }
423
- let namespaceCompletions = this.getNamespaceCompletions(currentToken, this.parseMode, scope);
424
- if (namespaceCompletions.length > 0) {
425
- return namespaceCompletions;
426
- }
427
- //determine if cursor is inside a function
428
- let functionExpression = this.getFunctionExpressionAtPosition(position);
429
- if (!functionExpression) {
430
- //we aren't in any function scope, so return the keyword completions and namespaces
431
- if (this.parser.getTokenBefore(currentToken, lexer_1.TokenKind.New)) {
432
- // there's a new keyword, so only class types are viable here
433
- return [...this.getGlobalClassStatementCompletions(currentToken, this.parseMode)];
434
- }
435
- else {
436
- return [...exports.KeywordCompletions, ...this.getGlobalClassStatementCompletions(currentToken, this.parseMode), ...namespaceCompletions];
437
- }
438
- }
439
- const classNameCompletions = this.getGlobalClassStatementCompletions(currentToken, this.parseMode);
440
- const newToken = this.parser.getTokenBefore(currentToken, lexer_1.TokenKind.New);
441
- if (newToken) {
442
- //we are after a new keyword; so we can only be namespaces or classes at this point
443
- result.push(...classNameCompletions);
444
- result.push(...namespaceCompletions);
445
- return result;
446
- }
447
- if (this.parser.tokenFollows(currentToken, lexer_1.TokenKind.Goto)) {
448
- return this.getLabelCompletion(functionExpression);
449
- }
450
- if (this.parser.isPositionNextToTokenKind(position, lexer_1.TokenKind.Dot)) {
451
- if (namespaceCompletions.length > 0) {
452
- //if we matched a namespace, after a dot, it can't be anything else but something from our namespace completions
453
- return namespaceCompletions;
454
- }
455
- const selfClassMemberCompletions = this.getClassMemberCompletions(position, currentToken, functionExpression, scope);
456
- if (selfClassMemberCompletions.size > 0) {
457
- return [...selfClassMemberCompletions.values()].filter((i) => i.label !== 'new');
458
- }
459
- if (!this.getClassFromMReference(position, currentToken, functionExpression)) {
460
- //and anything from any class in scope to a non m class
461
- let classMemberCompletions = scope.getAllClassMemberCompletions();
462
- result.push(...classMemberCompletions.values());
463
- result.push(...scope.getPropertyNameCompletions().filter((i) => !classMemberCompletions.has(i.label)));
355
+ //store the parent scope for this scope
356
+ scope.parentScope = parentScope;
464
357
  }
465
- else {
466
- result.push(...scope.getPropertyNameCompletions());
467
- }
468
- }
469
- else {
470
- //include namespaces
471
- result.push(...namespaceCompletions);
472
- //include class names
473
- result.push(...classNameCompletions);
474
- //include the global callables
475
- result.push(...scope.getCallablesAsCompletions(this.parseMode));
476
- //add `m` because that's always valid within a function
477
- result.push({
478
- label: 'm',
479
- kind: vscode_languageserver_1.CompletionItemKind.Variable
480
- });
481
- names.m = true;
482
- result.push(...exports.KeywordCompletions);
483
- //include local variables
484
- for (let symbol of functionExpression.symbolTable.ownSymbols) {
485
- const symbolNameLower = symbol.name.toLowerCase();
486
- //skip duplicate variable names
487
- if (names[symbolNameLower]) {
488
- continue;
489
- }
490
- names[symbolNameLower] = true;
491
- result.push({
492
- //TODO does this work?
493
- label: symbol.name,
494
- //TODO find type for local vars
495
- kind: vscode_languageserver_1.CompletionItemKind.Variable
496
- // kind: isFunctionType(variable.type) ? CompletionItemKind.Function : CompletionItemKind.Variable
358
+ //add every parameter
359
+ for (let param of func.parameters) {
360
+ scope.variableDeclarations.push({
361
+ nameRange: (_a = param.tokens.name.location) === null || _a === void 0 ? void 0 : _a.range,
362
+ lineIndex: (_c = (_b = param.tokens.name.location) === null || _b === void 0 ? void 0 : _b.range) === null || _c === void 0 ? void 0 : _c.start.line,
363
+ name: param.tokens.name.text,
364
+ getType: () => {
365
+ return param.getType({ flags: 2 /* SymbolTypeFlag.typetime */ });
366
+ }
497
367
  });
498
368
  }
499
- if (this.parseMode === parser_1.ParseMode.BrighterScript) {
500
- //include the first part of namespaces
501
- let namespaces = scope.getAllNamespaceStatements();
502
- for (let stmt of namespaces) {
503
- let firstPart = stmt.nameExpression.getNameParts().shift();
504
- //skip duplicate namespace names
505
- if (names[firstPart.toLowerCase()]) {
506
- continue;
507
- }
508
- names[firstPart.toLowerCase()] = true;
509
- result.push({
510
- label: firstPart,
511
- kind: vscode_languageserver_1.CompletionItemKind.Module
369
+ //add all of ForEachStatement loop varibales
370
+ (_d = func.body) === null || _d === void 0 ? void 0 : _d.walk((0, visitors_1.createVisitor)({
371
+ ForEachStatement: (stmt) => {
372
+ var _a, _b, _c;
373
+ scope.variableDeclarations.push({
374
+ nameRange: (_a = stmt.tokens.item.location) === null || _a === void 0 ? void 0 : _a.range,
375
+ lineIndex: (_c = (_b = stmt.tokens.item.location) === null || _b === void 0 ? void 0 : _b.range) === null || _c === void 0 ? void 0 : _c.start.line,
376
+ name: stmt.tokens.item.text,
377
+ getType: () => stmt.getType({ flags: 1 /* SymbolTypeFlag.runtime */ })
378
+ });
379
+ },
380
+ LabelStatement: (stmt) => {
381
+ var _a, _b, _c;
382
+ const { name: identifier } = stmt.tokens;
383
+ scope.labelStatements.push({
384
+ nameRange: (_a = identifier.location) === null || _a === void 0 ? void 0 : _a.range,
385
+ lineIndex: (_c = (_b = identifier.location) === null || _b === void 0 ? void 0 : _b.range) === null || _c === void 0 ? void 0 : _c.start.line,
386
+ name: identifier.text
512
387
  });
513
388
  }
389
+ }), {
390
+ walkMode: visitors_1.WalkMode.visitStatements
391
+ });
392
+ this.scopesByFunc.set(func, scope);
393
+ //find every statement in the scope
394
+ this._functionScopes.push(scope);
395
+ }
396
+ //find every variable assignment in the whole file
397
+ let assignmentStatements = this._cachedLookups.assignmentStatements;
398
+ for (let statement of assignmentStatements) {
399
+ //find this statement's function scope
400
+ let scope = this.scopesByFunc.get(statement.findAncestor(reflection_1.isFunctionExpression));
401
+ //skip variable declarations that are outside of any scope
402
+ if (scope) {
403
+ const variableName = statement.tokens.name;
404
+ scope.variableDeclarations.push({
405
+ nameRange: (_e = variableName.location) === null || _e === void 0 ? void 0 : _e.range,
406
+ lineIndex: (_g = (_f = variableName.location) === null || _f === void 0 ? void 0 : _f.range) === null || _g === void 0 ? void 0 : _g.start.line,
407
+ name: variableName.text,
408
+ getType: () => {
409
+ return statement.getType({ flags: 1 /* SymbolTypeFlag.runtime */ });
410
+ }
411
+ });
514
412
  }
515
413
  }
516
- return result;
517
414
  }
518
- getLabelCompletion(func) {
519
- return func.labelStatements.map(label => ({
520
- label: label.tokens.identifier.text,
521
- kind: vscode_languageserver_1.CompletionItemKind.Reference
522
- }));
523
- }
524
- getClassMemberCompletions(position, currentToken, functionExpression, scope) {
525
- var _a, _b;
526
- let classStatement = this.getClassFromMReference(position, currentToken, functionExpression);
527
- let results = new Map();
528
- if (classStatement) {
529
- let classes = scope.getClassHierarchy(classStatement.item.getName(parser_1.ParseMode.BrighterScript).toLowerCase());
530
- for (let cs of classes) {
531
- for (let member of [...(_a = cs === null || cs === void 0 ? void 0 : cs.item) === null || _a === void 0 ? void 0 : _a.fields, ...(_b = cs === null || cs === void 0 ? void 0 : cs.item) === null || _b === void 0 ? void 0 : _b.methods]) {
532
- if (!results.has(member.name.text.toLowerCase())) {
533
- results.set(member.name.text.toLowerCase(), {
534
- label: member.name.text,
535
- kind: reflection_1.isClassFieldStatement(member) ? vscode_languageserver_1.CompletionItemKind.Field : vscode_languageserver_1.CompletionItemKind.Function
536
- });
537
- }
415
+ get callables() {
416
+ if (this.staticCallables) {
417
+ // globalFile can statically set the callables
418
+ return this.staticCallables;
419
+ }
420
+ return this.cache.getOrAdd(`BrsFile_callables`, () => {
421
+ var _a, _b, _c, _d, _e, _f, _g;
422
+ const callables = [];
423
+ for (let statement of (_a = this._cachedLookups.functionStatements) !== null && _a !== void 0 ? _a : []) {
424
+ //extract the parameters
425
+ let params = [];
426
+ for (let param of statement.func.parameters) {
427
+ const paramType = param.getType({ flags: 2 /* SymbolTypeFlag.typetime */ });
428
+ let callableParam = {
429
+ name: (_b = param.tokens.name) === null || _b === void 0 ? void 0 : _b.text,
430
+ type: paramType,
431
+ isOptional: !!param.defaultValue,
432
+ isRestArgument: false
433
+ };
434
+ params.push(callableParam);
538
435
  }
436
+ const funcType = statement.getType({ flags: 2 /* SymbolTypeFlag.typetime */ });
437
+ callables.push({
438
+ isSub: ((_c = statement.func.tokens.functionType) === null || _c === void 0 ? void 0 : _c.text.toLowerCase()) === 'sub',
439
+ name: (_d = statement.tokens.name) === null || _d === void 0 ? void 0 : _d.text,
440
+ nameRange: (_f = (_e = statement.tokens.name) === null || _e === void 0 ? void 0 : _e.location) === null || _f === void 0 ? void 0 : _f.range,
441
+ file: this,
442
+ params: params,
443
+ range: (_g = statement.func.location) === null || _g === void 0 ? void 0 : _g.range,
444
+ type: funcType,
445
+ getName: statement.getName.bind(statement),
446
+ hasNamespace: !!statement.findAncestor(reflection_1.isNamespaceStatement),
447
+ functionStatement: statement
448
+ });
539
449
  }
540
- }
541
- return results;
450
+ return callables;
451
+ });
542
452
  }
543
- getClassFromMReference(position, currentToken, functionExpression) {
544
- let previousToken = this.parser.getPreviousToken(currentToken);
545
- if ((previousToken === null || previousToken === void 0 ? void 0 : previousToken.kind) === lexer_1.TokenKind.Dot) {
546
- previousToken = this.parser.getPreviousToken(previousToken);
547
- }
548
- if ((previousToken === null || previousToken === void 0 ? void 0 : previousToken.kind) === lexer_1.TokenKind.Identifier && (previousToken === null || previousToken === void 0 ? void 0 : previousToken.text.toLowerCase()) === 'm' && reflection_1.isClassMethodStatement(functionExpression.functionStatement)) {
549
- return { item: this.parser.references.classStatements.find((cs) => util_1.util.rangeContains(cs.range, position)), file: this };
550
- }
551
- return undefined;
453
+ /**
454
+ * Find the function scope at the given position.
455
+ * @param position the position used to find the deepest scope that contains it
456
+ */
457
+ getFunctionScopeAtPosition(position) {
458
+ return this.cache.getOrAdd(`functionScope-${position.line}:${position.character}`, () => {
459
+ return this._getFunctionScopeAtPosition(position, this.functionScopes);
460
+ });
552
461
  }
553
- getGlobalClassStatementCompletions(currentToken, parseMode) {
554
- var _a;
555
- if (parseMode === parser_1.ParseMode.BrightScript) {
556
- return [];
557
- }
558
- let results = new Map();
559
- let completionName = (_a = this.getPartialVariableName(currentToken, [lexer_1.TokenKind.New])) === null || _a === void 0 ? void 0 : _a.toLowerCase();
560
- if (completionName === null || completionName === void 0 ? void 0 : completionName.includes('.')) {
561
- return [];
462
+ _getFunctionScopeAtPosition(position, functionScopes) {
463
+ if (!functionScopes) {
464
+ functionScopes = this.functionScopes;
562
465
  }
563
- let scopes = this.program.getScopesForFile(this);
564
- for (let scope of scopes) {
565
- let classMap = scope.getClassMap();
566
- // let viableKeys = [...classMap.keys()].filter((k) => k.startsWith(completionName));
567
- for (const key of [...classMap.keys()]) {
568
- let cs = classMap.get(key).item;
569
- if (!results.has(cs.name.text)) {
570
- results.set(cs.name.text, {
571
- label: cs.name.text,
572
- kind: vscode_languageserver_1.CompletionItemKind.Class
573
- });
466
+ for (let scope of functionScopes) {
467
+ if (util_1.util.rangeContains(scope.range, position)) {
468
+ //see if any of that scope's children match the position also, and give them priority
469
+ let childScope = this._getFunctionScopeAtPosition(position, scope.childrenScopes);
470
+ if (childScope) {
471
+ return childScope;
472
+ }
473
+ else {
474
+ return scope;
574
475
  }
575
476
  }
576
477
  }
577
- return [...results.values()];
578
478
  }
579
- getNamespaceCompletions(currentToken, parseMode, scope) {
580
- //BrightScript does not support namespaces, so return an empty list in that case
581
- if (parseMode === parser_1.ParseMode.BrightScript) {
582
- return [];
583
- }
584
- let completionName = this.getPartialVariableName(currentToken, [lexer_1.TokenKind.New]);
585
- if (!completionName) {
586
- return [];
587
- }
588
- //remove any trailing identifer and then any trailing dot, to give us the
589
- //name of its immediate parent namespace
590
- let closestParentNamespaceName = completionName.replace(/\.([a-z0-9_]*)?$/gi, '');
591
- let newToken = this.parser.getTokenBefore(currentToken, lexer_1.TokenKind.New);
592
- let namespaceLookup = scope.namespaceLookup;
593
- let result = new Map();
594
- for (let key in namespaceLookup) {
595
- let namespace = namespaceLookup[key.toLowerCase()];
596
- //completionName = "NameA."
597
- //completionName = "NameA.Na
598
- //NameA
599
- //NameA.NameB
600
- //NameA.NameB.NameC
601
- if (namespace.fullName.toLowerCase() === closestParentNamespaceName.toLowerCase()) {
602
- //add all of this namespace's immediate child namespaces, bearing in mind if we are after a new keyword
603
- for (let childKey in namespace.namespaces) {
604
- const ns = namespace.namespaces[childKey];
605
- if (!newToken || ns.statements.find((s) => reflection_1.isClassStatement(s))) {
606
- if (!result.has(ns.lastPartName)) {
607
- result.set(ns.lastPartName, {
608
- label: ns.lastPartName,
609
- kind: vscode_languageserver_1.CompletionItemKind.Module
610
- });
611
- }
612
- }
613
- }
614
- //add function and class statement completions
615
- for (let stmt of namespace.statements) {
616
- if (reflection_1.isClassStatement(stmt)) {
617
- if (!result.has(stmt.name.text)) {
618
- result.set(stmt.name.text, {
619
- label: stmt.name.text,
620
- kind: vscode_languageserver_1.CompletionItemKind.Class
621
- });
479
+ /**
480
+ * Find the NamespaceStatement enclosing the given position
481
+ */
482
+ getNamespaceStatementForPosition(position) {
483
+ if (position) {
484
+ return this.cache.getOrAdd(`namespaceStatementForPosition-${position.line}:${position.character}`, () => {
485
+ var _a, _b, _c;
486
+ let mostSpecificNamespace;
487
+ for (const statement of this._cachedLookups.namespaceStatements) {
488
+ if (util_1.util.rangeContains((_a = statement.location) === null || _a === void 0 ? void 0 : _a.range, position)) {
489
+ if (mostSpecificNamespace) {
490
+ if (util_1.util.isRangeInRange((_b = statement.location) === null || _b === void 0 ? void 0 : _b.range, (_c = mostSpecificNamespace.location) === null || _c === void 0 ? void 0 : _c.range)) {
491
+ mostSpecificNamespace = statement;
492
+ }
622
493
  }
623
- }
624
- else if (reflection_1.isFunctionStatement(stmt) && !newToken) {
625
- if (!result.has(stmt.name.text)) {
626
- result.set(stmt.name.text, {
627
- label: stmt.name.text,
628
- kind: vscode_languageserver_1.CompletionItemKind.Function
629
- });
494
+ else {
495
+ mostSpecificNamespace = statement;
630
496
  }
631
497
  }
632
498
  }
633
- }
634
- }
635
- return [...result.values()];
636
- }
637
- getNamespaceDefinitions(token, file) {
638
- //BrightScript does not support namespaces, so return an empty list in that case
639
- if (!token) {
640
- return undefined;
499
+ return mostSpecificNamespace;
500
+ });
641
501
  }
642
- let location;
643
- const nameParts = this.getPartialVariableName(token, [lexer_1.TokenKind.New]).split('.');
644
- const endName = nameParts[nameParts.length - 1].toLowerCase();
645
- const namespaceName = nameParts.slice(0, -1).join('.').toLowerCase();
646
- const statementHandler = (statement) => {
647
- if (!location && statement.getName(parser_1.ParseMode.BrighterScript).toLowerCase() === namespaceName) {
648
- const namespaceItemStatementHandler = (statement) => {
649
- if (!location && statement.name.text.toLowerCase() === endName) {
650
- const uri = util_1.util.pathToUri(file.srcPath);
651
- location = vscode_languageserver_1.Location.create(uri, statement.range);
652
- }
653
- };
654
- file.parser.ast.walk(visitors_1.createVisitor({
655
- ClassStatement: namespaceItemStatementHandler,
656
- FunctionStatement: namespaceItemStatementHandler
657
- }), {
658
- walkMode: visitors_1.WalkMode.visitStatements
659
- });
660
- }
661
- };
662
- file.parser.ast.walk(visitors_1.createVisitor({
663
- NamespaceStatement: statementHandler
664
- }), {
665
- walkMode: visitors_1.WalkMode.visitStatements
666
- });
667
- return location;
668
502
  }
669
503
  /**
670
504
  * Given a current token, walk
671
505
  */
672
506
  getPartialVariableName(currentToken, excludeTokens = null) {
673
- let identifierAndDotKinds = [lexer_1.TokenKind.Identifier, ...lexer_1.AllowedLocalIdentifiers, lexer_1.TokenKind.Dot];
507
+ let identifierAndDotKinds = [TokenKind_1.TokenKind.Identifier, ...TokenKind_1.AllowedLocalIdentifiers, TokenKind_1.TokenKind.Dot];
674
508
  //consume tokens backwards until we find something other than a dot or an identifier
675
509
  let tokens = [];
676
510
  const parser = this.parser;
@@ -691,21 +525,94 @@ class BrsFile {
691
525
  return undefined;
692
526
  }
693
527
  }
528
+ isPositionNextToTokenKind(position, tokenKind) {
529
+ const closestToken = this.getClosestToken(position);
530
+ return this.isTokenNextToTokenKind(closestToken, tokenKind);
531
+ }
532
+ isTokenNextToTokenKind(closestToken, tokenKind) {
533
+ const previousToken = this.getPreviousToken(closestToken);
534
+ const previousTokenKind = previousToken === null || previousToken === void 0 ? void 0 : previousToken.kind;
535
+ //next to matched token
536
+ if (!closestToken || closestToken.kind === TokenKind_1.TokenKind.Eof) {
537
+ return false;
538
+ }
539
+ else if (closestToken.kind === tokenKind) {
540
+ return true;
541
+ }
542
+ else if (closestToken.kind === TokenKind_1.TokenKind.Newline || previousTokenKind === TokenKind_1.TokenKind.Newline) {
543
+ return false;
544
+ //next to an identifier, which is next to token kind
545
+ }
546
+ else if (closestToken.kind === TokenKind_1.TokenKind.Identifier && previousTokenKind === tokenKind) {
547
+ return true;
548
+ }
549
+ else {
550
+ return false;
551
+ }
552
+ }
553
+ getTokenBefore(currentToken, tokenKind) {
554
+ const index = this.parser.tokens.indexOf(currentToken);
555
+ if (!tokenKind) {
556
+ return this.parser.tokens[index - 1];
557
+ }
558
+ for (let i = index - 1; i >= 0; i--) {
559
+ currentToken = this.parser.tokens[i];
560
+ if (currentToken.kind === TokenKind_1.TokenKind.Newline) {
561
+ break;
562
+ }
563
+ else if (currentToken.kind === tokenKind) {
564
+ return currentToken;
565
+ }
566
+ }
567
+ return undefined;
568
+ }
569
+ tokenFollows(currentToken, tokenKind) {
570
+ const index = this.parser.tokens.indexOf(currentToken);
571
+ if (index > 0) {
572
+ return this.parser.tokens[index - 1].kind === tokenKind;
573
+ }
574
+ return false;
575
+ }
576
+ getTokensUntil(currentToken, tokenKind, direction = 1) {
577
+ let tokens = [];
578
+ for (let i = this.parser.tokens.indexOf(currentToken); direction === -1 ? i >= 0 : i < this.parser.tokens.length; i += direction) {
579
+ currentToken = this.parser.tokens[i];
580
+ if (currentToken.kind === TokenKind_1.TokenKind.Newline || currentToken.kind === tokenKind) {
581
+ break;
582
+ }
583
+ tokens.push(currentToken);
584
+ }
585
+ return tokens;
586
+ }
587
+ getNextTokenByPredicate(currentToken, test, direction = 1) {
588
+ for (let i = this.parser.tokens.indexOf(currentToken); direction === -1 ? i >= 0 : i < this.parser.tokens.length; i += direction) {
589
+ currentToken = this.parser.tokens[i];
590
+ if (test(currentToken)) {
591
+ return currentToken;
592
+ }
593
+ }
594
+ return undefined;
595
+ }
596
+ getPreviousToken(token) {
597
+ const parser = this.parser;
598
+ let idx = parser.tokens.indexOf(token);
599
+ return parser.tokens[idx - 1];
600
+ }
694
601
  /**
695
- * Find the first scope that has a namespace with this name.
602
+ * Finds the first scope for this file, then returns true if there's a namespace with this name.
696
603
  * Returns false if no namespace was found with that name
697
604
  */
698
605
  calleeStartsWithNamespace(callee) {
606
+ var _a, _b, _c;
699
607
  let left = callee;
700
- while (reflection_1.isDottedGetExpression(left)) {
608
+ while ((0, reflection_1.isDottedGetExpression)(left)) {
701
609
  left = left.obj;
702
610
  }
703
- if (reflection_1.isVariableExpression(left)) {
704
- let lowerName = left.name.text.toLowerCase();
705
- //find the first scope that contains this namespace
706
- let scopes = this.program.getScopesForFile(this);
707
- for (let scope of scopes) {
708
- if (scope.namespaceLookup[lowerName]) {
611
+ if ((0, reflection_1.isVariableExpression)(left)) {
612
+ const leftType = left.getType({ flags: 1 /* SymbolTypeFlag.runtime */ });
613
+ if ((0, reflection_1.isNamespaceType)(leftType)) {
614
+ // this is a namespace, but it might be aliased. Look it up and see if it has the same name
615
+ if (leftType.name.toLowerCase() === ((_c = (_b = (_a = left.tokens) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.text) === null || _c === void 0 ? void 0 : _c.toLowerCase())) {
709
616
  return true;
710
617
  }
711
618
  }
@@ -713,412 +620,94 @@ class BrsFile {
713
620
  return false;
714
621
  }
715
622
  /**
716
- * Determine if the callee (i.e. function name) is a known function declared on the given namespace.
623
+ * Get the token closest to the position. if no token is found, the previous token is returned
717
624
  */
718
- calleeIsKnownNamespaceFunction(callee, namespaceName) {
625
+ getClosestToken(position) {
719
626
  var _a, _b;
720
- //if we have a variable and a namespace
721
- if (reflection_1.isVariableExpression(callee) && namespaceName) {
722
- let lowerCalleeName = (_b = (_a = callee === null || callee === void 0 ? void 0 : callee.name) === null || _a === void 0 ? void 0 : _a.text) === null || _b === void 0 ? void 0 : _b.toLowerCase();
723
- if (lowerCalleeName) {
724
- let scopes = this.program.getScopesForFile(this);
725
- for (let scope of scopes) {
726
- let namespace = scope.namespaceLookup[namespaceName.toLowerCase()];
727
- if (namespace.functionStatements[lowerCalleeName]) {
728
- return true;
729
- }
730
- }
627
+ let tokens = this.parser.tokens;
628
+ for (let i = 0; i < tokens.length; i++) {
629
+ let token = tokens[i];
630
+ if (util_1.util.rangeContains((_a = token.location) === null || _a === void 0 ? void 0 : _a.range, position)) {
631
+ return token;
632
+ }
633
+ //if the position less than this token range, then this position touches no token,
634
+ if (util_1.util.positionIsGreaterThanRange(position, (_b = token.location) === null || _b === void 0 ? void 0 : _b.range) === false) {
635
+ let t = tokens[i - 1];
636
+ //return the token or the first token
637
+ return t ? t : tokens[0];
731
638
  }
732
639
  }
733
- return false;
640
+ //return the last token
641
+ return tokens[tokens.length - 1];
734
642
  }
735
643
  /**
736
644
  * Builds a list of document symbols for this file. Used by LanguageServer's onDocumentSymbol functionality
645
+ * @deprecated use `DocumentSymbolProvider.process()` instead
737
646
  */
738
647
  getDocumentSymbols() {
739
- if (this.documentSymbols) {
740
- return this.documentSymbols;
741
- }
742
- let symbols = [];
743
- for (const statement of this.ast.statements) {
744
- const symbol = this.getDocumentSymbol(statement);
745
- if (symbol) {
746
- symbols.push(symbol);
747
- }
748
- }
749
- this.documentSymbols = symbols;
750
- return symbols;
648
+ return new DocumentSymbolProcessor_1.DocumentSymbolProcessor({
649
+ documentSymbols: [],
650
+ file: this,
651
+ program: this.program
652
+ }).process();
751
653
  }
752
654
  /**
753
655
  * Builds a list of workspace symbols for this file. Used by LanguageServer's onWorkspaceSymbol functionality
754
656
  */
755
657
  getWorkspaceSymbols() {
756
- if (this.workspaceSymbols) {
757
- return this.workspaceSymbols;
758
- }
759
- let symbols = [];
760
- for (const statement of this.ast.statements) {
761
- for (const symbol of this.generateWorkspaceSymbols(statement)) {
762
- symbols.push(symbol);
763
- }
764
- }
765
- this.workspaceSymbols = symbols;
766
- return symbols;
767
- }
768
- /**
769
- * Builds a single DocumentSymbol object for use by LanguageServer's onDocumentSymbol functionality
770
- */
771
- getDocumentSymbol(statement) {
772
- let symbolKind;
773
- const children = [];
774
- if (reflection_1.isFunctionStatement(statement)) {
775
- symbolKind = vscode_languageserver_1.SymbolKind.Function;
776
- }
777
- else if (reflection_1.isClassMethodStatement(statement)) {
778
- symbolKind = vscode_languageserver_1.SymbolKind.Method;
779
- }
780
- else if (reflection_1.isClassFieldStatement(statement)) {
781
- symbolKind = vscode_languageserver_1.SymbolKind.Field;
782
- }
783
- else if (reflection_1.isNamespaceStatement(statement)) {
784
- symbolKind = vscode_languageserver_1.SymbolKind.Namespace;
785
- for (const childStatement of statement.body.statements) {
786
- const symbol = this.getDocumentSymbol(childStatement);
787
- if (symbol) {
788
- children.push(symbol);
789
- }
790
- }
791
- }
792
- else if (reflection_1.isClassStatement(statement)) {
793
- symbolKind = vscode_languageserver_1.SymbolKind.Class;
794
- for (const childStatement of statement.body) {
795
- const symbol = this.getDocumentSymbol(childStatement);
796
- if (symbol) {
797
- children.push(symbol);
798
- }
799
- }
800
- }
801
- else {
802
- return;
803
- }
804
- const name = reflection_1.isClassFieldStatement(statement) ? statement.name.text : statement.getName(parser_1.ParseMode.BrighterScript);
805
- return vscode_languageserver_1.DocumentSymbol.create(name, '', symbolKind, statement.range, statement.range, children);
806
- }
807
- /**
808
- * Builds a single SymbolInformation object for use by LanguageServer's onWorkspaceSymbol functionality
809
- */
810
- generateWorkspaceSymbols(statement, containerStatement) {
811
- let symbolKind;
812
- const symbols = [];
813
- if (reflection_1.isFunctionStatement(statement)) {
814
- symbolKind = vscode_languageserver_1.SymbolKind.Function;
815
- }
816
- else if (reflection_1.isClassMethodStatement(statement)) {
817
- symbolKind = vscode_languageserver_1.SymbolKind.Method;
818
- }
819
- else if (reflection_1.isNamespaceStatement(statement)) {
820
- symbolKind = vscode_languageserver_1.SymbolKind.Namespace;
821
- for (const childStatement of statement.body.statements) {
822
- for (const symbol of this.generateWorkspaceSymbols(childStatement, statement)) {
823
- symbols.push(symbol);
824
- }
825
- }
826
- }
827
- else if (reflection_1.isClassStatement(statement)) {
828
- symbolKind = vscode_languageserver_1.SymbolKind.Class;
829
- for (const childStatement of statement.body) {
830
- for (const symbol of this.generateWorkspaceSymbols(childStatement, statement)) {
831
- symbols.push(symbol);
832
- }
833
- }
834
- }
835
- else {
836
- return symbols;
837
- }
838
- const name = statement.getName(parser_1.ParseMode.BrighterScript);
839
- const uri = util_1.util.pathToUri(this.srcPath);
840
- const symbol = vscode_languageserver_1.SymbolInformation.create(name, symbolKind, statement.range, uri, containerStatement === null || containerStatement === void 0 ? void 0 : containerStatement.getName(parser_1.ParseMode.BrighterScript));
841
- symbols.push(symbol);
842
- return symbols;
658
+ return new WorkspaceSymbolProcessor_1.WorkspaceSymbolProcessor({
659
+ program: this.program,
660
+ workspaceSymbols: []
661
+ }).process();
843
662
  }
844
663
  /**
845
664
  * Given a position in a file, if the position is sitting on some type of identifier,
846
665
  * go to the definition of that identifier (where this thing was first defined)
666
+ * @deprecated use `DefinitionProvider.process()` instead
847
667
  */
848
668
  getDefinition(position) {
849
- let results = [];
850
- //get the token at the position
851
- const token = this.parser.getTokenAt(position);
852
- // While certain other tokens are allowed as local variables (AllowedLocalIdentifiers: https://github.com/rokucommunity/brighterscript/blob/master/src/lexer/TokenKind.ts#L418), these are converted by the parser to TokenKind.Identifier by the time we retrieve the token using getTokenAt
853
- let definitionTokenTypes = [
854
- lexer_1.TokenKind.Identifier,
855
- lexer_1.TokenKind.StringLiteral
856
- ];
857
- //throw out invalid tokens and the wrong kind of tokens
858
- if (!token || !definitionTokenTypes.includes(token.kind)) {
859
- return results;
860
- }
861
- let textToSearchFor = token.text.toLowerCase();
862
- const previousToken = this.parser.getTokenAt({ line: token.range.start.line, character: token.range.start.character });
863
- if ((previousToken === null || previousToken === void 0 ? void 0 : previousToken.kind) === lexer_1.TokenKind.Callfunc) {
864
- for (const scope of this.program.getScopes()) {
865
- //to only get functions defined in interface methods
866
- const callable = scope.getAllCallables().find((c) => c.callable.name.toLowerCase() === textToSearchFor); // eslint-disable-line @typescript-eslint/no-loop-func
867
- if (callable) {
868
- results.push(vscode_languageserver_1.Location.create(util_1.util.pathToUri(callable.callable.file.srcPath), callable.callable.functionStatement.range));
869
- }
870
- }
871
- return results;
872
- }
873
- let classToken = this.parser.getTokenBefore(token, lexer_1.TokenKind.Class);
874
- if (classToken) {
875
- let cs = this.parser.references.classStatements.find((cs) => cs.classKeyword.range === classToken.range);
876
- if (cs === null || cs === void 0 ? void 0 : cs.parentClassName) {
877
- const nameParts = cs.parentClassName.getNameParts();
878
- let extendedClass = this.getClassFileLink(nameParts[nameParts.length - 1], nameParts.slice(0, -1).join('.'));
879
- if (extendedClass) {
880
- results.push(vscode_languageserver_1.Location.create(util_1.util.pathToUri(extendedClass.file.srcPath), extendedClass.item.range));
881
- }
882
- }
883
- return results;
884
- }
885
- if (token.kind === lexer_1.TokenKind.StringLiteral) {
886
- // We need to strip off the quotes but only if present
887
- const startIndex = textToSearchFor.startsWith('"') ? 1 : 0;
888
- let endIndex = textToSearchFor.length;
889
- if (textToSearchFor.endsWith('"')) {
890
- endIndex--;
891
- }
892
- textToSearchFor = textToSearchFor.substring(startIndex, endIndex);
893
- }
894
- const func = this.getFunctionExpressionAtPosition(position);
895
- //look through local variables first
896
- //find any variable with this name
897
- for (const symbol of func.symbolTable.ownSymbols) {
898
- //we found a variable declaration with this token text
899
- if (symbol.name.toLowerCase() === textToSearchFor) {
900
- const uri = util_1.util.pathToUri(this.srcPath);
901
- results.push(vscode_languageserver_1.Location.create(uri, symbol.range));
902
- }
903
- }
904
- if (this.parser.tokenFollows(token, lexer_1.TokenKind.Goto)) {
905
- for (const label of func.labelStatements) {
906
- if (label.tokens.identifier.text.toLocaleLowerCase() === textToSearchFor) {
907
- const uri = util_1.util.pathToUri(this.srcPath);
908
- results.push(vscode_languageserver_1.Location.create(uri, label.tokens.identifier.range));
909
- }
910
- }
911
- }
912
- const filesSearched = new Set();
913
- //look through all files in scope for matches
914
- for (const scope of this.program.getScopesForFile(this)) {
915
- for (const file of scope.getAllFiles()) {
916
- if (reflection_1.isXmlFile(file) || filesSearched.has(file)) {
917
- continue;
918
- }
919
- filesSearched.add(file);
920
- if ((previousToken === null || previousToken === void 0 ? void 0 : previousToken.kind) === lexer_1.TokenKind.Dot && file.parseMode === parser_1.ParseMode.BrighterScript) {
921
- results.push(...this.getClassMemberDefinitions(textToSearchFor, file));
922
- const namespaceDefinition = this.getNamespaceDefinitions(token, file);
923
- if (namespaceDefinition) {
924
- results.push(namespaceDefinition);
925
- }
926
- }
927
- const statementHandler = (statement) => {
928
- if (statement.getName(this.parseMode).toLowerCase() === textToSearchFor) {
929
- const uri = util_1.util.pathToUri(file.srcPath);
930
- results.push(vscode_languageserver_1.Location.create(uri, statement.range));
931
- }
932
- };
933
- file.parser.ast.walk(visitors_1.createVisitor({
934
- FunctionStatement: statementHandler
935
- }), {
936
- walkMode: visitors_1.WalkMode.visitStatements
937
- });
938
- }
939
- }
940
- return results;
669
+ return new DefinitionProvider_1.DefinitionProvider({
670
+ program: this.program,
671
+ file: this,
672
+ position: position,
673
+ definitions: []
674
+ }).process();
941
675
  }
942
676
  getClassMemberDefinitions(textToSearchFor, file) {
943
677
  let results = [];
944
678
  //get class fields and members
945
679
  const statementHandler = (statement) => {
680
+ var _a;
946
681
  if (statement.getName(file.parseMode).toLowerCase() === textToSearchFor) {
947
- results.push(vscode_languageserver_1.Location.create(util_1.util.pathToUri(file.srcPath), statement.range));
682
+ results.push(util_1.util.createLocationFromRange(util_1.util.pathToUri(file.srcPath), (_a = statement.location) === null || _a === void 0 ? void 0 : _a.range));
948
683
  }
949
684
  };
950
685
  const fieldStatementHandler = (statement) => {
951
- if (statement.name.text.toLowerCase() === textToSearchFor) {
952
- results.push(vscode_languageserver_1.Location.create(util_1.util.pathToUri(file.srcPath), statement.range));
686
+ var _a;
687
+ if (statement.tokens.name.text.toLowerCase() === textToSearchFor) {
688
+ results.push(util_1.util.createLocationFromRange(util_1.util.pathToUri(file.srcPath), (_a = statement.location) === null || _a === void 0 ? void 0 : _a.range));
953
689
  }
954
690
  };
955
- file.parser.ast.walk(visitors_1.createVisitor({
956
- ClassMethodStatement: statementHandler,
957
- ClassFieldStatement: fieldStatementHandler
691
+ file.parser.ast.walk((0, visitors_1.createVisitor)({
692
+ MethodStatement: statementHandler,
693
+ FieldStatement: fieldStatementHandler
958
694
  }), {
959
695
  walkMode: visitors_1.WalkMode.visitStatements
960
696
  });
961
697
  return results;
962
698
  }
963
- getHover(position) {
964
- var _a;
965
- //get the token at the position
966
- let token = this.parser.getTokenAt(position);
967
- let hoverTokenTypes = [
968
- lexer_1.TokenKind.Identifier,
969
- lexer_1.TokenKind.Function,
970
- lexer_1.TokenKind.EndFunction,
971
- lexer_1.TokenKind.Sub,
972
- lexer_1.TokenKind.EndSub
973
- ];
974
- //throw out invalid tokens and the wrong kind of tokens
975
- if (!token || !hoverTokenTypes.includes(token.kind)) {
976
- return null;
977
- }
978
- let lowerTokenText = token.text.toLowerCase();
979
- //look through local variables first
980
- {
981
- const func = this.getFunctionExpressionAtPosition(position);
982
- for (const labelStatement of func.labelStatements) {
983
- if (labelStatement.tokens.identifier.text.toLocaleLowerCase() === lowerTokenText) {
984
- return {
985
- range: token.range,
986
- contents: `${labelStatement.tokens.identifier.text}: label`
987
- };
988
- }
989
- }
990
- const typeTexts = [];
991
- for (const scope of this.program.getScopesForFile(this)) {
992
- scope.linkSymbolTable();
993
- if (func.symbolTable.hasSymbol(lowerTokenText)) {
994
- const type = (_a = func.symbolTable) === null || _a === void 0 ? void 0 : _a.getSymbolType(lowerTokenText);
995
- let scopeTypeText = '';
996
- if (reflection_1.isFunctionType(type)) {
997
- scopeTypeText = type.toString();
998
- }
999
- else {
1000
- scopeTypeText = `${token.text} as ${type.toString()}`;
1001
- }
1002
- if (!typeTexts.includes(scopeTypeText)) {
1003
- typeTexts.push(scopeTypeText);
1004
- }
1005
- }
1006
- scope.unlinkSymbolTable();
1007
- }
1008
- const typeText = typeTexts.join(' | ');
1009
- if (typeText) {
1010
- return {
1011
- range: token.range,
1012
- contents: typeText
1013
- };
1014
- }
1015
- }
1016
- //look through all callables in relevant scopes
1017
- {
1018
- let scopes = this.program.getScopesForFile(this);
1019
- for (let scope of scopes) {
1020
- let callable = scope.getCallableByName(lowerTokenText);
1021
- if (callable) {
1022
- return {
1023
- range: token.range,
1024
- contents: callable.type.toString()
1025
- };
1026
- }
1027
- }
1028
- }
1029
- }
1030
- getSignatureHelpForNamespaceMethods(callableName, dottedGetText, scope) {
1031
- var _a;
1032
- if (!dottedGetText) {
1033
- return [];
1034
- }
1035
- let namespaceLookup = scope.namespaceLookup;
1036
- let resultsMap = new Map();
1037
- for (let key in namespaceLookup) {
1038
- let namespace = namespaceLookup[key.toLowerCase()];
1039
- //completionName = "NameA."
1040
- //completionName = "NameA.Na
1041
- //NameA
1042
- //NameA.NameB
1043
- //NameA.NameB.NameC
1044
- if (namespace.fullName.toLowerCase() === dottedGetText.toLowerCase()) {
1045
- //add function and class statement completions
1046
- for (let stmt of namespace.statements) {
1047
- if (reflection_1.isFunctionStatement(stmt) && stmt.name.text.toLowerCase() === callableName.toLowerCase()) {
1048
- const result = (_a = namespace.file) === null || _a === void 0 ? void 0 : _a.getSignatureHelpForStatement(stmt);
1049
- if (!resultsMap.has(result.key)) {
1050
- resultsMap.set(result.key, result);
1051
- }
1052
- }
1053
- }
1054
- }
1055
- }
1056
- return [...resultsMap.values()];
1057
- }
1058
- getSignatureHelpForStatement(statement) {
1059
- if (!reflection_1.isFunctionStatement(statement) && !reflection_1.isClassMethodStatement(statement)) {
1060
- return undefined;
1061
- }
1062
- const func = statement.func;
1063
- const funcStartPosition = func.range.start;
1064
- // Get function comments in reverse order
1065
- let currentToken = this.parser.getTokenAt(funcStartPosition);
1066
- let functionComments = [];
1067
- while (currentToken) {
1068
- currentToken = this.parser.getPreviousToken(currentToken);
1069
- if (!currentToken) {
1070
- break;
1071
- }
1072
- if (currentToken.range.start.line + 1 < funcStartPosition.line) {
1073
- if (functionComments.length === 0) {
1074
- break;
1075
- }
1076
- }
1077
- const kind = currentToken.kind;
1078
- if (kind === lexer_1.TokenKind.Comment) {
1079
- // Strip off common leading characters to make it easier to read
1080
- const commentText = currentToken.text.replace(/^[' *\/]+/, '');
1081
- functionComments.unshift(commentText);
1082
- }
1083
- else if (kind === lexer_1.TokenKind.Newline) {
1084
- if (functionComments.length === 0) {
1085
- continue;
1086
- }
1087
- // if we already had a new line as the last token then exit out
1088
- if (functionComments[0] === currentToken.text) {
1089
- break;
1090
- }
1091
- functionComments.unshift(currentToken.text);
1092
- }
1093
- else {
1094
- break;
1095
- }
1096
- }
1097
- const documentation = functionComments.join('').trim();
1098
- const lines = util_1.util.splitIntoLines(this.fileContents);
1099
- let key = statement.name.text + documentation;
1100
- const params = [];
1101
- for (const param of func.parameters) {
1102
- params.push(vscode_languageserver_1.ParameterInformation.create(param.name.text));
1103
- key += param.name.text;
1104
- }
1105
- const label = util_1.util.getTextForRange(lines, util_1.util.createRangeFromPositions(func.functionType.range.start, func.body.range.start)).trim();
1106
- const signature = vscode_languageserver_1.SignatureInformation.create(label, documentation, ...params);
1107
- const index = 1;
1108
- return { key: key, signature: signature, index: index };
1109
- }
1110
699
  getClassMethod(classStatement, name, walkParents = true) {
1111
700
  var _a;
1112
701
  //TODO - would like to write this with getClassHieararchy; but got stuck on working out the scopes to use... :(
1113
702
  let statement;
1114
703
  const statementHandler = (e) => {
1115
- if (!statement && e.name.text.toLowerCase() === name.toLowerCase()) {
704
+ if (!statement && e.tokens.name.text.toLowerCase() === name.toLowerCase()) {
1116
705
  statement = e;
1117
706
  }
1118
707
  };
1119
708
  while (classStatement) {
1120
- classStatement.walk(visitors_1.createVisitor({
1121
- ClassMethodStatement: statementHandler
709
+ classStatement.walk((0, visitors_1.createVisitor)({
710
+ MethodStatement: statementHandler
1122
711
  }), {
1123
712
  walkMode: visitors_1.WalkMode.visitStatements
1124
713
  });
@@ -1135,48 +724,58 @@ class BrsFile {
1135
724
  }
1136
725
  return statement;
1137
726
  }
1138
- getClassSignatureHelp(classStatement) {
1139
- const classConstructor = this.getClassMethod(classStatement, 'new');
1140
- let sigHelp = classConstructor ? this.getSignatureHelpForStatement(classConstructor) : undefined;
1141
- if (sigHelp) {
1142
- sigHelp.key = classStatement.getName(parser_1.ParseMode.BrighterScript);
1143
- sigHelp.signature.label = sigHelp.signature.label.replace(/(function|sub) new/, sigHelp.key);
1144
- }
1145
- return sigHelp;
1146
- }
727
+ /**
728
+ * Given a position in a file, if the position is sitting on some type of identifier,
729
+ * look up all references of that identifier (every place that identifier is used across the whole app)
730
+ * @deprecated use `ReferencesProvider.process()` instead
731
+ */
1147
732
  getReferences(position) {
1148
- const callSiteToken = this.parser.getTokenAt(position);
1149
- let locations = [];
1150
- const searchFor = callSiteToken.text.toLowerCase();
1151
- const scopes = this.program.getScopesForFile(this);
1152
- for (const scope of scopes) {
1153
- const processedFiles = new Set();
1154
- for (const file of scope.getAllFiles()) {
1155
- if (reflection_1.isXmlFile(file) || processedFiles.has(file)) {
1156
- continue;
1157
- }
1158
- processedFiles.add(file);
1159
- file.ast.walk(visitors_1.createVisitor({
1160
- VariableExpression: (e) => {
1161
- if (e.name.text.toLowerCase() === searchFor) {
1162
- locations.push(vscode_languageserver_1.Location.create(util_1.util.pathToUri(file.srcPath), e.range));
1163
- }
1164
- }
1165
- }), {
1166
- walkMode: visitors_1.WalkMode.visitExpressionsRecursive
1167
- });
1168
- }
733
+ return new ReferencesProvider_1.ReferencesProvider({
734
+ program: this.program,
735
+ file: this,
736
+ position: position,
737
+ references: []
738
+ }).process();
739
+ }
740
+ /**
741
+ * Generate the code, map, and typedef for this file
742
+ */
743
+ serialize() {
744
+ const result = {};
745
+ const transpiled = this.transpile();
746
+ if (typeof transpiled.code === 'string') {
747
+ result.code = transpiled.code;
1169
748
  }
1170
- return locations;
749
+ if (transpiled.map) {
750
+ result.map = transpiled.map.toString();
751
+ }
752
+ //generate the typedef (if this is not a typedef itself, and if enabled)
753
+ if (!this.isTypedef && this.program.options.emitDefinitions) {
754
+ result.typedef = this.getTypedef();
755
+ }
756
+ return result;
1171
757
  }
1172
758
  /**
1173
759
  * Convert the brightscript/brighterscript source code into valid brightscript
1174
760
  */
1175
761
  transpile() {
762
+ var _a, _b;
1176
763
  const state = new BrsTranspileState_1.BrsTranspileState(this);
764
+ state.editor = (_a = this.editor) !== null && _a !== void 0 ? _a : new Editor_1.Editor();
1177
765
  let transpileResult;
1178
766
  if (this.needsTranspiled) {
1179
- transpileResult = new source_map_1.SourceNode(null, null, state.srcPath, this.ast.transpile(state));
767
+ const astTranspile = this.ast.transpile(state);
768
+ const trailingComments = [];
769
+ if (util_1.util.hasLeadingComments(this.parser.eofToken)) {
770
+ if (util_1.util.isLeadingCommentOnSameLine((_b = this.ast.statements[this.ast.statements.length - 1]) === null || _b === void 0 ? void 0 : _b.location, this.parser.eofToken)) {
771
+ trailingComments.push(' ');
772
+ }
773
+ else {
774
+ trailingComments.push('\n');
775
+ }
776
+ trailingComments.push(...state.transpileLeadingComments(this.parser.eofToken));
777
+ }
778
+ transpileResult = util_1.util.sourceNodeFromTranspileResult(null, null, state.srcPath, [...astTranspile, ...trailingComments]);
1180
779
  }
1181
780
  else if (this.program.options.sourceMap) {
1182
781
  //emit code as-is with a simple map to the original file location
@@ -1186,12 +785,18 @@ class BrsFile {
1186
785
  //simple SourceNode wrapping the entire file to simplify the logic below
1187
786
  transpileResult = new source_map_1.SourceNode(null, null, state.srcPath, this.fileContents);
1188
787
  }
788
+ //if we created an editor for this flow, undo the edits now
789
+ if (!this.editor) {
790
+ //undo any AST edits that the transpile cycle has made
791
+ state.editor.undoAll();
792
+ }
1189
793
  if (this.program.options.sourceMap) {
1190
- return new source_map_1.SourceNode(null, null, null, [
794
+ const stagingFileName = path.basename(state.srcPath).replace(/\.bs$/, '.brs');
795
+ return new source_map_1.SourceNode(null, null, stagingFileName, [
1191
796
  transpileResult,
1192
797
  //add the sourcemap reference comment
1193
- `'//# sourceMappingURL=./${path.basename(state.srcPath)}.map`
1194
- ]).toStringWithSourceMap();
798
+ state.newline + `'//# sourceMappingURL=./${stagingFileName}.map`
799
+ ]).toStringWithSourceMap({ file: stagingFileName });
1195
800
  }
1196
801
  else {
1197
802
  return {
@@ -1200,30 +805,327 @@ class BrsFile {
1200
805
  };
1201
806
  }
1202
807
  }
808
+ getNamespaceSymbolTable(allowCache = true) {
809
+ var _a;
810
+ if (!allowCache) {
811
+ return this.constructNamespaceSymbolTable();
812
+ }
813
+ return (_a = this.cache) === null || _a === void 0 ? void 0 : _a.getOrAdd(`namespaceSymbolTable`, () => this.constructNamespaceSymbolTable());
814
+ }
815
+ constructNamespaceSymbolTable() {
816
+ const nsTable = new SymbolTable_1.SymbolTable(`File NamespaceTypes ${this.destPath}`, () => { var _a; return (_a = this.program) === null || _a === void 0 ? void 0 : _a.globalScope.symbolTable; });
817
+ this.populateNameSpaceSymbolTable(nsTable);
818
+ return nsTable;
819
+ }
820
+ processSymbolInformation() {
821
+ // Get namespaces across imported files
822
+ this.program.logger.debug('Processing symbol information', this.srcPath);
823
+ const nsTable = this.getNamespaceSymbolTable(false);
824
+ this.linkSymbolTableDisposables.push(this.ast.symbolTable.addSibling(nsTable));
825
+ this.validationSegmenter.processTree(this.ast);
826
+ this.program.addFileSymbolInfo(this);
827
+ this.unlinkNamespaceSymbolTables();
828
+ }
829
+ unlinkNamespaceSymbolTables() {
830
+ for (let disposable of this.linkSymbolTableDisposables) {
831
+ disposable();
832
+ }
833
+ this.linkSymbolTableDisposables = [];
834
+ }
835
+ populateNameSpaceSymbolTable(namespaceSymbolTable) {
836
+ var _a;
837
+ //Add namespace aggregates to namespace member tables
838
+ const namespaceTypesKnown = new Map();
839
+ // eslint-disable-next-line no-bitwise
840
+ let getTypeOptions = { flags: 1 /* SymbolTypeFlag.runtime */ | 2 /* SymbolTypeFlag.typetime */ };
841
+ for (const [nsName, nsContainer] of this.getNamespaceLookupObject()) {
842
+ let currentNSType = null;
843
+ let parentNSType = null;
844
+ const existingNsStmt = (_a = nsContainer.namespaceStatements) === null || _a === void 0 ? void 0 : _a[0];
845
+ if (!nsContainer.isTopLevel) {
846
+ parentNSType = namespaceTypesKnown.get(nsContainer.parentNameLower);
847
+ if (!parentNSType) {
848
+ // we don't know about the parent namespace... uh, oh!
849
+ this.program.logger.error(`Unable to find parent namespace type for namespace ${nsName}`);
850
+ break;
851
+ }
852
+ currentNSType = parentNSType.getMemberType(nsContainer.fullNameLower, getTypeOptions);
853
+ }
854
+ else {
855
+ currentNSType = namespaceSymbolTable.getSymbolType(nsContainer.fullNameLower, getTypeOptions);
856
+ }
857
+ if (!(0, reflection_1.isNamespaceType)(currentNSType)) {
858
+ if (!currentNSType || (0, reflection_1.isReferenceType)(currentNSType) || (0, reflection_1.isCallableType)(currentNSType)) {
859
+ currentNSType = existingNsStmt
860
+ ? existingNsStmt.getType(getTypeOptions)
861
+ : new types_1.NamespaceType(nsName);
862
+ if (parentNSType) {
863
+ // adding as a member of existing NS
864
+ parentNSType.addMember(nsContainer.lastPartName, { definingNode: existingNsStmt }, currentNSType, getTypeOptions.flags);
865
+ }
866
+ else {
867
+ namespaceSymbolTable.addSymbol(nsContainer.lastPartName, { definingNode: existingNsStmt }, currentNSType, getTypeOptions.flags);
868
+ }
869
+ }
870
+ else {
871
+ // Something else already used the name this namespace is using.
872
+ continue;
873
+ }
874
+ }
875
+ else {
876
+ // Existing known namespace
877
+ }
878
+ if (!namespaceTypesKnown.has(nsName)) {
879
+ namespaceTypesKnown.set(nsName, currentNSType);
880
+ }
881
+ currentNSType.memberTable.addSibling(nsContainer.symbolTable);
882
+ }
883
+ }
884
+ get requiredSymbols() {
885
+ return this.cache.getOrAdd(`requiredSymbols`, () => {
886
+ var _a, _b, _c, _d, _e;
887
+ this.program.logger.debug('Getting required symbols', this.srcPath);
888
+ const allNeededSymbolSets = this.validationSegmenter.unresolvedSegmentsSymbols.values();
889
+ const requiredSymbols = [];
890
+ const addedSymbols = new Map();
891
+ addedSymbols.set(1 /* SymbolTypeFlag.runtime */, new Set());
892
+ addedSymbols.set(2 /* SymbolTypeFlag.typetime */, new Set());
893
+ for (const setOfSymbols of allNeededSymbolSets) {
894
+ for (const symbol of setOfSymbols) {
895
+ const fullSymbolKey = symbol.typeChain.map(tce => tce.name).join('.').toLowerCase();
896
+ const flag = symbol.endChainFlags;
897
+ if ((_a = this.providedSymbols.symbolMap.get(flag)) === null || _a === void 0 ? void 0 : _a.has(fullSymbolKey)) {
898
+ // this catches namespaced things
899
+ continue;
900
+ }
901
+ const existingSymbol = this.ast.getSymbolTable().getSymbol(fullSymbolKey, flag);
902
+ if ((existingSymbol === null || existingSymbol === void 0 ? void 0 : existingSymbol.length) > 0) {
903
+ if ((_c = (_b = symbol[0]) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.isAlias) {
904
+ //catches aliases
905
+ continue;
906
+ }
907
+ }
908
+ if (!((_d = addedSymbols.get(flag)) === null || _d === void 0 ? void 0 : _d.has(fullSymbolKey))) {
909
+ requiredSymbols.push(symbol);
910
+ (_e = addedSymbols.get(flag)) === null || _e === void 0 ? void 0 : _e.add(fullSymbolKey);
911
+ }
912
+ }
913
+ }
914
+ return requiredSymbols;
915
+ });
916
+ }
917
+ get providedSymbols() {
918
+ var _a;
919
+ return (_a = this.cache) === null || _a === void 0 ? void 0 : _a.getOrAdd(`providedSymbols`, () => {
920
+ return this.getProvidedSymbols();
921
+ });
922
+ }
923
+ get assignedSymbols() {
924
+ return this.cache.getOrAdd(`assignedSymbols`, () => {
925
+ var _a;
926
+ const allAssignedSymbolsEntries = (_a = this.validationSegmenter.assignedTokensInSegment.entries()) !== null && _a !== void 0 ? _a : [];
927
+ let allAssignedSymbolsSet = [];
928
+ for (const [_segment, assignedSymbolSet] of allAssignedSymbolsEntries) {
929
+ allAssignedSymbolsSet.push(...assignedSymbolSet.values());
930
+ }
931
+ return allAssignedSymbolsSet;
932
+ });
933
+ }
934
+ getProvidedSymbols() {
935
+ var _a, _b, _c;
936
+ this.program.logger.debug('Getting provided symbols', this.srcPath);
937
+ const symbolMap = new Map();
938
+ const runTimeSymbolMap = new Map();
939
+ const typeTimeSymbolMap = new Map();
940
+ const referenceSymbolMap = new Map();
941
+ const referenceRunTimeSymbolMap = new Map();
942
+ const referenceTypeTimeSymbolMap = new Map();
943
+ const tablesToGetSymbolsFrom = [
944
+ { table: this.parser.symbolTable },
945
+ ...this.parser.symbolTable.pocketTables
946
+ ];
947
+ for (const namespaceStatement of this._cachedLookups.namespaceStatements) {
948
+ tablesToGetSymbolsFrom.push({
949
+ table: namespaceStatement.body.getSymbolTable(),
950
+ namePrefixLower: namespaceStatement.getName(Parser_1.ParseMode.BrighterScript).toLowerCase()
951
+ });
952
+ }
953
+ function getAnyDuplicates(symbolNameLower, providedSymbolMap, referenceProvidedSymbolMap) {
954
+ if (symbolNameLower === 'm') {
955
+ return [];
956
+ }
957
+ let duplicates = [];
958
+ let existingSymbol = providedSymbolMap.get(symbolNameLower);
959
+ if (existingSymbol) {
960
+ duplicates.push(existingSymbol.symbol, ...existingSymbol.duplicates);
961
+ }
962
+ existingSymbol = referenceProvidedSymbolMap.get(symbolNameLower);
963
+ if (existingSymbol) {
964
+ duplicates.push(existingSymbol.symbol, ...existingSymbol.duplicates);
965
+ }
966
+ return duplicates;
967
+ }
968
+ for (const symbolTable of tablesToGetSymbolsFrom) {
969
+ const runTimeSymbols = symbolTable.table.getOwnSymbols(1 /* SymbolTypeFlag.runtime */);
970
+ const typeTimeSymbols = symbolTable.table.getOwnSymbols(2 /* SymbolTypeFlag.typetime */);
971
+ for (const symbol of runTimeSymbols) {
972
+ const symbolNameLower = symbolTable.namePrefixLower
973
+ ? `${symbolTable.namePrefixLower}.${symbol.name.toLowerCase()}`
974
+ : symbol.name.toLowerCase();
975
+ if (symbolNameLower === 'm') {
976
+ continue;
977
+ }
978
+ const duplicates = getAnyDuplicates(symbolNameLower, runTimeSymbolMap, referenceRunTimeSymbolMap);
979
+ if (!(0, reflection_1.isAnyReferenceType)(symbol.type)) {
980
+ runTimeSymbolMap.set(symbolNameLower, { symbol: symbol, duplicates: duplicates });
981
+ }
982
+ else {
983
+ referenceRunTimeSymbolMap.set(symbolNameLower, { symbol: symbol, duplicates: duplicates });
984
+ }
985
+ }
986
+ for (const symbol of typeTimeSymbols) {
987
+ const symbolNameLower = symbolTable.namePrefixLower
988
+ ? `${symbolTable.namePrefixLower}.${symbol.name.toLowerCase()}`
989
+ : symbol.name.toLowerCase();
990
+ if (symbolNameLower === 'm') {
991
+ continue;
992
+ }
993
+ const duplicates = getAnyDuplicates(symbolNameLower, typeTimeSymbolMap, referenceTypeTimeSymbolMap);
994
+ if (!(0, reflection_1.isAnyReferenceType)(symbol.type)) {
995
+ const requiredSymbolTypes = new Set();
996
+ util_1.util.getCustomTypesInSymbolTree(requiredSymbolTypes, symbol.type);
997
+ const requiredSymbolNames = new Set();
998
+ for (const requiredType of requiredSymbolTypes.values()) {
999
+ requiredSymbolNames.add(requiredType.toString());
1000
+ }
1001
+ typeTimeSymbolMap.set(symbolNameLower, { symbol: symbol, duplicates: duplicates, requiredSymbolNames: requiredSymbolNames });
1002
+ }
1003
+ else {
1004
+ referenceTypeTimeSymbolMap.set(symbolNameLower, { symbol: symbol, duplicates: duplicates });
1005
+ }
1006
+ }
1007
+ }
1008
+ symbolMap.set(1 /* SymbolTypeFlag.runtime */, runTimeSymbolMap);
1009
+ symbolMap.set(2 /* SymbolTypeFlag.typetime */, typeTimeSymbolMap);
1010
+ referenceSymbolMap.set(1 /* SymbolTypeFlag.runtime */, referenceRunTimeSymbolMap);
1011
+ referenceSymbolMap.set(2 /* SymbolTypeFlag.typetime */, referenceTypeTimeSymbolMap);
1012
+ const changes = new Map();
1013
+ changes.set(1 /* SymbolTypeFlag.runtime */, new Set());
1014
+ changes.set(2 /* SymbolTypeFlag.typetime */, new Set());
1015
+ const previouslyProvidedSymbols = (_a = this.program.getFileSymbolInfo(this)) === null || _a === void 0 ? void 0 : _a.provides.symbolMap;
1016
+ const previousSymbolsChecked = new Map();
1017
+ previousSymbolsChecked.set(1 /* SymbolTypeFlag.runtime */, new Set());
1018
+ previousSymbolsChecked.set(2 /* SymbolTypeFlag.typetime */, new Set());
1019
+ for (const flag of [1 /* SymbolTypeFlag.runtime */, 2 /* SymbolTypeFlag.typetime */]) {
1020
+ const newSymbolMapForFlag = symbolMap.get(flag);
1021
+ const oldSymbolMapForFlag = previouslyProvidedSymbols === null || previouslyProvidedSymbols === void 0 ? void 0 : previouslyProvidedSymbols.get(flag);
1022
+ const previousSymbolsCheckedForFlag = previousSymbolsChecked.get(flag);
1023
+ const changesForFlag = changes.get(flag);
1024
+ if (!oldSymbolMapForFlag) {
1025
+ for (const key of newSymbolMapForFlag.keys()) {
1026
+ changesForFlag.add(key);
1027
+ }
1028
+ continue;
1029
+ }
1030
+ for (const [symbolKey, symbolObj] of newSymbolMapForFlag) {
1031
+ const symbolType = symbolObj.symbol.type;
1032
+ const previousType = (_c = (_b = oldSymbolMapForFlag === null || oldSymbolMapForFlag === void 0 ? void 0 : oldSymbolMapForFlag.get(symbolKey)) === null || _b === void 0 ? void 0 : _b.symbol) === null || _c === void 0 ? void 0 : _c.type;
1033
+ previousSymbolsCheckedForFlag.add(symbolKey);
1034
+ if (!previousType) {
1035
+ changesForFlag.add(symbolKey);
1036
+ continue;
1037
+ }
1038
+ const data = {};
1039
+ if (!symbolType.isEqual(previousType, data)) {
1040
+ changesForFlag.add(symbolKey);
1041
+ }
1042
+ }
1043
+ for (const [symbolKey] of previouslyProvidedSymbols.get(flag)) {
1044
+ if (!previousSymbolsCheckedForFlag.has(symbolKey)) {
1045
+ changesForFlag.add(symbolKey);
1046
+ }
1047
+ }
1048
+ }
1049
+ return {
1050
+ symbolMap: symbolMap,
1051
+ changes: changes,
1052
+ referenceSymbolMap: referenceSymbolMap
1053
+ };
1054
+ }
1055
+ markSegmentAsValidated(node) {
1056
+ this.validationSegmenter.markSegmentAsValidated(node);
1057
+ }
1058
+ getNamespaceLookupObject() {
1059
+ if (!this.isValidated) {
1060
+ return this.buildNamespaceLookup();
1061
+ }
1062
+ return this.cache.getOrAdd(`namespaceLookup`, () => {
1063
+ const nsLookup = this.buildNamespaceLookup();
1064
+ return nsLookup;
1065
+ });
1066
+ }
1067
+ buildNamespaceLookup() {
1068
+ var _a;
1069
+ const namespaceLookup = new Map();
1070
+ for (let namespaceStatement of this._cachedLookups.namespaceStatements) {
1071
+ let nameParts = namespaceStatement.getNameParts();
1072
+ let loopName = null;
1073
+ let lowerLoopName = null;
1074
+ let parentNameLower = null;
1075
+ //ensure each namespace section is represented in the results
1076
+ //(so if the namespace name is A.B.C, this will make an entry for "A", an entry for "A.B", and an entry for "A.B.C"
1077
+ for (let i = 0; i < nameParts.length; i++) {
1078
+ let part = nameParts[i];
1079
+ let lowerPartName = part.text.toLowerCase();
1080
+ if (i === 0) {
1081
+ loopName = part.text;
1082
+ lowerLoopName = lowerPartName;
1083
+ }
1084
+ else {
1085
+ parentNameLower = lowerLoopName;
1086
+ loopName += '.' + part.text;
1087
+ lowerLoopName += '.' + lowerPartName;
1088
+ }
1089
+ if (!namespaceLookup.has(lowerLoopName)) {
1090
+ namespaceLookup.set(lowerLoopName, {
1091
+ isTopLevel: i === 0,
1092
+ file: this,
1093
+ fullName: loopName,
1094
+ fullNameLower: lowerLoopName,
1095
+ parentNameLower: parentNameLower,
1096
+ nameParts: nameParts.slice(0, i),
1097
+ nameRange: (_a = namespaceStatement.nameExpression.location) === null || _a === void 0 ? void 0 : _a.range,
1098
+ lastPartName: part.text,
1099
+ lastPartNameLower: lowerPartName,
1100
+ namespaceStatements: [],
1101
+ // the aggregate symbol table should have no parent. It should include just the symbols of the namespace.
1102
+ symbolTable: new SymbolTable_1.SymbolTable(`Namespace File Aggregate: '${loopName}'`)
1103
+ });
1104
+ }
1105
+ }
1106
+ let ns = namespaceLookup.get(lowerLoopName);
1107
+ ns.namespaceStatements.push(namespaceStatement);
1108
+ // Merges all the symbol tables of the namespace statements into the new symbol table created above.
1109
+ // Set those symbol tables to have this new merged table as a parent
1110
+ ns.symbolTable.mergeSymbolTable(namespaceStatement.body.getSymbolTable());
1111
+ }
1112
+ return namespaceLookup;
1113
+ }
1203
1114
  getTypedef() {
1204
1115
  const state = new BrsTranspileState_1.BrsTranspileState(this);
1205
1116
  const typedef = this.ast.getTypedef(state);
1206
- const programNode = new source_map_1.SourceNode(null, null, this.srcPath, typedef);
1117
+ const programNode = util_1.util.sourceNodeFromTranspileResult(null, null, this.srcPath, typedef);
1207
1118
  return programNode.toString();
1208
1119
  }
1209
1120
  dispose() {
1210
1121
  var _a;
1211
1122
  (_a = this._parser) === null || _a === void 0 ? void 0 : _a.dispose();
1123
+ //deleting these properties result in lower memory usage (garbage collection is magic!)
1124
+ delete this.fileContents;
1125
+ delete this._parser;
1126
+ delete this._functionScopes;
1127
+ delete this.scopesByFunc;
1212
1128
  }
1213
1129
  }
1214
1130
  exports.BrsFile = BrsFile;
1215
- /**
1216
- * List of completions for all valid keywords/reserved words.
1217
- * Build this list once because it won't change for the lifetime of this process
1218
- */
1219
- exports.KeywordCompletions = Object.keys(lexer_1.Keywords)
1220
- //remove any keywords with whitespace
1221
- .filter(x => !x.includes(' '))
1222
- //create completions
1223
- .map(x => {
1224
- return {
1225
- label: x,
1226
- kind: vscode_languageserver_1.CompletionItemKind.Keyword
1227
- };
1228
- });
1229
1131
  //# sourceMappingURL=BrsFile.js.map