brighterscript 1.0.0-alpha.2 → 1.0.0-alpha.20

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 (381) hide show
  1. package/CHANGELOG.md +542 -253
  2. package/README.md +30 -9
  3. package/bsconfig.schema.json +13 -1
  4. package/dist/BsConfig.d.ts +4 -0
  5. package/dist/Cache.d.ts +3 -8
  6. package/dist/Cache.js +9 -14
  7. package/dist/Cache.js.map +1 -1
  8. package/dist/CodeActionUtil.d.ts +11 -2
  9. package/dist/CodeActionUtil.js +17 -3
  10. package/dist/CodeActionUtil.js.map +1 -1
  11. package/dist/CommentFlagProcessor.d.ts +4 -4
  12. package/dist/CommentFlagProcessor.js +5 -3
  13. package/dist/CommentFlagProcessor.js.map +1 -1
  14. package/dist/DependencyGraph.js +5 -4
  15. package/dist/DependencyGraph.js.map +1 -1
  16. package/dist/DiagnosticFilterer.js +1 -1
  17. package/dist/DiagnosticFilterer.js.map +1 -1
  18. package/dist/DiagnosticMessages.d.ts +59 -4
  19. package/dist/DiagnosticMessages.js +65 -7
  20. package/dist/DiagnosticMessages.js.map +1 -1
  21. package/dist/LanguageServer.d.ts +4 -14
  22. package/dist/LanguageServer.js +40 -26
  23. package/dist/LanguageServer.js.map +1 -1
  24. package/dist/Logger.d.ts +2 -0
  25. package/dist/Logger.js +10 -8
  26. package/dist/Logger.js.map +1 -1
  27. package/dist/PluginInterface.d.ts +7 -3
  28. package/dist/PluginInterface.js +9 -0
  29. package/dist/PluginInterface.js.map +1 -1
  30. package/dist/Program.d.ts +43 -25
  31. package/dist/Program.js +180 -82
  32. package/dist/Program.js.map +1 -1
  33. package/dist/ProgramBuilder.d.ts +4 -0
  34. package/dist/ProgramBuilder.js +30 -14
  35. package/dist/ProgramBuilder.js.map +1 -1
  36. package/dist/Scope.d.ts +100 -28
  37. package/dist/Scope.js +382 -154
  38. package/dist/Scope.js.map +1 -1
  39. package/dist/SemanticTokenUtils.d.ts +14 -0
  40. package/dist/SemanticTokenUtils.js +81 -0
  41. package/dist/SemanticTokenUtils.js.map +1 -0
  42. package/dist/SymbolTable.d.ts +10 -4
  43. package/dist/SymbolTable.js +40 -13
  44. package/dist/SymbolTable.js.map +1 -1
  45. package/dist/XmlScope.d.ts +8 -3
  46. package/dist/XmlScope.js +65 -27
  47. package/dist/XmlScope.js.map +1 -1
  48. package/dist/astUtils/AstEditor.d.ts +33 -0
  49. package/dist/astUtils/AstEditor.js +107 -0
  50. package/dist/astUtils/AstEditor.js.map +1 -0
  51. package/dist/{types/FunctionType.spec.d.ts → astUtils/AstEditor.spec.d.ts} +0 -0
  52. package/dist/astUtils/AstEditor.spec.js +170 -0
  53. package/dist/astUtils/AstEditor.spec.js.map +1 -0
  54. package/dist/astUtils/creators.d.ts +24 -6
  55. package/dist/astUtils/creators.js +130 -19
  56. package/dist/astUtils/creators.js.map +1 -1
  57. package/dist/astUtils/creators.spec.js +14 -4
  58. package/dist/astUtils/creators.spec.js.map +1 -1
  59. package/dist/astUtils/reflection.d.ts +27 -8
  60. package/dist/astUtils/reflection.js +66 -1
  61. package/dist/astUtils/reflection.js.map +1 -1
  62. package/dist/astUtils/reflection.spec.js +130 -119
  63. package/dist/astUtils/reflection.spec.js.map +1 -1
  64. package/dist/astUtils/stackedVisitor.js.map +1 -1
  65. package/dist/astUtils/stackedVisitor.spec.js +13 -13
  66. package/dist/astUtils/stackedVisitor.spec.js.map +1 -1
  67. package/dist/astUtils/visitors.d.ts +17 -2
  68. package/dist/astUtils/visitors.js +2 -2
  69. package/dist/astUtils/visitors.js.map +1 -1
  70. package/dist/astUtils/visitors.spec.js +31 -29
  71. package/dist/astUtils/visitors.spec.js.map +1 -1
  72. package/dist/astUtils/xml.d.ts +4 -3
  73. package/dist/astUtils/xml.js +8 -3
  74. package/dist/astUtils/xml.js.map +1 -1
  75. package/dist/bscPlugin/BscPlugin.d.ts +7 -1
  76. package/dist/bscPlugin/BscPlugin.js +28 -0
  77. package/dist/bscPlugin/BscPlugin.js.map +1 -1
  78. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +4 -4
  79. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
  80. package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js +26 -26
  81. package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js.map +1 -1
  82. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.d.ts +9 -0
  83. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +97 -0
  84. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -0
  85. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.d.ts +1 -0
  86. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js +73 -0
  87. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js.map +1 -0
  88. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.d.ts +8 -0
  89. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js +52 -0
  90. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js.map +1 -0
  91. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.d.ts +1 -0
  92. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js +32 -0
  93. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js.map +1 -0
  94. package/dist/bscPlugin/validation/BrsFileValidator.d.ts +9 -0
  95. package/dist/bscPlugin/validation/BrsFileValidator.js +66 -0
  96. package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -0
  97. package/dist/bscPlugin/validation/ScopeValidator.d.ts +29 -0
  98. package/dist/bscPlugin/validation/ScopeValidator.js +183 -0
  99. package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -0
  100. package/dist/cli.js +9 -3
  101. package/dist/cli.js.map +1 -1
  102. package/dist/diagnosticUtils.d.ts +1 -0
  103. package/dist/diagnosticUtils.js +15 -8
  104. package/dist/diagnosticUtils.js.map +1 -1
  105. package/dist/examples/plugins/removePrint.js +12 -14
  106. package/dist/examples/plugins/removePrint.js.map +1 -1
  107. package/dist/files/BrsFile.Class.spec.js +634 -145
  108. package/dist/files/BrsFile.Class.spec.js.map +1 -1
  109. package/dist/files/BrsFile.d.ts +62 -30
  110. package/dist/files/BrsFile.js +683 -335
  111. package/dist/files/BrsFile.js.map +1 -1
  112. package/dist/files/BrsFile.spec.js +1055 -449
  113. package/dist/files/BrsFile.spec.js.map +1 -1
  114. package/dist/files/XmlFile.d.ts +11 -10
  115. package/dist/files/XmlFile.js +33 -26
  116. package/dist/files/XmlFile.js.map +1 -1
  117. package/dist/files/XmlFile.spec.js +302 -237
  118. package/dist/files/XmlFile.spec.js.map +1 -1
  119. package/dist/files/tests/imports.spec.js +44 -42
  120. package/dist/files/tests/imports.spec.js.map +1 -1
  121. package/dist/files/tests/optionalChaning.spec.d.ts +1 -0
  122. package/dist/files/tests/optionalChaning.spec.js +88 -0
  123. package/dist/files/tests/optionalChaning.spec.js.map +1 -0
  124. package/dist/globalCallables.d.ts +3 -1
  125. package/dist/globalCallables.js +424 -152
  126. package/dist/globalCallables.js.map +1 -1
  127. package/dist/index.d.ts +13 -3
  128. package/dist/index.js +23 -4
  129. package/dist/index.js.map +1 -1
  130. package/dist/interfaces.d.ts +129 -16
  131. package/dist/lexer/Lexer.d.ts +19 -1
  132. package/dist/lexer/Lexer.js +127 -21
  133. package/dist/lexer/Lexer.js.map +1 -1
  134. package/dist/lexer/Lexer.spec.js +657 -536
  135. package/dist/lexer/Lexer.spec.js.map +1 -1
  136. package/dist/lexer/Token.d.ts +2 -2
  137. package/dist/lexer/TokenKind.d.ts +13 -1
  138. package/dist/lexer/TokenKind.js +60 -3
  139. package/dist/lexer/TokenKind.js.map +1 -1
  140. package/dist/parser/BrsTranspileState.d.ts +7 -0
  141. package/dist/parser/BrsTranspileState.js +9 -0
  142. package/dist/parser/BrsTranspileState.js.map +1 -1
  143. package/dist/parser/Expression.d.ts +150 -34
  144. package/dist/parser/Expression.js +337 -150
  145. package/dist/parser/Expression.js.map +1 -1
  146. package/dist/parser/Parser.Class.spec.js +189 -89
  147. package/dist/parser/Parser.Class.spec.js.map +1 -1
  148. package/dist/parser/Parser.d.ts +152 -29
  149. package/dist/parser/Parser.js +1095 -501
  150. package/dist/parser/Parser.js.map +1 -1
  151. package/dist/parser/Parser.spec.js +687 -266
  152. package/dist/parser/Parser.spec.js.map +1 -1
  153. package/dist/parser/SGParser.d.ts +41 -4
  154. package/dist/parser/SGParser.js +186 -175
  155. package/dist/parser/SGParser.js.map +1 -1
  156. package/dist/parser/SGParser.spec.js +35 -22
  157. package/dist/parser/SGParser.spec.js.map +1 -1
  158. package/dist/parser/SGTypes.d.ts +206 -38
  159. package/dist/parser/SGTypes.js +470 -161
  160. package/dist/parser/SGTypes.js.map +1 -1
  161. package/dist/parser/SGTypes.spec.d.ts +1 -0
  162. package/dist/parser/SGTypes.spec.js +351 -0
  163. package/dist/parser/SGTypes.spec.js.map +1 -0
  164. package/dist/parser/Statement.d.ts +194 -40
  165. package/dist/parser/Statement.js +597 -160
  166. package/dist/parser/Statement.js.map +1 -1
  167. package/dist/parser/Statement.spec.js +11 -11
  168. package/dist/parser/Statement.spec.js.map +1 -1
  169. package/dist/parser/TranspileState.d.ts +1 -1
  170. package/dist/parser/TranspileState.js +15 -7
  171. package/dist/parser/TranspileState.js.map +1 -1
  172. package/dist/parser/tests/Parser.spec.d.ts +10 -9
  173. package/dist/parser/tests/Parser.spec.js +15 -11
  174. package/dist/parser/tests/Parser.spec.js.map +1 -1
  175. package/dist/parser/tests/controlFlow/For.spec.js +60 -60
  176. package/dist/parser/tests/controlFlow/For.spec.js.map +1 -1
  177. package/dist/parser/tests/controlFlow/ForEach.spec.js +40 -39
  178. package/dist/parser/tests/controlFlow/ForEach.spec.js.map +1 -1
  179. package/dist/parser/tests/controlFlow/If.spec.js +213 -194
  180. package/dist/parser/tests/controlFlow/If.spec.js.map +1 -1
  181. package/dist/parser/tests/controlFlow/While.spec.js +37 -37
  182. package/dist/parser/tests/controlFlow/While.spec.js.map +1 -1
  183. package/dist/parser/tests/expression/Additive.spec.js +30 -30
  184. package/dist/parser/tests/expression/Additive.spec.js.map +1 -1
  185. package/dist/parser/tests/expression/ArrayLiterals.spec.js +119 -119
  186. package/dist/parser/tests/expression/ArrayLiterals.spec.js.map +1 -1
  187. package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js +162 -138
  188. package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js.map +1 -1
  189. package/dist/parser/tests/expression/Boolean.spec.js +24 -24
  190. package/dist/parser/tests/expression/Boolean.spec.js.map +1 -1
  191. package/dist/parser/tests/expression/Call.spec.js +41 -40
  192. package/dist/parser/tests/expression/Call.spec.js.map +1 -1
  193. package/dist/parser/tests/expression/Exponential.spec.js +17 -17
  194. package/dist/parser/tests/expression/Exponential.spec.js.map +1 -1
  195. package/dist/parser/tests/expression/Function.spec.js +256 -256
  196. package/dist/parser/tests/expression/Function.spec.js.map +1 -1
  197. package/dist/parser/tests/expression/Indexing.spec.js +87 -87
  198. package/dist/parser/tests/expression/Indexing.spec.js.map +1 -1
  199. package/dist/parser/tests/expression/Multiplicative.spec.js +37 -37
  200. package/dist/parser/tests/expression/Multiplicative.spec.js.map +1 -1
  201. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +75 -63
  202. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +1 -1
  203. package/dist/parser/tests/expression/PrefixUnary.spec.js +41 -41
  204. package/dist/parser/tests/expression/PrefixUnary.spec.js.map +1 -1
  205. package/dist/parser/tests/expression/Primary.spec.js +41 -41
  206. package/dist/parser/tests/expression/Primary.spec.js.map +1 -1
  207. package/dist/parser/tests/expression/RegexLiteralExpression.spec.d.ts +1 -0
  208. package/dist/parser/tests/expression/RegexLiteralExpression.spec.js +171 -0
  209. package/dist/parser/tests/expression/RegexLiteralExpression.spec.js.map +1 -0
  210. package/dist/parser/tests/expression/Relational.spec.js +43 -43
  211. package/dist/parser/tests/expression/Relational.spec.js.map +1 -1
  212. package/dist/parser/tests/expression/SourceLiteralExpression.spec.js +9 -9
  213. package/dist/parser/tests/expression/SourceLiteralExpression.spec.js.map +1 -1
  214. package/dist/parser/tests/expression/TemplateStringExpression.spec.js +28 -28
  215. package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +1 -1
  216. package/dist/parser/tests/expression/TernaryExpression.spec.js +102 -102
  217. package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
  218. package/dist/parser/tests/statement/AssignmentOperators.spec.js +36 -36
  219. package/dist/parser/tests/statement/AssignmentOperators.spec.js.map +1 -1
  220. package/dist/parser/tests/statement/Declaration.spec.js +44 -44
  221. package/dist/parser/tests/statement/Declaration.spec.js.map +1 -1
  222. package/dist/parser/tests/statement/Dim.spec.js +21 -21
  223. package/dist/parser/tests/statement/Dim.spec.js.map +1 -1
  224. package/dist/parser/tests/statement/Enum.spec.d.ts +1 -0
  225. package/dist/parser/tests/statement/Enum.spec.js +840 -0
  226. package/dist/parser/tests/statement/Enum.spec.js.map +1 -0
  227. package/dist/parser/tests/statement/For.spec.d.ts +1 -0
  228. package/dist/parser/tests/statement/For.spec.js +46 -0
  229. package/dist/parser/tests/statement/For.spec.js.map +1 -0
  230. package/dist/parser/tests/statement/ForEach.spec.d.ts +1 -0
  231. package/dist/parser/tests/statement/ForEach.spec.js +37 -0
  232. package/dist/parser/tests/statement/ForEach.spec.js.map +1 -0
  233. package/dist/parser/tests/statement/Function.spec.js +198 -197
  234. package/dist/parser/tests/statement/Function.spec.js.map +1 -1
  235. package/dist/parser/tests/statement/Goto.spec.js +15 -14
  236. package/dist/parser/tests/statement/Goto.spec.js.map +1 -1
  237. package/dist/parser/tests/statement/Increment.spec.js +50 -50
  238. package/dist/parser/tests/statement/Increment.spec.js.map +1 -1
  239. package/dist/parser/tests/statement/InterfaceStatement.spec.d.ts +1 -0
  240. package/dist/parser/tests/statement/InterfaceStatement.spec.js +254 -0
  241. package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +1 -0
  242. package/dist/parser/tests/statement/LibraryStatement.spec.js +17 -17
  243. package/dist/parser/tests/statement/LibraryStatement.spec.js.map +1 -1
  244. package/dist/parser/tests/statement/Misc.spec.js +108 -106
  245. package/dist/parser/tests/statement/Misc.spec.js.map +1 -1
  246. package/dist/parser/tests/statement/PrintStatement.spec.js +40 -40
  247. package/dist/parser/tests/statement/PrintStatement.spec.js.map +1 -1
  248. package/dist/parser/tests/statement/ReturnStatement.spec.js +46 -46
  249. package/dist/parser/tests/statement/ReturnStatement.spec.js.map +1 -1
  250. package/dist/parser/tests/statement/Set.spec.js +83 -83
  251. package/dist/parser/tests/statement/Set.spec.js.map +1 -1
  252. package/dist/parser/tests/statement/Stop.spec.js +12 -11
  253. package/dist/parser/tests/statement/Stop.spec.js.map +1 -1
  254. package/dist/parser/tests/statement/Throw.spec.js +5 -5
  255. package/dist/parser/tests/statement/Throw.spec.js.map +1 -1
  256. package/dist/parser/tests/statement/TryCatch.spec.js +15 -13
  257. package/dist/parser/tests/statement/TryCatch.spec.js.map +1 -1
  258. package/dist/preprocessor/Chunk.d.ts +1 -1
  259. package/dist/preprocessor/Chunk.js.map +1 -1
  260. package/dist/preprocessor/Manifest.d.ts +5 -5
  261. package/dist/preprocessor/Manifest.js +14 -35
  262. package/dist/preprocessor/Manifest.js.map +1 -1
  263. package/dist/preprocessor/Manifest.spec.d.ts +1 -0
  264. package/dist/preprocessor/Manifest.spec.js +78 -103
  265. package/dist/preprocessor/Manifest.spec.js.map +1 -1
  266. package/dist/preprocessor/Preprocessor.d.ts +1 -1
  267. package/dist/preprocessor/Preprocessor.js +8 -8
  268. package/dist/preprocessor/Preprocessor.js.map +1 -1
  269. package/dist/preprocessor/Preprocessor.spec.js +49 -49
  270. package/dist/preprocessor/Preprocessor.spec.js.map +1 -1
  271. package/dist/preprocessor/PreprocessorParser.spec.js +72 -72
  272. package/dist/preprocessor/PreprocessorParser.spec.js.map +1 -1
  273. package/dist/roku-types/data.json +21891 -0
  274. package/dist/roku-types/index.d.ts +6776 -0
  275. package/dist/roku-types/index.js +11 -0
  276. package/dist/roku-types/index.js.map +1 -0
  277. package/dist/types/ArrayType.d.ts +8 -5
  278. package/dist/types/ArrayType.js +52 -12
  279. package/dist/types/ArrayType.js.map +1 -1
  280. package/dist/types/ArrayType.spec.js +72 -11
  281. package/dist/types/ArrayType.spec.js.map +1 -1
  282. package/dist/types/BooleanType.d.ts +4 -2
  283. package/dist/types/BooleanType.js +9 -4
  284. package/dist/types/BooleanType.js.map +1 -1
  285. package/dist/types/BooleanType.spec.js +5 -3
  286. package/dist/types/BooleanType.spec.js.map +1 -1
  287. package/dist/types/BscType.d.ts +20 -5
  288. package/dist/types/BscType.js +24 -0
  289. package/dist/types/BscType.js.map +1 -1
  290. package/dist/types/CustomType.d.ts +8 -6
  291. package/dist/types/CustomType.js +20 -11
  292. package/dist/types/CustomType.js.map +1 -1
  293. package/dist/types/DoubleType.d.ts +2 -0
  294. package/dist/types/DoubleType.js +14 -9
  295. package/dist/types/DoubleType.js.map +1 -1
  296. package/dist/types/DoubleType.spec.js +5 -3
  297. package/dist/types/DoubleType.spec.js.map +1 -1
  298. package/dist/types/DynamicType.d.ts +2 -0
  299. package/dist/types/DynamicType.js +6 -2
  300. package/dist/types/DynamicType.js.map +1 -1
  301. package/dist/types/DynamicType.spec.js +2 -2
  302. package/dist/types/DynamicType.spec.js.map +1 -1
  303. package/dist/types/FloatType.d.ts +2 -0
  304. package/dist/types/FloatType.js +14 -9
  305. package/dist/types/FloatType.js.map +1 -1
  306. package/dist/types/FloatType.spec.js +4 -2
  307. package/dist/types/FloatType.spec.js.map +1 -1
  308. package/dist/types/FunctionType.d.ts +7 -31
  309. package/dist/types/FunctionType.js +11 -57
  310. package/dist/types/FunctionType.js.map +1 -1
  311. package/dist/types/IntegerType.d.ts +2 -0
  312. package/dist/types/IntegerType.js +14 -9
  313. package/dist/types/IntegerType.js.map +1 -1
  314. package/dist/types/IntegerType.spec.js +5 -3
  315. package/dist/types/IntegerType.spec.js.map +1 -1
  316. package/dist/types/InterfaceType.d.ts +13 -4
  317. package/dist/types/InterfaceType.js +48 -8
  318. package/dist/types/InterfaceType.js.map +1 -1
  319. package/dist/types/InterfaceType.spec.d.ts +1 -0
  320. package/dist/types/InterfaceType.spec.js +194 -0
  321. package/dist/types/InterfaceType.spec.js.map +1 -0
  322. package/dist/types/InvalidType.d.ts +4 -2
  323. package/dist/types/InvalidType.js +10 -5
  324. package/dist/types/InvalidType.js.map +1 -1
  325. package/dist/types/InvalidType.spec.js +4 -2
  326. package/dist/types/InvalidType.spec.js.map +1 -1
  327. package/dist/types/LazyType.d.ts +8 -7
  328. package/dist/types/LazyType.js +22 -10
  329. package/dist/types/LazyType.js.map +1 -1
  330. package/dist/types/LongIntegerType.d.ts +2 -0
  331. package/dist/types/LongIntegerType.js +14 -9
  332. package/dist/types/LongIntegerType.js.map +1 -1
  333. package/dist/types/LongIntegerType.spec.js +4 -2
  334. package/dist/types/LongIntegerType.spec.js.map +1 -1
  335. package/dist/types/ObjectType.d.ts +8 -4
  336. package/dist/types/ObjectType.js +9 -4
  337. package/dist/types/ObjectType.js.map +1 -1
  338. package/dist/types/ObjectType.spec.js +2 -2
  339. package/dist/types/ObjectType.spec.js.map +1 -1
  340. package/dist/types/StringType.d.ts +4 -2
  341. package/dist/types/StringType.js +9 -4
  342. package/dist/types/StringType.js.map +1 -1
  343. package/dist/types/StringType.spec.js +4 -2
  344. package/dist/types/StringType.spec.js.map +1 -1
  345. package/dist/types/TypedFunctionType.d.ts +28 -0
  346. package/dist/types/TypedFunctionType.js +88 -0
  347. package/dist/types/TypedFunctionType.js.map +1 -0
  348. package/dist/types/TypedFunctionType.spec.d.ts +1 -0
  349. package/dist/types/TypedFunctionType.spec.js +37 -0
  350. package/dist/types/TypedFunctionType.spec.js.map +1 -0
  351. package/dist/types/UninitializedType.js +3 -3
  352. package/dist/types/UninitializedType.js.map +1 -1
  353. package/dist/types/VoidType.d.ts +4 -2
  354. package/dist/types/VoidType.js +8 -4
  355. package/dist/types/VoidType.js.map +1 -1
  356. package/dist/types/VoidType.spec.js +2 -2
  357. package/dist/types/VoidType.spec.js.map +1 -1
  358. package/dist/types/helpers.d.ts +42 -0
  359. package/dist/types/helpers.js +118 -0
  360. package/dist/types/helpers.js.map +1 -0
  361. package/dist/util.d.ts +87 -16
  362. package/dist/util.js +339 -94
  363. package/dist/util.js.map +1 -1
  364. package/dist/validators/ClassValidator.d.ts +19 -2
  365. package/dist/validators/ClassValidator.js +163 -102
  366. package/dist/validators/ClassValidator.js.map +1 -1
  367. package/package.json +26 -15
  368. package/dist/astUtils/index.d.ts +0 -7
  369. package/dist/astUtils/index.js +0 -26
  370. package/dist/astUtils/index.js.map +0 -1
  371. package/dist/lexer/index.d.ts +0 -3
  372. package/dist/lexer/index.js +0 -17
  373. package/dist/lexer/index.js.map +0 -1
  374. package/dist/parser/index.d.ts +0 -3
  375. package/dist/parser/index.js +0 -16
  376. package/dist/parser/index.js.map +0 -1
  377. package/dist/preprocessor/index.d.ts +0 -3
  378. package/dist/preprocessor/index.js +0 -16
  379. package/dist/preprocessor/index.js.map +0 -1
  380. package/dist/types/FunctionType.spec.js +0 -23
  381. package/dist/types/FunctionType.spec.js.map +0 -1
@@ -3,21 +3,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VoidType = void 0;
4
4
  const reflection_1 = require("../astUtils/reflection");
5
5
  class VoidType {
6
+ constructor(typeText) {
7
+ this.typeText = typeText;
8
+ }
6
9
  isAssignableTo(targetType) {
7
- return (reflection_1.isVoidType(targetType) ||
8
- reflection_1.isDynamicType(targetType));
10
+ return ((0, reflection_1.isVoidType)(targetType) ||
11
+ (0, reflection_1.isDynamicType)(targetType));
9
12
  }
10
13
  isConvertibleTo(targetType) {
11
14
  return this.isAssignableTo(targetType);
12
15
  }
13
16
  toString() {
14
- return 'void';
17
+ var _a;
18
+ return (_a = this.typeText) !== null && _a !== void 0 ? _a : 'void';
15
19
  }
16
20
  toTypeString() {
17
21
  return this.toString();
18
22
  }
19
23
  equals(targetType) {
20
- return reflection_1.isVoidType(targetType);
24
+ return (0, reflection_1.isVoidType)(targetType);
21
25
  }
22
26
  }
23
27
  exports.VoidType = VoidType;
@@ -1 +1 @@
1
- {"version":3,"file":"VoidType.js","sourceRoot":"","sources":["../../src/types/VoidType.ts"],"names":[],"mappings":";;;AAAA,uDAAmE;AAGnE,MAAa,QAAQ;IACV,cAAc,CAAC,UAAmB;QACrC,OAAO,CACH,uBAAU,CAAC,UAAU,CAAC;YACtB,0BAAa,CAAC,UAAU,CAAC,CAC5B,CAAC;IACN,CAAC;IAEM,eAAe,CAAC,UAAmB;QACtC,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;IAEM,QAAQ;QACX,OAAO,MAAM,CAAC;IAClB,CAAC;IAGM,YAAY;QACf,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAEM,MAAM,CAAC,UAAmB;QAC7B,OAAO,uBAAU,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;CACJ;AAxBD,4BAwBC"}
1
+ {"version":3,"file":"VoidType.js","sourceRoot":"","sources":["../../src/types/VoidType.ts"],"names":[],"mappings":";;;AAAA,uDAAmE;AAGnE,MAAa,QAAQ;IACjB,YACW,QAAiB;QAAjB,aAAQ,GAAR,QAAQ,CAAS;IACxB,CAAC;IAEE,cAAc,CAAC,UAAmB;QACrC,OAAO,CACH,IAAA,uBAAU,EAAC,UAAU,CAAC;YACtB,IAAA,0BAAa,EAAC,UAAU,CAAC,CAC5B,CAAC;IACN,CAAC;IAEM,eAAe,CAAC,UAAmB;QACtC,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;IAEM,QAAQ;;QACX,OAAO,MAAA,IAAI,CAAC,QAAQ,mCAAI,MAAM,CAAC;IACnC,CAAC;IAEM,YAAY;QACf,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAEM,MAAM,CAAC,UAAmB;QAC7B,OAAO,IAAA,uBAAU,EAAC,UAAU,CAAC,CAAC;IAClC,CAAC;CACJ;AA3BD,4BA2BC"}
@@ -5,8 +5,8 @@ const DynamicType_1 = require("./DynamicType");
5
5
  const VoidType_1 = require("./VoidType");
6
6
  describe('VoidType', () => {
7
7
  it('is equivalent to dynamic types', () => {
8
- chai_1.expect(new VoidType_1.VoidType().isAssignableTo(new VoidType_1.VoidType())).to.be.true;
9
- chai_1.expect(new VoidType_1.VoidType().isAssignableTo(new DynamicType_1.DynamicType())).to.be.true;
8
+ (0, chai_1.expect)(new VoidType_1.VoidType().isAssignableTo(new VoidType_1.VoidType())).to.be.true;
9
+ (0, chai_1.expect)(new VoidType_1.VoidType().isAssignableTo(new DynamicType_1.DynamicType())).to.be.true;
10
10
  });
11
11
  });
12
12
  //# sourceMappingURL=VoidType.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"VoidType.spec.js","sourceRoot":"","sources":["../../src/types/VoidType.spec.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAE9B,+CAA4C;AAC5C,yCAAsC;AAEtC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACtB,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACtC,aAAM,CAAC,IAAI,mBAAQ,EAAE,CAAC,cAAc,CAAC,IAAI,mBAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QACjE,aAAM,CAAC,IAAI,mBAAQ,EAAE,CAAC,cAAc,CAAC,IAAI,yBAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IACxE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"VoidType.spec.js","sourceRoot":"","sources":["../../src/types/VoidType.spec.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAE9B,+CAA4C;AAC5C,yCAAsC;AAEtC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACtB,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACtC,IAAA,aAAM,EAAC,IAAI,mBAAQ,EAAE,CAAC,cAAc,CAAC,IAAI,mBAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QACjE,IAAA,aAAM,EAAC,IAAI,mBAAQ,EAAE,CAAC,cAAc,CAAC,IAAI,yBAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IACxE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,42 @@
1
+ import type { CallExpression, DottedGetExpression, FunctionExpression, NewExpression, VariableExpression } from '../parser/Expression';
2
+ import type { BscType } from './BscType';
3
+ /**
4
+ * Gets the return type of a function, taking into account that the function may not have been declared yet
5
+ * If the callee already exists in symbol table, use that return type
6
+ * otherwise, make a lazy type which will not compute its type until the file is done parsing
7
+ *
8
+ * @param call the Expression to process
9
+ * @param functionExpression the wrapping function expression
10
+ * @return the best guess type of that expression
11
+ */
12
+ export declare function getTypeFromCallExpression(call: CallExpression, functionExpression: FunctionExpression): BscType;
13
+ /**
14
+ * Gets the type of a variable
15
+ * if it already exists in symbol table, use that type
16
+ * otherwise defer the type until first read, which will allow us to derive types from variables defined after this one (like from a loop perhaps)
17
+ *
18
+ * @param variable the Expression to process
19
+ * @param functionExpression the wrapping function expression
20
+ * @return the best guess type of that expression
21
+ */
22
+ export declare function getTypeFromVariableExpression(variable: VariableExpression, functionExpression: FunctionExpression): BscType;
23
+ /**
24
+ * Gets the type of a variable
25
+ * if it already exists in symbol table, use that type
26
+ * otherwise defer the type until first read, which will allow us to derive types from variables defined after this one (like from a loop perhaps)
27
+ *
28
+ * @param newExp the Expression to process
29
+ * @param functionExpression the wrapping function expression
30
+ * @return the best guess type of that expression
31
+ */
32
+ export declare function getTypeFromNewExpression(newExp: NewExpression, functionExpression: FunctionExpression): BscType;
33
+ /**
34
+ * Gets the type of a variable
35
+ * if it already exists in symbol table, use that type
36
+ * otherwise defer the type until first read, which will allow us to derive types from variables defined after this one (like from a loop perhaps)
37
+ *
38
+ * @param variable the Expression to process
39
+ * @param functionExpression the wrapping function expression
40
+ * @return the best guess type of that expression
41
+ */
42
+ export declare function getTypeFromDottedGetExpression(expr: DottedGetExpression, functionExpression: FunctionExpression): BscType;
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTypeFromDottedGetExpression = exports.getTypeFromNewExpression = exports.getTypeFromVariableExpression = exports.getTypeFromCallExpression = void 0;
4
+ const reflection_1 = require("../astUtils/reflection");
5
+ const LazyType_1 = require("./LazyType");
6
+ const UninitializedType_1 = require("./UninitializedType");
7
+ const Parser_1 = require("../parser/Parser");
8
+ const CustomType_1 = require("./CustomType");
9
+ const DynamicType_1 = require("./DynamicType");
10
+ /**
11
+ * Gets the return type of a function, taking into account that the function may not have been declared yet
12
+ * If the callee already exists in symbol table, use that return type
13
+ * otherwise, make a lazy type which will not compute its type until the file is done parsing
14
+ *
15
+ * @param call the Expression to process
16
+ * @param functionExpression the wrapping function expression
17
+ * @return the best guess type of that expression
18
+ */
19
+ function getTypeFromCallExpression(call, functionExpression) {
20
+ let calleeName = call.callee.name;
21
+ if (calleeName) {
22
+ const currentKnownType = functionExpression.symbolTable.getSymbolType(calleeName.text.toLowerCase());
23
+ if ((0, reflection_1.isTypedFunctionType)(currentKnownType)) {
24
+ return currentKnownType.returnType;
25
+ }
26
+ if (currentKnownType) {
27
+ // this will probably only happen if a functionName has been assigned to something else previously?
28
+ return currentKnownType;
29
+ }
30
+ return new LazyType_1.LazyType((context) => {
31
+ var _a;
32
+ let futureType;
33
+ if ((0, reflection_1.isBrsFile)(context === null || context === void 0 ? void 0 : context.file)) {
34
+ const file = context.file;
35
+ futureType = (_a = file.getSymbolTypeFromToken(calleeName, functionExpression, context.scope)) === null || _a === void 0 ? void 0 : _a.type;
36
+ }
37
+ else {
38
+ // Give best guess if there is no file context
39
+ futureType = functionExpression.symbolTable.getSymbolType(calleeName.text);
40
+ }
41
+ if ((0, reflection_1.isTypedFunctionType)(futureType)) {
42
+ return futureType.returnType;
43
+ }
44
+ return futureType;
45
+ });
46
+ }
47
+ else {
48
+ //return dynamic if we can't figure out the type
49
+ return new DynamicType_1.DynamicType();
50
+ }
51
+ }
52
+ exports.getTypeFromCallExpression = getTypeFromCallExpression;
53
+ /**
54
+ * Gets the type of a variable
55
+ * if it already exists in symbol table, use that type
56
+ * otherwise defer the type until first read, which will allow us to derive types from variables defined after this one (like from a loop perhaps)
57
+ *
58
+ * @param variable the Expression to process
59
+ * @param functionExpression the wrapping function expression
60
+ * @return the best guess type of that expression
61
+ */
62
+ function getTypeFromVariableExpression(variable, functionExpression) {
63
+ let variableName = variable.name.text.toLowerCase();
64
+ const currentKnownType = functionExpression.symbolTable.getSymbolType(variableName);
65
+ if ((0, reflection_1.isPrimitiveType)(currentKnownType) || (0, reflection_1.isArrayType)(currentKnownType)) {
66
+ // for "contextless" types, eg. myVar = 3.14
67
+ return currentKnownType;
68
+ }
69
+ return resolveLazyType(variable.name, functionExpression);
70
+ }
71
+ exports.getTypeFromVariableExpression = getTypeFromVariableExpression;
72
+ /**
73
+ * Gets the type of a variable
74
+ * if it already exists in symbol table, use that type
75
+ * otherwise defer the type until first read, which will allow us to derive types from variables defined after this one (like from a loop perhaps)
76
+ *
77
+ * @param newExp the Expression to process
78
+ * @param functionExpression the wrapping function expression
79
+ * @return the best guess type of that expression
80
+ */
81
+ function getTypeFromNewExpression(newExp, functionExpression) {
82
+ let className = newExp.className.getName(Parser_1.ParseMode.BrighterScript);
83
+ return new LazyType_1.LazyType((context) => {
84
+ var _a, _b, _c;
85
+ return new CustomType_1.CustomType(className, (_c = (_a = context === null || context === void 0 ? void 0 : context.scope) === null || _a === void 0 ? void 0 : _a.getClass(className, (_b = functionExpression.namespaceName) === null || _b === void 0 ? void 0 : _b.getName())) === null || _c === void 0 ? void 0 : _c.memberTable);
86
+ });
87
+ }
88
+ exports.getTypeFromNewExpression = getTypeFromNewExpression;
89
+ function resolveLazyType(currentToken, functionExpression) {
90
+ return new LazyType_1.LazyType((context) => {
91
+ var _a, _b;
92
+ let futureType;
93
+ if ((0, reflection_1.isBrsFile)(context === null || context === void 0 ? void 0 : context.file)) {
94
+ const file = context.file;
95
+ futureType = (_a = file.getSymbolTypeFromToken(currentToken, functionExpression, context.scope)) === null || _a === void 0 ? void 0 : _a.type;
96
+ }
97
+ else {
98
+ // Give best guess if there is no file context
99
+ futureType = (_b = functionExpression.symbolTable.getSymbolType(currentToken.text)) !== null && _b !== void 0 ? _b : new UninitializedType_1.UninitializedType();
100
+ }
101
+ return futureType;
102
+ });
103
+ }
104
+ /**
105
+ * Gets the type of a variable
106
+ * if it already exists in symbol table, use that type
107
+ * otherwise defer the type until first read, which will allow us to derive types from variables defined after this one (like from a loop perhaps)
108
+ *
109
+ * @param variable the Expression to process
110
+ * @param functionExpression the wrapping function expression
111
+ * @return the best guess type of that expression
112
+ */
113
+ function getTypeFromDottedGetExpression(expr, functionExpression) {
114
+ const currentToken = (0, reflection_1.isCallExpression)(expr) ? (expr.callee).name : expr.name;
115
+ return resolveLazyType(currentToken, functionExpression);
116
+ }
117
+ exports.getTypeFromDottedGetExpression = getTypeFromDottedGetExpression;
118
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/types/helpers.ts"],"names":[],"mappings":"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"}
package/dist/util.d.ts CHANGED
@@ -1,23 +1,22 @@
1
1
  import * as rokuDeploy from 'roku-deploy';
2
2
  import type { Diagnostic, Position, Range } from 'vscode-languageserver';
3
3
  import type { BsConfig } from './BsConfig';
4
- import type { CallableContainer, BsDiagnostic, FileReference, CallableContainerMap, CompilerPlugin, ExpressionInfo, FunctionCall } from './interfaces';
4
+ import type { CallableContainer, BsDiagnostic, FileReference, CallableContainerMap, CompilerPlugin, ExpressionInfo, FunctionCall, CallableParam, TranspileResult } from './interfaces';
5
5
  import { BooleanType } from './types/BooleanType';
6
6
  import { DoubleType } from './types/DoubleType';
7
7
  import { DynamicType } from './types/DynamicType';
8
8
  import { FloatType } from './types/FloatType';
9
- import { FunctionType } from './types/FunctionType';
10
9
  import { IntegerType } from './types/IntegerType';
11
10
  import { InvalidType } from './types/InvalidType';
12
11
  import { LongIntegerType } from './types/LongIntegerType';
13
- import { ObjectType } from './types/ObjectType';
14
12
  import { StringType } from './types/StringType';
15
13
  import { VoidType } from './types/VoidType';
16
- import type { DottedGetExpression, Expression, VariableExpression } from './parser/Expression';
17
- import type { Token } from './lexer';
18
- import { CustomType } from './types/CustomType';
14
+ import type { DottedGetExpression, Expression, NamespacedVariableNameExpression, VariableExpression } from './parser/Expression';
15
+ import type { Locatable, Token } from './lexer/Token';
19
16
  import { SourceNode } from 'source-map';
20
- import type { SGAttribute } from './parser/SGTypes';
17
+ import { SGAttribute } from './parser/SGTypes';
18
+ import type { BscType } from './types/BscType';
19
+ import { FunctionType } from './types/FunctionType';
21
20
  export declare class Util {
22
21
  clearConsole(): void;
23
22
  /**
@@ -62,12 +61,11 @@ export declare class Util {
62
61
  */
63
62
  loadConfigFile(configFilePath: string, parentProjectPaths?: string[], cwd?: string): BsConfig;
64
63
  /**
65
- * Relative paths to scripts in plugins should be resolved relatively to the bsconfig file
66
- * and de-duplicated
67
- * @param config Parsed configuration
68
- * @param configFilePath Path of the configuration file
64
+ * Convert relative paths to absolute paths, relative to the given directory. Also de-dupes the paths. Modifies the array in-place
65
+ * @param paths the list of paths to be resolved and deduped
66
+ * @param relativeDir the path to the folder where the paths should be resolved relative to. This should be an absolute path
69
67
  */
70
- resolvePluginPaths(config: BsConfig, configFilePath: string): void;
68
+ resolvePathsRelativeTo(collection: any, key: string, relativeDir: string): void;
71
69
  /**
72
70
  * Do work within the scope of a changed current working directory
73
71
  * @param targetCwd
@@ -258,6 +256,13 @@ export declare class Util {
258
256
  * Create a `Range` from two `Position`s
259
257
  */
260
258
  createRangeFromPositions(startPosition: Position, endPosition: Position): Range;
259
+ /**
260
+ * Given a list of ranges, create a range that starts with the first non-null lefthand range, and ends with the first non-null
261
+ * righthand range. Returns undefined if none of the items have a range.
262
+ */
263
+ createBoundingRange(...locatables: Array<{
264
+ range?: Range;
265
+ }>): Range;
261
266
  /**
262
267
  * Create a `Position` object. Prefer this over `Position.create` for performance reasons
263
268
  */
@@ -272,7 +277,7 @@ export declare class Util {
272
277
  /**
273
278
  * Convert a token into a BscType
274
279
  */
275
- tokenToBscType(token: Token, allowCustomType?: boolean): DynamicType | ObjectType | CustomType | BooleanType | DoubleType | FloatType | FunctionType | IntegerType | InvalidType | LongIntegerType | StringType | VoidType;
280
+ tokenToBscType(token: Token, allowBrighterscriptTypes?: boolean, currentNamespaceName?: NamespacedVariableNameExpression): DynamicType | BscType | FloatType | IntegerType | DoubleType | LongIntegerType | StringType | BooleanType | FunctionType | InvalidType | VoidType;
276
281
  /**
277
282
  * Get the extension for the given file path. Basically the part after the final dot, except for
278
283
  * `d.bs` which is treated as single extension
@@ -294,14 +299,26 @@ export declare class Util {
294
299
  */
295
300
  simpleMap(source: string, src: string): SourceNode;
296
301
  /**
297
- * Creates a new SGAttribute object, but keeps the existing Range references (since those shouldn't ever get changed directly)
302
+ * Creates a new SGAttribute object, but keeps the existing Range references (since those should be immutable)
298
303
  */
299
304
  cloneSGAttribute(attr: SGAttribute, value: string): SGAttribute;
305
+ /**
306
+ * Shorthand for creating a new source node
307
+ */
308
+ sourceNode(source: string, locatable: {
309
+ range: Range;
310
+ }, code: string | SourceNode | TranspileResult): SourceNode | undefined;
300
311
  /**
301
312
  * Remove leading simple protocols from a path (if present)
302
313
  */
303
314
  removeProtocol(pkgPath: string): string;
315
+ /**
316
+ * Converts a path into a standardized format (drive letter to lower, remove extra slashes, use single slash type, resolve relative parts, etc...)
317
+ */
304
318
  standardizePath(thePath: string): string;
319
+ /**
320
+ * Copy the version of bslib from local node_modules to the staging folder
321
+ */
305
322
  copyBslibToStaging(stagingDir: string): Promise<void>;
306
323
  /**
307
324
  * Given a Diagnostic or BsDiagnostic, return a copy of the diagnostic
@@ -318,11 +335,60 @@ export declare class Util {
318
335
  source: string;
319
336
  };
320
337
  /**
321
- * Finds the array of callables from a container map, taking into account the function from which it was called
338
+ * Gets the minimum and maximum number of allowed params
339
+ * @param params The list of callable parameters to check
340
+ * @returns the minimum and maximum number of allowed params
341
+ */
342
+ getMinMaxParamCount(params: CallableParam[]): MinMax;
343
+ /**
344
+ * Gets the minimum and maximum number of allowed params for ALL functions with the name of the function call
345
+ * @param callablesByLowerName The map of callable containers
346
+ * @param expCall function call expression to use for the name
347
+ * @returns the minimum and maximum number of allowed params
348
+ */
349
+ getMinMaxParamCountByFunctionCall(callablesByLowerName: CallableContainerMap, expCall: FunctionCall): MinMax;
350
+ /**
351
+ * Finds the array of callables from a container map, based on the name of the function call
322
352
  * If the callable was called in a function in a namespace, functions in that namespace are preferred
353
+ * @param callablesByLowerName The map of callable containers
354
+ * @param expCall function call expression to use for the name
323
355
  * @return an array with callable containers - could be empty if nothing was found
324
356
  */
325
- getCallableContainersFromContainerMapByFunctionCall(callablesByLowerName: CallableContainerMap, expCall: FunctionCall): CallableContainer[];
357
+ getCallableContainersByName(callablesByLowerName: CallableContainerMap, expCall: FunctionCall): CallableContainer[];
358
+ /**
359
+ * Sort an array of objects that have a Range
360
+ */
361
+ sortByRange(locatables: Locatable[]): Locatable[];
362
+ /**
363
+ * Split the given text and return ranges for each chunk.
364
+ * Only works for single-line strings
365
+ */
366
+ splitGetRange(separator: string, text: string, range: Range): {
367
+ text: string;
368
+ range: Range;
369
+ }[];
370
+ mdFence(code: string, language?: string): string;
371
+ /**
372
+ * Finds a callable from a container map based on the name AND number of arguments
373
+ * If the callable was called in a function in a namespace, functions in that namespace are preferred
374
+ * The first callable that matches the name AND will accept the number of arguments given is returned
375
+ * @return a callable containers that matches the call
376
+ */
377
+ getCallableContainerByFunctionCall(callablesByLowerName: CallableContainerMap, expCall: FunctionCall): CallableContainer;
378
+ /**
379
+ * Gets each part of the dotted get.
380
+ * @param expression
381
+ * @returns an array of the parts of the dotted get. If not fully a dotted get, then returns undefined
382
+ */
383
+ getAllDottedGetParts(expression: Expression): string[] | undefined;
384
+ /**
385
+ * Returns an integer if valid, or undefined. Eliminates checking for NaN
386
+ */
387
+ parseInt(value: any): number;
388
+ /**
389
+ * Converts a range to a string in the format 1:2-3:4
390
+ */
391
+ rangeToString(range: Range): string;
326
392
  }
327
393
  /**
328
394
  * A tagged template literal function for standardizing the path. This has to be defined as standalone function since it's a tagged template literal function,
@@ -331,3 +397,8 @@ export declare class Util {
331
397
  export declare function standardizePath(stringParts: any, ...expressions: any[]): string;
332
398
  export declare let util: Util;
333
399
  export default util;
400
+ export interface MinMax {
401
+ min: number;
402
+ max: number;
403
+ }
404
+ export declare const MAX_PARAM_COUNT = 32;