brighterscript 1.0.0-alpha.2 → 1.0.0-alpha.22

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 (388) hide show
  1. package/CHANGELOG.md +643 -253
  2. package/README.md +33 -9
  3. package/bsconfig.schema.json +22 -2
  4. package/dist/BsConfig.d.ts +9 -0
  5. package/dist/Cache.d.ts +5 -6
  6. package/dist/Cache.js +12 -11
  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.d.ts +2 -2
  15. package/dist/DependencyGraph.js +20 -7
  16. package/dist/DependencyGraph.js.map +1 -1
  17. package/dist/DiagnosticCollection.d.ts +3 -3
  18. package/dist/DiagnosticCollection.js +11 -11
  19. package/dist/DiagnosticCollection.js.map +1 -1
  20. package/dist/DiagnosticFilterer.js +5 -4
  21. package/dist/DiagnosticFilterer.js.map +1 -1
  22. package/dist/DiagnosticMessages.d.ts +59 -4
  23. package/dist/DiagnosticMessages.js +65 -7
  24. package/dist/DiagnosticMessages.js.map +1 -1
  25. package/dist/LanguageServer.d.ts +51 -39
  26. package/dist/LanguageServer.js +316 -232
  27. package/dist/LanguageServer.js.map +1 -1
  28. package/dist/Logger.d.ts +2 -0
  29. package/dist/Logger.js +10 -8
  30. package/dist/Logger.js.map +1 -1
  31. package/dist/PluginInterface.d.ts +7 -3
  32. package/dist/PluginInterface.js +9 -0
  33. package/dist/PluginInterface.js.map +1 -1
  34. package/dist/Program.d.ts +43 -25
  35. package/dist/Program.js +212 -95
  36. package/dist/Program.js.map +1 -1
  37. package/dist/ProgramBuilder.d.ts +4 -0
  38. package/dist/ProgramBuilder.js +36 -20
  39. package/dist/ProgramBuilder.js.map +1 -1
  40. package/dist/Scope.d.ts +126 -29
  41. package/dist/Scope.js +433 -156
  42. package/dist/Scope.js.map +1 -1
  43. package/dist/SemanticTokenUtils.d.ts +14 -0
  44. package/dist/SemanticTokenUtils.js +81 -0
  45. package/dist/SemanticTokenUtils.js.map +1 -0
  46. package/dist/SymbolTable.d.ts +10 -4
  47. package/dist/SymbolTable.js +55 -13
  48. package/dist/SymbolTable.js.map +1 -1
  49. package/dist/XmlScope.d.ts +7 -2
  50. package/dist/XmlScope.js +65 -27
  51. package/dist/XmlScope.js.map +1 -1
  52. package/dist/astUtils/AstEditor.d.ts +65 -0
  53. package/dist/astUtils/AstEditor.js +239 -0
  54. package/dist/astUtils/AstEditor.js.map +1 -0
  55. package/dist/{types/FunctionType.spec.d.ts → astUtils/AstEditor.spec.d.ts} +0 -0
  56. package/dist/astUtils/AstEditor.spec.js +254 -0
  57. package/dist/astUtils/AstEditor.spec.js.map +1 -0
  58. package/dist/astUtils/creators.d.ts +28 -6
  59. package/dist/astUtils/creators.js +137 -19
  60. package/dist/astUtils/creators.js.map +1 -1
  61. package/dist/astUtils/creators.spec.js +14 -4
  62. package/dist/astUtils/creators.spec.js.map +1 -1
  63. package/dist/astUtils/reflection.d.ts +32 -10
  64. package/dist/astUtils/reflection.js +82 -7
  65. package/dist/astUtils/reflection.js.map +1 -1
  66. package/dist/astUtils/reflection.spec.js +130 -119
  67. package/dist/astUtils/reflection.spec.js.map +1 -1
  68. package/dist/astUtils/stackedVisitor.js.map +1 -1
  69. package/dist/astUtils/stackedVisitor.spec.js +13 -13
  70. package/dist/astUtils/stackedVisitor.spec.js.map +1 -1
  71. package/dist/astUtils/visitors.d.ts +76 -51
  72. package/dist/astUtils/visitors.js +31 -11
  73. package/dist/astUtils/visitors.js.map +1 -1
  74. package/dist/astUtils/visitors.spec.js +126 -32
  75. package/dist/astUtils/visitors.spec.js.map +1 -1
  76. package/dist/astUtils/xml.d.ts +4 -3
  77. package/dist/astUtils/xml.js +8 -3
  78. package/dist/astUtils/xml.js.map +1 -1
  79. package/dist/bscPlugin/BscPlugin.d.ts +7 -1
  80. package/dist/bscPlugin/BscPlugin.js +28 -0
  81. package/dist/bscPlugin/BscPlugin.js.map +1 -1
  82. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +4 -4
  83. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
  84. package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js +26 -26
  85. package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js.map +1 -1
  86. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.d.ts +9 -0
  87. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +108 -0
  88. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -0
  89. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.d.ts +1 -0
  90. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js +130 -0
  91. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js.map +1 -0
  92. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.d.ts +8 -0
  93. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js +52 -0
  94. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js.map +1 -0
  95. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.d.ts +1 -0
  96. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js +32 -0
  97. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js.map +1 -0
  98. package/dist/bscPlugin/validation/BrsFileValidator.d.ts +9 -0
  99. package/dist/bscPlugin/validation/BrsFileValidator.js +66 -0
  100. package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -0
  101. package/dist/bscPlugin/validation/ScopeValidator.d.ts +29 -0
  102. package/dist/bscPlugin/validation/ScopeValidator.js +183 -0
  103. package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -0
  104. package/dist/cli.js +10 -3
  105. package/dist/cli.js.map +1 -1
  106. package/dist/diagnosticUtils.d.ts +1 -0
  107. package/dist/diagnosticUtils.js +15 -8
  108. package/dist/diagnosticUtils.js.map +1 -1
  109. package/dist/examples/plugins/removePrint.js +12 -14
  110. package/dist/examples/plugins/removePrint.js.map +1 -1
  111. package/dist/files/BrsFile.Class.spec.js +717 -147
  112. package/dist/files/BrsFile.Class.spec.js.map +1 -1
  113. package/dist/files/BrsFile.d.ts +70 -30
  114. package/dist/files/BrsFile.js +719 -353
  115. package/dist/files/BrsFile.js.map +1 -1
  116. package/dist/files/BrsFile.spec.js +1238 -449
  117. package/dist/files/BrsFile.spec.js.map +1 -1
  118. package/dist/files/XmlFile.d.ts +6 -5
  119. package/dist/files/XmlFile.js +38 -30
  120. package/dist/files/XmlFile.js.map +1 -1
  121. package/dist/files/XmlFile.spec.js +302 -237
  122. package/dist/files/XmlFile.spec.js.map +1 -1
  123. package/dist/files/tests/imports.spec.js +44 -42
  124. package/dist/files/tests/imports.spec.js.map +1 -1
  125. package/dist/files/tests/optionalChaning.spec.d.ts +1 -0
  126. package/dist/files/tests/optionalChaning.spec.js +88 -0
  127. package/dist/files/tests/optionalChaning.spec.js.map +1 -0
  128. package/dist/globalCallables.d.ts +3 -1
  129. package/dist/globalCallables.js +424 -152
  130. package/dist/globalCallables.js.map +1 -1
  131. package/dist/index.d.ts +13 -3
  132. package/dist/index.js +28 -5
  133. package/dist/index.js.map +1 -1
  134. package/dist/interfaces.d.ts +133 -16
  135. package/dist/lexer/Lexer.d.ts +19 -1
  136. package/dist/lexer/Lexer.js +127 -21
  137. package/dist/lexer/Lexer.js.map +1 -1
  138. package/dist/lexer/Lexer.spec.js +657 -536
  139. package/dist/lexer/Lexer.spec.js.map +1 -1
  140. package/dist/lexer/Token.d.ts +2 -2
  141. package/dist/lexer/TokenKind.d.ts +13 -1
  142. package/dist/lexer/TokenKind.js +60 -3
  143. package/dist/lexer/TokenKind.js.map +1 -1
  144. package/dist/parser/BrsTranspileState.d.ts +9 -0
  145. package/dist/parser/BrsTranspileState.js +14 -0
  146. package/dist/parser/BrsTranspileState.js.map +1 -1
  147. package/dist/parser/Expression.d.ts +150 -34
  148. package/dist/parser/Expression.js +335 -165
  149. package/dist/parser/Expression.js.map +1 -1
  150. package/dist/parser/Parser.Class.spec.js +189 -89
  151. package/dist/parser/Parser.Class.spec.js.map +1 -1
  152. package/dist/parser/Parser.d.ts +153 -30
  153. package/dist/parser/Parser.js +1100 -503
  154. package/dist/parser/Parser.js.map +1 -1
  155. package/dist/parser/Parser.spec.js +687 -266
  156. package/dist/parser/Parser.spec.js.map +1 -1
  157. package/dist/parser/SGParser.d.ts +41 -4
  158. package/dist/parser/SGParser.js +186 -175
  159. package/dist/parser/SGParser.js.map +1 -1
  160. package/dist/parser/SGParser.spec.js +35 -22
  161. package/dist/parser/SGParser.spec.js.map +1 -1
  162. package/dist/parser/SGTypes.d.ts +206 -38
  163. package/dist/parser/SGTypes.js +470 -161
  164. package/dist/parser/SGTypes.js.map +1 -1
  165. package/dist/parser/SGTypes.spec.d.ts +1 -0
  166. package/dist/parser/SGTypes.spec.js +351 -0
  167. package/dist/parser/SGTypes.spec.js.map +1 -0
  168. package/dist/parser/Statement.d.ts +202 -48
  169. package/dist/parser/Statement.js +648 -193
  170. package/dist/parser/Statement.js.map +1 -1
  171. package/dist/parser/Statement.spec.js +11 -11
  172. package/dist/parser/Statement.spec.js.map +1 -1
  173. package/dist/parser/TranspileState.d.ts +1 -1
  174. package/dist/parser/TranspileState.js +15 -7
  175. package/dist/parser/TranspileState.js.map +1 -1
  176. package/dist/parser/tests/Parser.spec.d.ts +10 -9
  177. package/dist/parser/tests/Parser.spec.js +15 -11
  178. package/dist/parser/tests/Parser.spec.js.map +1 -1
  179. package/dist/parser/tests/controlFlow/For.spec.js +60 -60
  180. package/dist/parser/tests/controlFlow/For.spec.js.map +1 -1
  181. package/dist/parser/tests/controlFlow/ForEach.spec.js +40 -39
  182. package/dist/parser/tests/controlFlow/ForEach.spec.js.map +1 -1
  183. package/dist/parser/tests/controlFlow/If.spec.js +213 -194
  184. package/dist/parser/tests/controlFlow/If.spec.js.map +1 -1
  185. package/dist/parser/tests/controlFlow/While.spec.js +37 -37
  186. package/dist/parser/tests/controlFlow/While.spec.js.map +1 -1
  187. package/dist/parser/tests/expression/Additive.spec.js +30 -30
  188. package/dist/parser/tests/expression/Additive.spec.js.map +1 -1
  189. package/dist/parser/tests/expression/ArrayLiterals.spec.js +119 -119
  190. package/dist/parser/tests/expression/ArrayLiterals.spec.js.map +1 -1
  191. package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js +162 -138
  192. package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js.map +1 -1
  193. package/dist/parser/tests/expression/Boolean.spec.js +24 -24
  194. package/dist/parser/tests/expression/Boolean.spec.js.map +1 -1
  195. package/dist/parser/tests/expression/Call.spec.js +41 -40
  196. package/dist/parser/tests/expression/Call.spec.js.map +1 -1
  197. package/dist/parser/tests/expression/Exponential.spec.js +17 -17
  198. package/dist/parser/tests/expression/Exponential.spec.js.map +1 -1
  199. package/dist/parser/tests/expression/Function.spec.js +256 -256
  200. package/dist/parser/tests/expression/Function.spec.js.map +1 -1
  201. package/dist/parser/tests/expression/Indexing.spec.js +87 -87
  202. package/dist/parser/tests/expression/Indexing.spec.js.map +1 -1
  203. package/dist/parser/tests/expression/Multiplicative.spec.js +37 -37
  204. package/dist/parser/tests/expression/Multiplicative.spec.js.map +1 -1
  205. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +75 -63
  206. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +1 -1
  207. package/dist/parser/tests/expression/PrefixUnary.spec.js +41 -41
  208. package/dist/parser/tests/expression/PrefixUnary.spec.js.map +1 -1
  209. package/dist/parser/tests/expression/Primary.spec.js +41 -41
  210. package/dist/parser/tests/expression/Primary.spec.js.map +1 -1
  211. package/dist/parser/tests/expression/RegexLiteralExpression.spec.d.ts +1 -0
  212. package/dist/parser/tests/expression/RegexLiteralExpression.spec.js +171 -0
  213. package/dist/parser/tests/expression/RegexLiteralExpression.spec.js.map +1 -0
  214. package/dist/parser/tests/expression/Relational.spec.js +43 -43
  215. package/dist/parser/tests/expression/Relational.spec.js.map +1 -1
  216. package/dist/parser/tests/expression/SourceLiteralExpression.spec.js +9 -9
  217. package/dist/parser/tests/expression/SourceLiteralExpression.spec.js.map +1 -1
  218. package/dist/parser/tests/expression/TemplateStringExpression.spec.js +28 -28
  219. package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +1 -1
  220. package/dist/parser/tests/expression/TernaryExpression.spec.js +102 -102
  221. package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
  222. package/dist/parser/tests/statement/AssignmentOperators.spec.js +36 -36
  223. package/dist/parser/tests/statement/AssignmentOperators.spec.js.map +1 -1
  224. package/dist/parser/tests/statement/Declaration.spec.js +44 -44
  225. package/dist/parser/tests/statement/Declaration.spec.js.map +1 -1
  226. package/dist/parser/tests/statement/Dim.spec.js +21 -21
  227. package/dist/parser/tests/statement/Dim.spec.js.map +1 -1
  228. package/dist/parser/tests/statement/Enum.spec.d.ts +1 -0
  229. package/dist/parser/tests/statement/Enum.spec.js +840 -0
  230. package/dist/parser/tests/statement/Enum.spec.js.map +1 -0
  231. package/dist/parser/tests/statement/For.spec.d.ts +1 -0
  232. package/dist/parser/tests/statement/For.spec.js +46 -0
  233. package/dist/parser/tests/statement/For.spec.js.map +1 -0
  234. package/dist/parser/tests/statement/ForEach.spec.d.ts +1 -0
  235. package/dist/parser/tests/statement/ForEach.spec.js +37 -0
  236. package/dist/parser/tests/statement/ForEach.spec.js.map +1 -0
  237. package/dist/parser/tests/statement/Function.spec.js +198 -197
  238. package/dist/parser/tests/statement/Function.spec.js.map +1 -1
  239. package/dist/parser/tests/statement/Goto.spec.js +15 -14
  240. package/dist/parser/tests/statement/Goto.spec.js.map +1 -1
  241. package/dist/parser/tests/statement/Increment.spec.js +50 -50
  242. package/dist/parser/tests/statement/Increment.spec.js.map +1 -1
  243. package/dist/parser/tests/statement/InterfaceStatement.spec.d.ts +1 -0
  244. package/dist/parser/tests/statement/InterfaceStatement.spec.js +254 -0
  245. package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +1 -0
  246. package/dist/parser/tests/statement/LibraryStatement.spec.js +17 -17
  247. package/dist/parser/tests/statement/LibraryStatement.spec.js.map +1 -1
  248. package/dist/parser/tests/statement/Misc.spec.js +108 -106
  249. package/dist/parser/tests/statement/Misc.spec.js.map +1 -1
  250. package/dist/parser/tests/statement/PrintStatement.spec.js +40 -40
  251. package/dist/parser/tests/statement/PrintStatement.spec.js.map +1 -1
  252. package/dist/parser/tests/statement/ReturnStatement.spec.js +46 -46
  253. package/dist/parser/tests/statement/ReturnStatement.spec.js.map +1 -1
  254. package/dist/parser/tests/statement/Set.spec.js +83 -83
  255. package/dist/parser/tests/statement/Set.spec.js.map +1 -1
  256. package/dist/parser/tests/statement/Stop.spec.js +12 -11
  257. package/dist/parser/tests/statement/Stop.spec.js.map +1 -1
  258. package/dist/parser/tests/statement/Throw.spec.js +5 -5
  259. package/dist/parser/tests/statement/Throw.spec.js.map +1 -1
  260. package/dist/parser/tests/statement/TryCatch.spec.js +15 -13
  261. package/dist/parser/tests/statement/TryCatch.spec.js.map +1 -1
  262. package/dist/preprocessor/Chunk.d.ts +1 -1
  263. package/dist/preprocessor/Chunk.js.map +1 -1
  264. package/dist/preprocessor/Manifest.d.ts +5 -5
  265. package/dist/preprocessor/Manifest.js +14 -35
  266. package/dist/preprocessor/Manifest.js.map +1 -1
  267. package/dist/preprocessor/Manifest.spec.d.ts +1 -0
  268. package/dist/preprocessor/Manifest.spec.js +78 -103
  269. package/dist/preprocessor/Manifest.spec.js.map +1 -1
  270. package/dist/preprocessor/Preprocessor.d.ts +1 -1
  271. package/dist/preprocessor/Preprocessor.js +8 -8
  272. package/dist/preprocessor/Preprocessor.js.map +1 -1
  273. package/dist/preprocessor/Preprocessor.spec.js +49 -49
  274. package/dist/preprocessor/Preprocessor.spec.js.map +1 -1
  275. package/dist/preprocessor/PreprocessorParser.spec.js +72 -72
  276. package/dist/preprocessor/PreprocessorParser.spec.js.map +1 -1
  277. package/dist/roku-types/data.json +21891 -0
  278. package/dist/roku-types/index.d.ts +6776 -0
  279. package/dist/roku-types/index.js +11 -0
  280. package/dist/roku-types/index.js.map +1 -0
  281. package/dist/types/ArrayType.d.ts +8 -5
  282. package/dist/types/ArrayType.js +52 -12
  283. package/dist/types/ArrayType.js.map +1 -1
  284. package/dist/types/ArrayType.spec.js +72 -11
  285. package/dist/types/ArrayType.spec.js.map +1 -1
  286. package/dist/types/BooleanType.d.ts +4 -2
  287. package/dist/types/BooleanType.js +9 -4
  288. package/dist/types/BooleanType.js.map +1 -1
  289. package/dist/types/BooleanType.spec.js +5 -3
  290. package/dist/types/BooleanType.spec.js.map +1 -1
  291. package/dist/types/BscType.d.ts +20 -5
  292. package/dist/types/BscType.js +24 -0
  293. package/dist/types/BscType.js.map +1 -1
  294. package/dist/types/CustomType.d.ts +8 -6
  295. package/dist/types/CustomType.js +20 -11
  296. package/dist/types/CustomType.js.map +1 -1
  297. package/dist/types/DoubleType.d.ts +2 -0
  298. package/dist/types/DoubleType.js +14 -9
  299. package/dist/types/DoubleType.js.map +1 -1
  300. package/dist/types/DoubleType.spec.js +5 -3
  301. package/dist/types/DoubleType.spec.js.map +1 -1
  302. package/dist/types/DynamicType.d.ts +2 -0
  303. package/dist/types/DynamicType.js +6 -2
  304. package/dist/types/DynamicType.js.map +1 -1
  305. package/dist/types/DynamicType.spec.js +2 -2
  306. package/dist/types/DynamicType.spec.js.map +1 -1
  307. package/dist/types/EnumType.d.ts +22 -0
  308. package/dist/types/EnumType.js +55 -0
  309. package/dist/types/EnumType.js.map +1 -0
  310. package/dist/types/FloatType.d.ts +2 -0
  311. package/dist/types/FloatType.js +14 -9
  312. package/dist/types/FloatType.js.map +1 -1
  313. package/dist/types/FloatType.spec.js +4 -2
  314. package/dist/types/FloatType.spec.js.map +1 -1
  315. package/dist/types/FunctionType.d.ts +7 -31
  316. package/dist/types/FunctionType.js +11 -57
  317. package/dist/types/FunctionType.js.map +1 -1
  318. package/dist/types/IntegerType.d.ts +2 -0
  319. package/dist/types/IntegerType.js +14 -9
  320. package/dist/types/IntegerType.js.map +1 -1
  321. package/dist/types/IntegerType.spec.js +5 -3
  322. package/dist/types/IntegerType.spec.js.map +1 -1
  323. package/dist/types/InterfaceType.d.ts +13 -4
  324. package/dist/types/InterfaceType.js +48 -8
  325. package/dist/types/InterfaceType.js.map +1 -1
  326. package/dist/types/InterfaceType.spec.d.ts +1 -0
  327. package/dist/types/InterfaceType.spec.js +194 -0
  328. package/dist/types/InterfaceType.spec.js.map +1 -0
  329. package/dist/types/InvalidType.d.ts +4 -2
  330. package/dist/types/InvalidType.js +10 -5
  331. package/dist/types/InvalidType.js.map +1 -1
  332. package/dist/types/InvalidType.spec.js +4 -2
  333. package/dist/types/InvalidType.spec.js.map +1 -1
  334. package/dist/types/LazyType.d.ts +8 -7
  335. package/dist/types/LazyType.js +22 -10
  336. package/dist/types/LazyType.js.map +1 -1
  337. package/dist/types/LongIntegerType.d.ts +2 -0
  338. package/dist/types/LongIntegerType.js +14 -9
  339. package/dist/types/LongIntegerType.js.map +1 -1
  340. package/dist/types/LongIntegerType.spec.js +4 -2
  341. package/dist/types/LongIntegerType.spec.js.map +1 -1
  342. package/dist/types/ObjectType.d.ts +8 -4
  343. package/dist/types/ObjectType.js +9 -4
  344. package/dist/types/ObjectType.js.map +1 -1
  345. package/dist/types/ObjectType.spec.js +2 -2
  346. package/dist/types/ObjectType.spec.js.map +1 -1
  347. package/dist/types/StringType.d.ts +4 -2
  348. package/dist/types/StringType.js +9 -4
  349. package/dist/types/StringType.js.map +1 -1
  350. package/dist/types/StringType.spec.js +4 -2
  351. package/dist/types/StringType.spec.js.map +1 -1
  352. package/dist/types/TypedFunctionType.d.ts +28 -0
  353. package/dist/types/TypedFunctionType.js +88 -0
  354. package/dist/types/TypedFunctionType.js.map +1 -0
  355. package/dist/types/TypedFunctionType.spec.d.ts +1 -0
  356. package/dist/types/TypedFunctionType.spec.js +37 -0
  357. package/dist/types/TypedFunctionType.spec.js.map +1 -0
  358. package/dist/types/UninitializedType.js +3 -3
  359. package/dist/types/UninitializedType.js.map +1 -1
  360. package/dist/types/VoidType.d.ts +4 -2
  361. package/dist/types/VoidType.js +8 -4
  362. package/dist/types/VoidType.js.map +1 -1
  363. package/dist/types/VoidType.spec.js +2 -2
  364. package/dist/types/VoidType.spec.js.map +1 -1
  365. package/dist/types/helpers.d.ts +42 -0
  366. package/dist/types/helpers.js +118 -0
  367. package/dist/types/helpers.js.map +1 -0
  368. package/dist/util.d.ts +91 -21
  369. package/dist/util.js +364 -114
  370. package/dist/util.js.map +1 -1
  371. package/dist/validators/ClassValidator.d.ts +19 -2
  372. package/dist/validators/ClassValidator.js +164 -103
  373. package/dist/validators/ClassValidator.js.map +1 -1
  374. package/package.json +30 -19
  375. package/dist/astUtils/index.d.ts +0 -7
  376. package/dist/astUtils/index.js +0 -26
  377. package/dist/astUtils/index.js.map +0 -1
  378. package/dist/lexer/index.d.ts +0 -3
  379. package/dist/lexer/index.js +0 -17
  380. package/dist/lexer/index.js.map +0 -1
  381. package/dist/parser/index.d.ts +0 -3
  382. package/dist/parser/index.js +0 -16
  383. package/dist/parser/index.js.map +0 -1
  384. package/dist/preprocessor/index.d.ts +0 -3
  385. package/dist/preprocessor/index.js +0 -16
  386. package/dist/preprocessor/index.js.map +0 -1
  387. package/dist/types/FunctionType.spec.js +0 -23
  388. package/dist/types/FunctionType.spec.js.map +0 -1
@@ -6,7 +6,7 @@ const ArrayType_1 = require("./types/ArrayType");
6
6
  const BooleanType_1 = require("./types/BooleanType");
7
7
  const DynamicType_1 = require("./types/DynamicType");
8
8
  const FloatType_1 = require("./types/FloatType");
9
- const FunctionType_1 = require("./types/FunctionType");
9
+ const TypedFunctionType_1 = require("./types/TypedFunctionType");
10
10
  const IntegerType_1 = require("./types/IntegerType");
11
11
  const ObjectType_1 = require("./types/ObjectType");
12
12
  const StringType_1 = require("./types/StringType");
@@ -17,166 +17,184 @@ exports.globalFile.parse('');
17
17
  let mathFunctions = [{
18
18
  name: 'Abs',
19
19
  shortDescription: 'Returns the absolute value of the argument.',
20
- type: new FunctionType_1.FunctionType(new FloatType_1.FloatType()),
20
+ type: new TypedFunctionType_1.TypedFunctionType(new FloatType_1.FloatType()),
21
21
  file: exports.globalFile,
22
22
  params: [{
23
23
  name: 'x',
24
- type: new FloatType_1.FloatType()
24
+ type: new FloatType_1.FloatType(),
25
+ isOptional: false
25
26
  }]
26
27
  }, {
27
28
  name: 'Atn',
28
29
  shortDescription: 'Returns the arctangent (in radians) of the argument.',
29
30
  documentation: '`ATN(X)` returns "the angle whose tangent is X". To get arctangent in degrees, multiply `ATN(X)` by `57.29578`.',
30
- type: new FunctionType_1.FunctionType(new FloatType_1.FloatType()),
31
+ type: new TypedFunctionType_1.TypedFunctionType(new FloatType_1.FloatType()),
31
32
  file: exports.globalFile,
32
33
  params: [{
33
34
  name: 'x',
34
- type: new FloatType_1.FloatType()
35
+ type: new FloatType_1.FloatType(),
36
+ isOptional: false
35
37
  }]
36
38
  }, {
37
39
  name: 'Cdbl',
38
40
  shortDescription: 'Returns a single precision float representation of the argument. Someday may return double.',
39
- type: new FunctionType_1.FunctionType(new FloatType_1.FloatType()),
41
+ type: new TypedFunctionType_1.TypedFunctionType(new FloatType_1.FloatType()),
40
42
  file: exports.globalFile,
41
43
  params: [{
42
44
  name: 'x',
43
- type: new IntegerType_1.IntegerType()
45
+ type: new IntegerType_1.IntegerType(),
46
+ isOptional: false
44
47
  }]
45
48
  }, {
46
49
  name: 'Cint',
47
50
  shortDescription: 'Returns an integer representation of the argument, rounding up from midpoints. CINT(2.1) returns 2; CINT(2.5) returns 3; CINT(-2.2) returns -2; CINT(-2.5) returns -2; CINT(-2.6) returns -3.',
48
- type: new FunctionType_1.FunctionType(new IntegerType_1.IntegerType()),
51
+ type: new TypedFunctionType_1.TypedFunctionType(new IntegerType_1.IntegerType()),
49
52
  file: exports.globalFile,
50
53
  params: [{
51
54
  name: 'x',
52
- type: new FloatType_1.FloatType()
55
+ type: new FloatType_1.FloatType(),
56
+ isOptional: false
53
57
  }]
54
58
  }, {
55
59
  name: 'Cos',
56
60
  shortDescription: 'Returns the cosine of the argument (argument must be in radians). To obtain the cosine of X when X is in degrees, use CGS(X*.01745329).',
57
- type: new FunctionType_1.FunctionType(new FloatType_1.FloatType()),
61
+ type: new TypedFunctionType_1.TypedFunctionType(new FloatType_1.FloatType()),
58
62
  file: exports.globalFile,
59
63
  params: [{
60
64
  name: 'x',
61
- type: new FloatType_1.FloatType()
65
+ type: new FloatType_1.FloatType(),
66
+ isOptional: false
62
67
  }]
63
68
  }, {
64
69
  name: 'Csng',
65
70
  shortDescription: 'Returns a single-precision float representation of the argument.',
66
- type: new FunctionType_1.FunctionType(new FloatType_1.FloatType()),
71
+ type: new TypedFunctionType_1.TypedFunctionType(new FloatType_1.FloatType()),
67
72
  file: exports.globalFile,
68
73
  params: [{
69
74
  name: 'x',
70
- type: new IntegerType_1.IntegerType()
75
+ type: new IntegerType_1.IntegerType(),
76
+ isOptional: false
71
77
  }]
72
78
  }, {
73
79
  name: 'Exp',
74
80
  shortDescription: 'Returns the "natural exponential" of X, that is, ex. This is the inverse of the LOG function, so X=EXP(LOG(X)).',
75
- type: new FunctionType_1.FunctionType(new FloatType_1.FloatType()),
81
+ type: new TypedFunctionType_1.TypedFunctionType(new FloatType_1.FloatType()),
76
82
  file: exports.globalFile,
77
83
  params: [{
78
84
  name: 'x',
79
- type: new FloatType_1.FloatType()
85
+ type: new FloatType_1.FloatType(),
86
+ isOptional: false
80
87
  }]
81
88
  }, {
82
89
  name: 'Fix',
83
90
  shortDescription: 'Returns a truncated representation of the argument. All digits to the right of the decimal point are simply chopped off, so the resultant value is an integer. For non-negative X, FIX(X)=lNT(X). For negative values of X, FIX(X)=INT(X)+1. For example, FIX(2.2) returns 2, and FIX(-2.2) returns -2.',
84
- type: new FunctionType_1.FunctionType(new IntegerType_1.IntegerType()),
91
+ type: new TypedFunctionType_1.TypedFunctionType(new IntegerType_1.IntegerType()),
85
92
  file: exports.globalFile,
86
93
  params: [{
87
94
  name: 'x',
88
- type: new FloatType_1.FloatType()
95
+ type: new FloatType_1.FloatType(),
96
+ isOptional: false
89
97
  }]
90
98
  }, {
91
99
  name: 'Int',
92
100
  shortDescription: 'Returns an integer representation of the argument, using the largest whole number that is not greater than the argument.. INT(2.5) returns 2; INT(-2.5) returns -3; and INT(1000101.23) returns 10000101.',
93
- type: new FunctionType_1.FunctionType(new IntegerType_1.IntegerType()),
101
+ type: new TypedFunctionType_1.TypedFunctionType(new IntegerType_1.IntegerType()),
94
102
  file: exports.globalFile,
95
103
  params: [{
96
104
  name: 'x',
97
- type: new FloatType_1.FloatType()
105
+ type: new FloatType_1.FloatType(),
106
+ isOptional: false
98
107
  }]
99
108
  }, {
100
109
  name: 'Log',
101
110
  shortDescription: 'Returns the natural logarithm of the argument, that is, loge(x) or ln(x). This is the inverse of the EXP function, so LOG(EXP(X)) = X. To find the logarithm of a number to another base b, use the formula logb(X) = loge(X) / loge(b). For example, LOG(32767) / LOG(2) returns the logarithm to base 2 of 32767.',
102
- type: new FunctionType_1.FunctionType(new FloatType_1.FloatType()),
111
+ type: new TypedFunctionType_1.TypedFunctionType(new FloatType_1.FloatType()),
103
112
  file: exports.globalFile,
104
113
  params: [{
105
114
  name: 'x',
106
- type: new FloatType_1.FloatType()
115
+ type: new FloatType_1.FloatType(),
116
+ isOptional: false
107
117
  }]
108
118
  }, {
109
119
  name: 'Rnd',
110
120
  shortDescription: 'Generates a pseudo-random number using the current pseudo-random "seed number" (generated internally and not accessible to user).returns an integer between 1 and integer inclusive . For example, RND(55) returns a pseudo-random integer greater than zero and less than 56.',
111
- type: new FunctionType_1.FunctionType(new IntegerType_1.IntegerType()),
121
+ type: new TypedFunctionType_1.TypedFunctionType(new IntegerType_1.IntegerType()),
112
122
  file: exports.globalFile,
113
123
  params: [{
114
124
  name: 'range',
115
- type: new IntegerType_1.IntegerType()
125
+ type: new IntegerType_1.IntegerType(),
126
+ isOptional: false
116
127
  }]
117
128
  }, {
118
129
  name: 'Rnd',
119
130
  shortDescription: 'Generates a pseudo-random number using the current pseudo-random "seed number" (generated internally and not accessible to user). Returns a float value between 0 and 1.',
120
- type: new FunctionType_1.FunctionType(new FloatType_1.FloatType()),
131
+ type: new TypedFunctionType_1.TypedFunctionType(new FloatType_1.FloatType()),
121
132
  file: exports.globalFile,
122
133
  params: [{
123
134
  name: '0',
124
- type: new IntegerType_1.IntegerType()
135
+ type: new IntegerType_1.IntegerType(),
136
+ isOptional: false
125
137
  }]
126
138
  }, {
127
139
  name: 'Sgn',
128
140
  shortDescription: 'The "sign" function: returns -1 for X negative, 0 for X zero, and +1 for X positive.',
129
- type: new FunctionType_1.FunctionType(new IntegerType_1.IntegerType()),
141
+ type: new TypedFunctionType_1.TypedFunctionType(new IntegerType_1.IntegerType()),
130
142
  file: exports.globalFile,
131
143
  params: [{
132
144
  name: 'x',
133
- type: new FloatType_1.FloatType()
145
+ type: new FloatType_1.FloatType(),
146
+ isOptional: false
134
147
  }]
135
148
  }, {
136
149
  name: 'Sgn',
137
150
  shortDescription: 'The "sign" function: returns -1 for X negative, 0 for X zero, and +1 for X positive.',
138
- type: new FunctionType_1.FunctionType(new IntegerType_1.IntegerType()),
151
+ type: new TypedFunctionType_1.TypedFunctionType(new IntegerType_1.IntegerType()),
139
152
  file: exports.globalFile,
140
153
  params: [{
141
154
  name: 'x',
142
- type: new IntegerType_1.IntegerType()
155
+ type: new IntegerType_1.IntegerType(),
156
+ isOptional: false
143
157
  }]
144
158
  }, {
145
159
  name: 'Sin',
146
160
  shortDescription: 'Returns the sine of the argument (argument must be in radians). To obtain the sine of X when X is in degrees, use SIN(X*.01745329).',
147
- type: new FunctionType_1.FunctionType(new FloatType_1.FloatType()),
161
+ type: new TypedFunctionType_1.TypedFunctionType(new FloatType_1.FloatType()),
148
162
  file: exports.globalFile,
149
163
  params: [{
150
164
  name: 'x',
151
- type: new FloatType_1.FloatType()
165
+ type: new FloatType_1.FloatType(),
166
+ isOptional: false
152
167
  }]
153
168
  }, {
154
169
  name: 'Sqr',
155
170
  shortDescription: 'Returns the square root of the argument. SQR(X) is the same as X ^ (1/2), only faster.',
156
- type: new FunctionType_1.FunctionType(new FloatType_1.FloatType()),
171
+ type: new TypedFunctionType_1.TypedFunctionType(new FloatType_1.FloatType()),
157
172
  file: exports.globalFile,
158
173
  params: [{
159
174
  name: 'x',
160
- type: new FloatType_1.FloatType()
175
+ type: new FloatType_1.FloatType(),
176
+ isOptional: false
161
177
  }]
162
178
  }, {
163
179
  name: 'Tan',
164
180
  shortDescription: 'Returns the tangent of the argument (argument must be in radians). To obtain the tangent of X when X is in degrees, use TAN(X*.01745329).',
165
- type: new FunctionType_1.FunctionType(new FloatType_1.FloatType()),
181
+ type: new TypedFunctionType_1.TypedFunctionType(new FloatType_1.FloatType()),
166
182
  file: exports.globalFile,
167
183
  params: [{
168
184
  name: 'x',
169
- type: new FloatType_1.FloatType()
185
+ type: new FloatType_1.FloatType(),
186
+ isOptional: false
170
187
  }]
171
188
  }];
172
189
  let runtimeFunctions = [{
173
190
  name: 'CreateObject',
174
191
  shortDescription: 'Creates a BrightScript Component of class classname specified. Return invalid if the object creation fails. Some Objects have optional parameters in their constructor that are passed after name.',
175
- type: new FunctionType_1.FunctionType(new ObjectType_1.ObjectType()),
192
+ type: new TypedFunctionType_1.TypedFunctionType(new ObjectType_1.ObjectType()),
176
193
  file: exports.globalFile,
177
194
  params: [{
178
195
  name: 'name',
179
- type: new StringType_1.StringType()
196
+ type: new StringType_1.StringType(),
197
+ isOptional: false
180
198
  }, {
181
199
  name: 'param2',
182
200
  type: new DynamicType_1.DynamicType(),
@@ -189,15 +207,24 @@ let runtimeFunctions = [{
189
207
  name: 'param4',
190
208
  type: new DynamicType_1.DynamicType(),
191
209
  isOptional: true
210
+ }, {
211
+ name: 'param5',
212
+ type: new DynamicType_1.DynamicType(),
213
+ isOptional: true
214
+ }, {
215
+ name: 'param6',
216
+ type: new DynamicType_1.DynamicType(),
217
+ isOptional: true
192
218
  }]
193
219
  }, {
194
220
  name: 'Type',
195
221
  shortDescription: 'Returns the type of a variable and/or object. See the BrightScript Component specification for a list of types.',
196
- type: new FunctionType_1.FunctionType(new ObjectType_1.ObjectType()),
222
+ type: new TypedFunctionType_1.TypedFunctionType(new StringType_1.StringType()),
197
223
  file: exports.globalFile,
198
224
  params: [{
199
225
  name: 'variable',
200
- type: new ObjectType_1.ObjectType()
226
+ type: new ObjectType_1.ObjectType(),
227
+ isOptional: false
201
228
  }, {
202
229
  name: 'version',
203
230
  type: new StringType_1.StringType(),
@@ -206,64 +233,70 @@ let runtimeFunctions = [{
206
233
  }, {
207
234
  name: 'GetGlobalAA',
208
235
  shortDescription: 'Each script has a global Associative Array. It can be fetched with this function. ',
209
- type: new FunctionType_1.FunctionType(new ObjectType_1.ObjectType()),
236
+ type: new TypedFunctionType_1.TypedFunctionType(new ObjectType_1.ObjectType()),
210
237
  file: exports.globalFile,
211
238
  params: []
212
239
  }, {
213
240
  name: 'Box',
214
241
  shortDescription: 'Box() will return an object version of an intrinsic type, or pass through an object if given one.',
215
- type: new FunctionType_1.FunctionType(new ObjectType_1.ObjectType()),
242
+ type: new TypedFunctionType_1.TypedFunctionType(new ObjectType_1.ObjectType()),
216
243
  file: exports.globalFile,
217
244
  params: [{
218
245
  name: 'x',
219
- type: new DynamicType_1.DynamicType()
246
+ type: new DynamicType_1.DynamicType(),
247
+ isOptional: false
220
248
  }]
221
249
  }, {
222
250
  name: 'Run',
223
251
  shortDescription: `The Run function can be used to compile and run a script dynamically.\nThe file specified by that path is compiled and run.\nArguments may be passed to the script's Main function, and that script may return a result value.'`,
224
- type: new FunctionType_1.FunctionType(new DynamicType_1.DynamicType()),
252
+ type: new TypedFunctionType_1.TypedFunctionType(new DynamicType_1.DynamicType()),
225
253
  file: exports.globalFile,
226
254
  params: [{
227
255
  name: 'filename',
228
- type: new StringType_1.StringType()
256
+ type: new StringType_1.StringType(),
257
+ isOptional: false
229
258
  }, {
230
259
  name: 'arg',
231
260
  type: new DynamicType_1.DynamicType(),
232
- isRestArgument: true
261
+ isRestArgument: true,
262
+ isOptional: false
233
263
  }]
234
264
  }, {
235
265
  name: 'Run',
236
266
  shortDescription: `The Run function can be used to compile and run a script dynamically.\nAll files specified are compiled together, then run.\nArguments may be passed to the script's Main function, and that script may return a result value.'`,
237
- type: new FunctionType_1.FunctionType(new DynamicType_1.DynamicType()),
267
+ type: new TypedFunctionType_1.TypedFunctionType(new DynamicType_1.DynamicType()),
238
268
  file: exports.globalFile,
239
269
  params: [{
240
270
  name: 'filename',
241
- type: new ArrayType_1.ArrayType(new StringType_1.StringType())
271
+ type: new ArrayType_1.ArrayType(new StringType_1.StringType()),
272
+ isOptional: false
242
273
  }, {
243
274
  name: 'arg',
244
275
  type: new DynamicType_1.DynamicType(),
245
- isRestArgument: true
276
+ isRestArgument: true,
277
+ isOptional: true
246
278
  }]
247
279
  }, {
248
280
  name: 'Eval',
249
281
  shortDescription: `Eval can be used to run a code snippet in the context of the current function. It performs a compile, and then the bytecode execution.\nIf a compilation error occurs, no bytecode execution is performed, and Eval returns an roList with one or more compile errors. Each list entry is an roAssociativeArray with ERRNO and ERRSTR keys describing the error.\nIf compilation succeeds, bytecode execution is performed and the integer runtime error code is returned. These are the same error codes as returned by GetLastRunRuntimeError().\nEval() can be usefully in two cases. The first is when you need to dynamically generate code at runtime.\nThe other is if you need to execute a statement that could result in a runtime error, but you don't want code execution to stop. '`,
250
- type: new FunctionType_1.FunctionType(new DynamicType_1.DynamicType()),
282
+ type: new TypedFunctionType_1.TypedFunctionType(new DynamicType_1.DynamicType()),
251
283
  file: exports.globalFile,
252
284
  isDeprecated: true,
253
285
  params: [{
254
286
  name: 'code',
255
- type: new StringType_1.StringType()
287
+ type: new StringType_1.StringType(),
288
+ isOptional: false
256
289
  }]
257
290
  }, {
258
291
  name: 'GetLastRunCompileError',
259
292
  shortDescription: 'Returns an roList of compile errors, or invalid if no errors. Each list entry is an roAssociativeArray with the keys: ERRNO, ERRSTR, FILESPEC, and LINENO.',
260
- type: new FunctionType_1.FunctionType(new ObjectType_1.ObjectType()),
293
+ type: new TypedFunctionType_1.TypedFunctionType(new ObjectType_1.ObjectType()),
261
294
  file: exports.globalFile,
262
295
  params: []
263
296
  }, {
264
297
  name: 'GetLastRunRuntimeError',
265
298
  shortDescription: 'Returns an error code result after the last script Run().These are normal:\\,&hFF==ERR_OKAY\\n&hFC==ERR_NORMAL_END\\n&hE2==ERR_VALUE_RETURN',
266
- type: new FunctionType_1.FunctionType(new IntegerType_1.IntegerType()),
299
+ type: new TypedFunctionType_1.TypedFunctionType(new IntegerType_1.IntegerType()),
267
300
  file: exports.globalFile,
268
301
  params: []
269
302
  }];
@@ -271,116 +304,132 @@ let globalUtilityFunctions = [
271
304
  {
272
305
  name: 'Sleep',
273
306
  shortDescription: 'This function causes the script to pause for the specified time, without wasting CPU cycles. There are 1000 milliseconds in one second.',
274
- type: new FunctionType_1.FunctionType(new VoidType_1.VoidType()),
307
+ type: new TypedFunctionType_1.TypedFunctionType(new VoidType_1.VoidType()),
275
308
  file: exports.globalFile,
276
309
  params: [{
277
310
  name: 'milliseconds',
278
- type: new IntegerType_1.IntegerType()
311
+ type: new IntegerType_1.IntegerType(),
312
+ isOptional: false
279
313
  }]
280
314
  }, {
281
315
  name: 'Wait',
282
316
  shortDescription: 'This function waits on objects that are "waitable" (those that have a MessagePort interface). Wait() returns the event object that was posted to the message port. If timeout is zero, "wait" will wait for ever. Otherwise, Wait will return after timeout milliseconds if no messages are received. In this case, Wait returns a type "invalid".',
283
- type: new FunctionType_1.FunctionType(new ObjectType_1.ObjectType()),
317
+ type: new TypedFunctionType_1.TypedFunctionType(new ObjectType_1.ObjectType()),
284
318
  file: exports.globalFile,
285
319
  params: [{
286
320
  name: 'timeout',
287
- type: new IntegerType_1.IntegerType()
321
+ type: new IntegerType_1.IntegerType(),
322
+ isOptional: false
288
323
  }, {
289
324
  name: 'port',
290
- type: new ObjectType_1.ObjectType()
325
+ type: new ObjectType_1.ObjectType(),
326
+ isOptional: false
291
327
  }]
292
328
  }, {
293
329
  name: 'GetInterface',
294
330
  shortDescription: 'Each BrightScript Component has one or more interfaces. This function returns a value of type "Interface". \nNote that generally BrightScript Components allow you to skip the interface specification. In which case, the appropriate interface within the object is used. This works as long as the function names within the interfaces are unique.',
295
- type: new FunctionType_1.FunctionType(new ObjectType_1.ObjectType()),
331
+ type: new TypedFunctionType_1.TypedFunctionType(new ObjectType_1.ObjectType()),
296
332
  file: exports.globalFile,
297
333
  params: [{
298
334
  name: 'object',
299
- type: new ObjectType_1.ObjectType()
335
+ type: new ObjectType_1.ObjectType(),
336
+ isOptional: false
300
337
  }, {
301
338
  name: 'ifname',
302
- type: new StringType_1.StringType()
339
+ type: new StringType_1.StringType(),
340
+ isOptional: false
303
341
  }]
304
342
  }, {
305
343
  name: 'FindMemberFunction',
306
344
  shortDescription: 'Returns the interface from the object that provides the specified function, or invalid if not found.',
307
- type: new FunctionType_1.FunctionType(new ObjectType_1.ObjectType()),
345
+ type: new TypedFunctionType_1.TypedFunctionType(new ObjectType_1.ObjectType()),
308
346
  file: exports.globalFile,
309
347
  params: [{
310
348
  name: 'object',
311
- type: new ObjectType_1.ObjectType()
349
+ type: new ObjectType_1.ObjectType(),
350
+ isOptional: false
312
351
  }, {
313
352
  name: 'functionName',
314
- type: new StringType_1.StringType()
353
+ type: new StringType_1.StringType(),
354
+ isOptional: false
315
355
  }]
316
356
  }, {
317
357
  name: 'UpTime',
318
358
  shortDescription: 'Returns the uptime of the system since the last reboot in seconds.',
319
- type: new FunctionType_1.FunctionType(new FloatType_1.FloatType()),
359
+ type: new TypedFunctionType_1.TypedFunctionType(new FloatType_1.FloatType()),
320
360
  file: exports.globalFile,
321
361
  params: [{
322
362
  name: 'dummy',
323
- type: new IntegerType_1.IntegerType()
363
+ type: new IntegerType_1.IntegerType(),
364
+ isOptional: false
324
365
  }]
325
366
  }, {
326
367
  name: 'RebootSystem',
327
368
  shortDescription: 'Requests the system to perform a soft reboot. The Roku platform has disabled this feature.',
328
- type: new FunctionType_1.FunctionType(new VoidType_1.VoidType()),
369
+ type: new TypedFunctionType_1.TypedFunctionType(new VoidType_1.VoidType()),
329
370
  file: exports.globalFile,
330
371
  params: []
331
372
  }, {
332
373
  name: 'ListDir',
333
374
  shortDescription: 'Returns a List object containing the contents of the directory path specified.',
334
- type: new FunctionType_1.FunctionType(new ObjectType_1.ObjectType()),
375
+ type: new TypedFunctionType_1.TypedFunctionType(new ObjectType_1.ObjectType()),
335
376
  file: exports.globalFile,
336
377
  params: [{
337
378
  name: 'path',
338
- type: new StringType_1.StringType()
379
+ type: new StringType_1.StringType(),
380
+ isOptional: false
339
381
  }]
340
382
  }, {
341
383
  name: 'ReadAsciiFile',
342
384
  shortDescription: 'This function reads the specified file and returns the data as a string.\nThe file can be encoded as either UTF-8 (which includes the 7-bit ASCII subset) or UTF-16.\nAn empty string is returned if the file can not be read.',
343
- type: new FunctionType_1.FunctionType(new StringType_1.StringType()),
385
+ type: new TypedFunctionType_1.TypedFunctionType(new StringType_1.StringType()),
344
386
  file: exports.globalFile,
345
387
  params: [{
346
388
  name: 'filePath',
347
- type: new StringType_1.StringType()
389
+ type: new StringType_1.StringType(),
390
+ isOptional: false
348
391
  }]
349
392
  }, {
350
393
  name: 'WriteAsciiFile',
351
394
  shortDescription: 'This function writes the specified string data to a file at the specified location.\nThe string data is written as UTF-8 encoded (which includes the 7-bit ASCII subset).\nThe function returns true if the file was successfully written.',
352
- type: new FunctionType_1.FunctionType(new BooleanType_1.BooleanType()),
395
+ type: new TypedFunctionType_1.TypedFunctionType(new BooleanType_1.BooleanType()),
353
396
  file: exports.globalFile,
354
397
  params: [{
355
398
  name: 'filePath',
356
- type: new StringType_1.StringType()
399
+ type: new StringType_1.StringType(),
400
+ isOptional: false
357
401
  }, {
358
402
  name: 'text',
359
- type: new StringType_1.StringType()
403
+ type: new StringType_1.StringType(),
404
+ isOptional: false
360
405
  }]
361
406
  }, {
362
407
  name: 'CopyFile',
363
408
  shortDescription: 'Make a copy of a file.',
364
- type: new FunctionType_1.FunctionType(new BooleanType_1.BooleanType()),
409
+ type: new TypedFunctionType_1.TypedFunctionType(new BooleanType_1.BooleanType()),
365
410
  file: exports.globalFile,
366
411
  params: [{
367
412
  name: 'source',
368
- type: new StringType_1.StringType()
413
+ type: new StringType_1.StringType(),
414
+ isOptional: false
369
415
  }, {
370
416
  name: 'destination',
371
- type: new StringType_1.StringType()
417
+ type: new StringType_1.StringType(),
418
+ isOptional: false
372
419
  }]
373
420
  }, {
374
421
  name: 'MoveFile',
375
422
  shortDescription: 'Rename a file.',
376
- type: new FunctionType_1.FunctionType(new BooleanType_1.BooleanType()),
423
+ type: new TypedFunctionType_1.TypedFunctionType(new BooleanType_1.BooleanType()),
377
424
  file: exports.globalFile,
378
425
  params: [{
379
426
  name: 'source',
380
- type: new StringType_1.StringType()
427
+ type: new StringType_1.StringType(),
428
+ isOptional: false
381
429
  }, {
382
430
  name: 'destination',
383
- type: new StringType_1.StringType()
431
+ type: new StringType_1.StringType(),
432
+ isOptional: false
384
433
  }]
385
434
  }, {
386
435
  name: 'MatchFiles',
@@ -395,80 +444,95 @@ A '*' matches zero or more arbitrary characters.
395
444
  The character class '[...]' matches any single character specified within the brackets. The closing bracket is treated as a member of the character class if it immediately follows the opening bracket. i.e. '[]]' matches a single close bracket. Within the class '-' can be used to specify a range unless it is the first or last character. e.g. '[A-Cf-h]' is equivalent to '[ABCfgh]'.
396
445
  A character class can be negated by specifying '^' as the first character. To match a literal '^' place it elsewhere within the class.
397
446
  The characters '?', '*' and '[' lose their special meaning if preceded by a single '\\'. A single '\\' can be matched as '\\\\'.`,
398
- type: new FunctionType_1.FunctionType(new ArrayType_1.ArrayType(new StringType_1.StringType())),
447
+ type: new TypedFunctionType_1.TypedFunctionType(new ArrayType_1.ArrayType(new StringType_1.StringType())),
399
448
  file: exports.globalFile,
400
449
  params: [{
401
450
  name: 'path',
402
- type: new StringType_1.StringType()
451
+ type: new StringType_1.StringType(),
452
+ isOptional: false
403
453
  }, {
404
454
  name: 'pattern_in',
405
- type: new StringType_1.StringType()
455
+ type: new StringType_1.StringType(),
456
+ isOptional: false
406
457
  }]
407
458
  }, {
408
459
  name: 'DeleteFile',
409
460
  shortDescription: 'Delete the specified file.',
410
- type: new FunctionType_1.FunctionType(new BooleanType_1.BooleanType()),
461
+ type: new TypedFunctionType_1.TypedFunctionType(new BooleanType_1.BooleanType()),
411
462
  file: exports.globalFile,
412
463
  params: [{
413
464
  name: 'file',
414
- type: new StringType_1.StringType()
465
+ type: new StringType_1.StringType(),
466
+ isOptional: false
415
467
  }]
416
468
  }, {
417
469
  name: 'DeleteDirectory',
418
470
  shortDescription: 'Deletes the specified directory. It is only possible to delete an empty directory.',
419
- type: new FunctionType_1.FunctionType(new BooleanType_1.BooleanType()),
471
+ type: new TypedFunctionType_1.TypedFunctionType(new BooleanType_1.BooleanType()),
420
472
  file: exports.globalFile,
421
473
  params: [{
422
474
  name: 'dir',
423
- type: new StringType_1.StringType()
475
+ type: new StringType_1.StringType(),
476
+ isOptional: false
424
477
  }]
425
478
  }, {
426
479
  name: 'CreateDirectory',
427
480
  shortDescription: 'Creates the specified Directory. Only one directory can be created at a time',
428
- type: new FunctionType_1.FunctionType(new BooleanType_1.BooleanType()),
481
+ type: new TypedFunctionType_1.TypedFunctionType(new BooleanType_1.BooleanType()),
429
482
  file: exports.globalFile,
430
483
  params: [{
431
484
  name: 'dir',
432
- type: new StringType_1.StringType()
485
+ type: new StringType_1.StringType(),
486
+ isOptional: false
433
487
  }]
434
488
  }, {
435
489
  name: 'FormatDrive',
436
490
  shortDescription: 'Formats a specified drive using the specified filesystem.',
437
- type: new FunctionType_1.FunctionType(new BooleanType_1.BooleanType()),
491
+ type: new TypedFunctionType_1.TypedFunctionType(new BooleanType_1.BooleanType()),
438
492
  file: exports.globalFile,
439
493
  params: [{
440
494
  name: 'drive',
441
- type: new StringType_1.StringType()
495
+ type: new StringType_1.StringType(),
496
+ isOptional: false
442
497
  }, {
443
498
  name: 'fs_type',
444
- type: new StringType_1.StringType()
499
+ type: new StringType_1.StringType(),
500
+ isOptional: false
445
501
  }]
446
502
  }, {
447
503
  name: 'StrToI',
448
504
  shortDescription: 'Return the integer value of the string, or 0 if nothing is parsed.',
449
- type: new FunctionType_1.FunctionType(new IntegerType_1.IntegerType()),
505
+ type: new TypedFunctionType_1.TypedFunctionType(new IntegerType_1.IntegerType()),
450
506
  file: exports.globalFile,
451
507
  params: [{
452
508
  name: 'str',
453
- type: new StringType_1.StringType()
509
+ type: new StringType_1.StringType(),
510
+ isOptional: false
454
511
  }]
455
512
  }, {
456
513
  name: 'RunGarbageCollector',
457
514
  shortDescription: `This function runs the garbage collector. It returns and Associative Array with some statistics regarding the garbage collection. \nSee the Garbage Collection section of the manual for more detail. You don't normally need to call this function.`,
458
- type: new FunctionType_1.FunctionType(new ObjectType_1.ObjectType()),
515
+ type: new TypedFunctionType_1.TypedFunctionType(new ObjectType_1.ObjectType()),
459
516
  file: exports.globalFile,
460
517
  params: []
461
518
  }, {
462
519
  name: 'ParseJson',
463
520
  shortDescription: `This function will parse a string formatted according to RFC4627 and return an equivalent BrightScript object (consisting of booleans, integer and floating point numbers, strings, roArray, and roAssociativeArray objects). If the string is not syntactically correct, Invalid will be returned. A few other things to note:
464
521
 
465
- Any roAssociativeArray objects in the returned objects will be case sensitive.
522
+ Any roAssociativeArray objects in the returned objects will be case sensitive. As of Roku OS 9.4, to return a case-insensitive structure, set the flags parameter to "i".
523
+ If the "i" option is used, and the jsonString includes multiple keys that match case-insensitively, duplicates are overwritten and only the last matching values are preserved.
466
524
  An error will be returned if arrays/associative arrays are nested more than 256 levels deep.`,
467
- type: new FunctionType_1.FunctionType(new ObjectType_1.ObjectType()),
525
+ type: new TypedFunctionType_1.TypedFunctionType(new ObjectType_1.ObjectType()),
468
526
  file: exports.globalFile,
469
527
  params: [{
470
528
  name: 'jsonString',
471
- type: new StringType_1.StringType()
529
+ type: new StringType_1.StringType(),
530
+ isOptional: false
531
+ },
532
+ {
533
+ name: 'flags',
534
+ type: new StringType_1.StringType(),
535
+ isOptional: true
472
536
  }]
473
537
  }, {
474
538
  name: 'FormatJson',
@@ -481,11 +545,12 @@ An error will be returned if arrays/associative arrays are nested more than 256
481
545
  If an error occurs an empty string will be returned.
482
546
 
483
547
  Normally non-ASCII characters are escaped in the output string as "\\uXXXX" where XXXX is the hexadecimal representation of the Unicode character value. If flags=1, non-ASCII characters are not escaped.`,
484
- type: new FunctionType_1.FunctionType(new StringType_1.StringType()),
548
+ type: new TypedFunctionType_1.TypedFunctionType(new StringType_1.StringType()),
485
549
  file: exports.globalFile,
486
550
  params: [{
487
551
  name: 'object',
488
- type: new ObjectType_1.ObjectType()
552
+ type: new ObjectType_1.ObjectType(),
553
+ isOptional: false
489
554
  }, {
490
555
  name: 'flags',
491
556
  type: new StringType_1.StringType(),
@@ -497,11 +562,12 @@ Normally non-ASCII characters are escaped in the output string as "\\uXXXX" wher
497
562
 
498
563
  In some cases you may want to include a placeholder marker in a localizable string that gets dynamically substituted with a value at runtime.
499
564
  One way to accomplish that is to use the Replace method on the string value returned from the Tr() lookup.`,
500
- type: new FunctionType_1.FunctionType(new StringType_1.StringType()),
565
+ type: new TypedFunctionType_1.TypedFunctionType(new StringType_1.StringType()),
501
566
  file: exports.globalFile,
502
567
  params: [{
503
568
  name: 'source',
504
- type: new StringType_1.StringType()
569
+ type: new StringType_1.StringType(),
570
+ isOptional: false
505
571
  }]
506
572
  }
507
573
  ];
@@ -509,29 +575,32 @@ let globalStringFunctions = [
509
575
  {
510
576
  name: 'UCase',
511
577
  shortDescription: 'Converts the string to all upper case.',
512
- type: new FunctionType_1.FunctionType(new StringType_1.StringType()),
578
+ type: new TypedFunctionType_1.TypedFunctionType(new StringType_1.StringType()),
513
579
  file: exports.globalFile,
514
580
  params: [{
515
581
  name: 's',
516
- type: new StringType_1.StringType()
582
+ type: new StringType_1.StringType(),
583
+ isOptional: false
517
584
  }]
518
585
  }, {
519
586
  name: 'LCase',
520
587
  shortDescription: 'Converts the string to all lower case.',
521
- type: new FunctionType_1.FunctionType(new StringType_1.StringType()),
588
+ type: new TypedFunctionType_1.TypedFunctionType(new StringType_1.StringType()),
522
589
  file: exports.globalFile,
523
590
  params: [{
524
591
  name: 's',
525
- type: new StringType_1.StringType()
592
+ type: new StringType_1.StringType(),
593
+ isOptional: false
526
594
  }]
527
595
  }, {
528
596
  name: 'Asc',
529
597
  shortDescription: 'Returns the Unicode ("ASCII") value for the first character of the specified string\n An empty string argument will return 0.',
530
- type: new FunctionType_1.FunctionType(new IntegerType_1.IntegerType()),
598
+ type: new TypedFunctionType_1.TypedFunctionType(new IntegerType_1.IntegerType()),
531
599
  file: exports.globalFile,
532
600
  params: [{
533
601
  name: 'letter',
534
- type: new StringType_1.StringType()
602
+ type: new StringType_1.StringType(),
603
+ isOptional: false
535
604
  }]
536
605
  }, {
537
606
  name: 'Chr',
@@ -542,59 +611,68 @@ let globalStringFunctions = [
542
611
  By using Chr, you can create strings containing characters which cannot be contained in quotes, such as newline or the quote character itself.
543
612
 
544
613
  print (Chr(34) + "hello" + Chr(34)) ' prints: "hello"`,
545
- type: new FunctionType_1.FunctionType(new StringType_1.StringType()),
614
+ type: new TypedFunctionType_1.TypedFunctionType(new StringType_1.StringType()),
546
615
  file: exports.globalFile,
547
616
  params: [{
548
617
  name: 'ch',
549
- type: new IntegerType_1.IntegerType()
618
+ type: new IntegerType_1.IntegerType(),
619
+ isOptional: false
550
620
  }]
551
621
  }, {
552
622
  name: 'Instr',
553
623
  shortDescription: 'Returns the position of the first instances of substring within text, starting at the specified start position.\nReturns 0 if the substring is not found. Unlike the ifString.Instr() method, the first position is 1.',
554
- type: new FunctionType_1.FunctionType(new IntegerType_1.IntegerType()),
624
+ type: new TypedFunctionType_1.TypedFunctionType(new IntegerType_1.IntegerType()),
555
625
  file: exports.globalFile,
556
626
  params: [{
557
627
  name: 'start',
558
- type: new IntegerType_1.IntegerType()
628
+ type: new IntegerType_1.IntegerType(),
629
+ isOptional: false
559
630
  }, {
560
631
  name: 'text',
561
- type: new StringType_1.StringType()
632
+ type: new StringType_1.StringType(),
633
+ isOptional: false
562
634
  }, {
563
635
  name: 'substring',
564
- type: new StringType_1.StringType()
636
+ type: new StringType_1.StringType(),
637
+ isOptional: false
565
638
  }]
566
639
  }, {
567
640
  name: 'Left',
568
641
  shortDescription: 'Returns the first n characters of s. ',
569
- type: new FunctionType_1.FunctionType(new StringType_1.StringType()),
642
+ type: new TypedFunctionType_1.TypedFunctionType(new StringType_1.StringType()),
570
643
  file: exports.globalFile,
571
644
  params: [{
572
645
  name: 's',
573
- type: new StringType_1.StringType()
646
+ type: new StringType_1.StringType(),
647
+ isOptional: false
574
648
  }, {
575
649
  name: 'n',
576
- type: new IntegerType_1.IntegerType()
650
+ type: new IntegerType_1.IntegerType(),
651
+ isOptional: false
577
652
  }]
578
653
  }, {
579
654
  name: 'Len',
580
655
  shortDescription: 'Returns the number of characters in the specified string.',
581
- type: new FunctionType_1.FunctionType(new IntegerType_1.IntegerType()),
656
+ type: new TypedFunctionType_1.TypedFunctionType(new IntegerType_1.IntegerType()),
582
657
  file: exports.globalFile,
583
658
  params: [{
584
659
  name: 's',
585
- type: new StringType_1.StringType()
660
+ type: new StringType_1.StringType(),
661
+ isOptional: false
586
662
  }]
587
663
  }, {
588
664
  name: 'Mid',
589
665
  shortDescription: 'Returns a substring of s with length n and starting at position p.\nn may be omitted, in which case the string starting at p and ending at the end of the string is returned.\nUnlike the ifString.Mid() method, the first character in the string is position 1.',
590
- type: new FunctionType_1.FunctionType(new StringType_1.StringType()),
666
+ type: new TypedFunctionType_1.TypedFunctionType(new StringType_1.StringType()),
591
667
  file: exports.globalFile,
592
668
  params: [{
593
669
  name: 's',
594
- type: new StringType_1.StringType()
670
+ type: new StringType_1.StringType(),
671
+ isOptional: false
595
672
  }, {
596
673
  name: 'p',
597
- description: '1-based position',
674
+ //description: '1-based position',
675
+ isOptional: false,
598
676
  type: new IntegerType_1.IntegerType()
599
677
  }, {
600
678
  name: 'n',
@@ -604,92 +682,118 @@ By using Chr, you can create strings containing characters which cannot be conta
604
682
  }, {
605
683
  name: 'Right',
606
684
  shortDescription: 'Returns the last n characters of s.',
607
- type: new FunctionType_1.FunctionType(new StringType_1.StringType()),
685
+ type: new TypedFunctionType_1.TypedFunctionType(new StringType_1.StringType()),
608
686
  file: exports.globalFile,
609
687
  params: [{
610
688
  name: 's',
611
- type: new StringType_1.StringType()
689
+ type: new StringType_1.StringType(),
690
+ isOptional: false
612
691
  }, {
613
692
  name: 'n',
614
- type: new IntegerType_1.IntegerType()
693
+ type: new IntegerType_1.IntegerType(),
694
+ isOptional: false
615
695
  }]
616
696
  }, {
617
697
  name: 'Str',
618
698
  shortDescription: 'Converts a value to a string. Str(A), for example, returns a string equal to the decimal representation of the numeric value of A.\nNote: for non-negative numbers, a leading blank is inserted before the value string as a sign placeholder.',
619
- type: new FunctionType_1.FunctionType(new StringType_1.StringType()),
699
+ type: new TypedFunctionType_1.TypedFunctionType(new StringType_1.StringType()),
620
700
  file: exports.globalFile,
621
701
  params: [{
622
702
  name: 'value',
623
- type: new FloatType_1.FloatType()
703
+ type: new FloatType_1.FloatType(),
704
+ isOptional: false
624
705
  }]
625
706
  }, {
626
707
  name: 'StrI',
627
- shortDescription: 'Converts a value to a string. Str(A), for example, returns a string equal to the decimal representation of the numeric value of A.\nNote: for non-negative numbers, a leading blank is inserted before the value string as a sign placeholder.. If the radix parameter is provided, then converts the integer value into a string representation using the given radix.\nIf radix is not 2 .. 36 then an empty string is returned.\nNote that the returned string does not include a base prefix and uses lowercase letters to represent those digits in bases greater than 10.',
628
- type: new FunctionType_1.FunctionType(new StringType_1.StringType()),
708
+ shortDescription: 'Converts a value to a string. Str(A), for example, returns a string equal to the decimal representation of the numeric value of A.\nNote: for non-negative numbers, a leading blank is inserted before the value string as a sign placeholder. If the radix parameter is provided, then converts the integer value into a string representation using the given radix.\nIf radix is not 2 .. 36 then an empty string is returned.\nNote that the returned string does not include a base prefix and uses lowercase letters to represent those digits in bases greater than 10.',
709
+ type: new TypedFunctionType_1.TypedFunctionType(new StringType_1.StringType()),
629
710
  file: exports.globalFile,
630
711
  params: [{
631
712
  name: 'value',
632
- type: new IntegerType_1.IntegerType()
713
+ type: new IntegerType_1.IntegerType(),
714
+ isOptional: false
633
715
  }, {
634
716
  name: 'radix',
635
- type: new IntegerType_1.IntegerType()
717
+ type: new IntegerType_1.IntegerType(),
718
+ isOptional: true
636
719
  }]
637
720
  }, {
638
721
  name: 'string',
639
722
  shortDescription: 'Returns a string composed of n copies of the second argument concatenated together.',
640
- type: new FunctionType_1.FunctionType(new StringType_1.StringType()),
723
+ type: new TypedFunctionType_1.TypedFunctionType(new StringType_1.StringType()),
641
724
  file: exports.globalFile,
642
725
  params: [{
643
726
  name: 'n',
644
- type: new IntegerType_1.IntegerType()
727
+ type: new IntegerType_1.IntegerType(),
728
+ isOptional: false
645
729
  }, {
646
730
  name: 'str',
647
- type: new StringType_1.StringType()
731
+ type: new StringType_1.StringType(),
732
+ isOptional: false
648
733
  }]
649
734
  }, {
650
735
  name: 'StringI',
651
736
  shortDescription: 'Returns a string composed of n copies of the character whose Unicode value is the second argument.',
652
- type: new FunctionType_1.FunctionType(new StringType_1.StringType()),
737
+ type: new TypedFunctionType_1.TypedFunctionType(new StringType_1.StringType()),
653
738
  file: exports.globalFile,
654
739
  params: [{
655
740
  name: 'n',
656
- type: new IntegerType_1.IntegerType()
741
+ type: new IntegerType_1.IntegerType(),
742
+ isOptional: false
657
743
  }, {
658
744
  name: 'ch',
659
- type: new IntegerType_1.IntegerType()
745
+ type: new IntegerType_1.IntegerType(),
746
+ isOptional: false
747
+ }]
748
+ }, {
749
+ name: 'Val',
750
+ shortDescription: 'Performs the inverse of the STR function: returns the number represented by the characters in a string argument.\nFor example, if A$="12" and B$="34" then VAL(A$+ "."+B$) returns the number 12.34.',
751
+ type: new TypedFunctionType_1.TypedFunctionType(new FloatType_1.FloatType()),
752
+ file: exports.globalFile,
753
+ params: [{
754
+ name: 'str',
755
+ type: new StringType_1.StringType(),
756
+ isOptional: false
660
757
  }]
661
758
  }, {
662
759
  name: 'Val',
663
- shortDescription: 'Performs the inverse of the STR function: returns the number represented by the characters in a string argument.\nFor example, if A$="12" and B$="34" then VAL(A$+ "."+B$) returns the number 12.34. If radix is provided as the second parameter, it returns the integer value from parsing the string with the specified radix.\nRadix should be 2 .. 36 or the special value 0 (which automatically identified hexadecimal or octal numbers based on 0x or 0 prefixes respectively).\nLeading whitespace is ignored then as much of the rest of the string will be parsed as valid.',
664
- type: new FunctionType_1.FunctionType(new IntegerType_1.IntegerType()),
760
+ shortDescription: 'Returns the integer value from parsing the string with the specified radix.\nRadix should be 2 .. 36 or the special value 0 (which automatically identified hexadecimal or octal numbers based on 0x or 0 prefixes respectively).\nLeading whitespace is ignored then as much of the rest of the string will be parsed as valid.',
761
+ type: new TypedFunctionType_1.TypedFunctionType(new IntegerType_1.IntegerType()),
665
762
  file: exports.globalFile,
666
763
  params: [{
667
764
  name: 'str',
668
- type: new StringType_1.StringType()
765
+ type: new StringType_1.StringType(),
766
+ isOptional: false
669
767
  }, {
670
768
  name: 'radix',
671
- type: new IntegerType_1.IntegerType()
769
+ type: new IntegerType_1.IntegerType(),
770
+ isOptional: true
672
771
  }]
673
772
  }, {
674
773
  name: 'Substitute',
675
774
  shortDescription: 'Replaces all instances of {0} or ^0 in str with arg0. Similarly, replaces all instances of {1} or ^1 with arg1, {2} or ^2 with arg2, and {3} or ^3 with arg3.',
676
- type: new FunctionType_1.FunctionType(new StringType_1.StringType()),
775
+ type: new TypedFunctionType_1.TypedFunctionType(new StringType_1.StringType()),
677
776
  file: exports.globalFile,
678
777
  params: [{
679
778
  name: 'str',
680
- type: new StringType_1.StringType()
779
+ type: new StringType_1.StringType(),
780
+ isOptional: false
681
781
  }, {
682
782
  name: 'arg0',
683
- type: new StringType_1.StringType()
783
+ type: new StringType_1.StringType(),
784
+ isOptional: false
684
785
  }, {
685
786
  name: 'arg1',
686
- type: new StringType_1.StringType()
787
+ type: new StringType_1.StringType(),
788
+ isOptional: true
687
789
  }, {
688
790
  name: 'arg2',
689
- type: new StringType_1.StringType()
791
+ type: new StringType_1.StringType(),
792
+ isOptional: true
690
793
  }, {
691
794
  name: 'arg3',
692
- type: new StringType_1.StringType()
795
+ type: new StringType_1.StringType(),
796
+ isOptional: true
693
797
  }]
694
798
  }
695
799
  ];
@@ -697,28 +801,196 @@ let programStatementFunctions = [
697
801
  {
698
802
  name: 'Tab',
699
803
  shortDescription: 'Moves the cursor to the specified position on the current line (modulo the width of your console if you specify TAB positions greater than the console width). TAB may be used several times in a PRINT list. No punctuation is required after a TAB modifier. Numerical expressions may be used to specify a TAB position. TAB cannot be used to move the cursor to the left. If the cursor is beyond the specified position, the TAB is ignored.',
700
- type: new FunctionType_1.FunctionType(new VoidType_1.VoidType()),
804
+ type: new TypedFunctionType_1.TypedFunctionType(new VoidType_1.VoidType()),
701
805
  file: exports.globalFile,
702
806
  params: [{
703
807
  name: 'expression',
704
- type: new IntegerType_1.IntegerType()
808
+ type: new IntegerType_1.IntegerType(),
809
+ isOptional: false
705
810
  }]
706
811
  }, {
707
812
  name: 'Pos',
708
813
  shortDescription: 'Returns a number from 0 to window width, indicating the current cursor position on the cursor. Requires a "dummy argument" (any numeric expression).',
709
- type: new FunctionType_1.FunctionType(new VoidType_1.VoidType()),
814
+ type: new TypedFunctionType_1.TypedFunctionType(new VoidType_1.VoidType()),
710
815
  file: exports.globalFile,
711
816
  params: [{
712
817
  name: 'x',
713
- type: new IntegerType_1.IntegerType()
818
+ type: new IntegerType_1.IntegerType(),
819
+ isOptional: false
714
820
  }]
715
821
  //TODO this is a temporary fix for library imported files. Eventually this should be moved into `Roku_Ads.brs` and handled by the `Library` statement
716
822
  }, {
717
823
  name: 'Roku_Ads',
718
824
  shortDescription: 'The main entry point for instantiating the ad interface. This object manages ad server requests, parses ad structure, schedules and renders ads, and triggers tracking beacons.\n\nThe Roku ad parser/renderer object returned has global scope because it is meant to represent interaction with external resources (the ad server and any tracking services) that have persistence and state independent of the ad rendering within a client application.',
719
- type: new FunctionType_1.FunctionType(new ObjectType_1.ObjectType()),
825
+ type: new TypedFunctionType_1.TypedFunctionType(new ObjectType_1.ObjectType()),
826
+ file: exports.globalFile,
827
+ params: []
828
+ }, {
829
+ name: 'bslBrightScriptErrorCodes',
830
+ shortDescription: 'Returns an roAssociativeArray with name value pairs of the error name and corresponding integer value, for example ERR_OKAY = &hFF.',
831
+ type: new TypedFunctionType_1.TypedFunctionType(new ObjectType_1.ObjectType()),
832
+ file: exports.globalFile,
833
+ params: []
834
+ }, {
835
+ name: 'bslGeneralConstants',
836
+ shortDescription: 'Returns an roAssociativeArray with name value pairs of system constants, for example MAX_INT = 2147483647.',
837
+ type: new TypedFunctionType_1.TypedFunctionType(new ObjectType_1.ObjectType()),
720
838
  file: exports.globalFile,
721
839
  params: []
840
+ }, {
841
+ name: 'bslUniversalControlEventCodes',
842
+ shortDescription: 'Returns an roAssociativeArray with name value pairs of the remote key code (buttons) constants, for example BUTTON_SELECT_PRESSED = 6.',
843
+ type: new TypedFunctionType_1.TypedFunctionType(new ObjectType_1.ObjectType()),
844
+ file: exports.globalFile,
845
+ params: []
846
+ },
847
+ {
848
+ name: 'AsciiToHex',
849
+ shortDescription: 'Returns the hex encoded string, for example AsciiToHex("Hi!") = "486921".',
850
+ type: new TypedFunctionType_1.TypedFunctionType(new StringType_1.StringType()),
851
+ file: exports.globalFile,
852
+ params: [{
853
+ name: 'ascii',
854
+ type: new StringType_1.StringType(),
855
+ isOptional: false
856
+ }]
857
+ }, {
858
+ name: 'HexToAscii',
859
+ shortDescription: 'Returns a string that is the hex decoded string, for example HexToAscii("486921") = "Hi!".',
860
+ type: new TypedFunctionType_1.TypedFunctionType(new StringType_1.StringType()),
861
+ file: exports.globalFile,
862
+ params: [{
863
+ name: 'hex',
864
+ type: new StringType_1.StringType(),
865
+ isOptional: false
866
+ }]
867
+ },
868
+ {
869
+ name: 'HexToInteger',
870
+ shortDescription: 'Returns the integer value of the passed in hex string.',
871
+ type: new TypedFunctionType_1.TypedFunctionType(new IntegerType_1.IntegerType()),
872
+ file: exports.globalFile,
873
+ params: [{
874
+ name: 'hex',
875
+ type: new StringType_1.StringType(),
876
+ isOptional: false
877
+ }]
878
+ }, {
879
+ name: 'HexToInteger',
880
+ shortDescription: 'Returns a string that is the hex decoded string, for example HexToAscii("486921") = "Hi!".',
881
+ type: new TypedFunctionType_1.TypedFunctionType(new IntegerType_1.IntegerType()),
882
+ file: exports.globalFile,
883
+ params: [{
884
+ name: 'hex',
885
+ type: new StringType_1.StringType(),
886
+ isOptional: false
887
+ }]
888
+ }, {
889
+ name: 'dfNewBitmapSet',
890
+ shortDescription: `The goal is to enable simple xml descriptions of graphics resources like bitmaps, regions, sprites, animations, and layouts to be used in your games. The library handles parsing, loading, rendering, and animation of sprites sheets (multiple images in a single png file).
891
+ Filename is the path to an XML file that contains info about bitmap regions, animation frames, and ExtraInfo metadata (any fields you would like) about resources used in 2d games.
892
+ Returns an roAssociativeArray with the following name value pairs:
893
+ ExtraInfo: roAssociativeArray
894
+ Regions: roAssociativeArray of name, roRegions pairs
895
+ Animations: roAssociativeArray of name, roArray of roRegion pairs.
896
+ Backgrounds: roAssociativeArray of name, path pairs.`,
897
+ type: new TypedFunctionType_1.TypedFunctionType(new ObjectType_1.ObjectType()),
898
+ file: exports.globalFile,
899
+ params: [{
900
+ name: 'filename',
901
+ type: new StringType_1.StringType(),
902
+ isOptional: false
903
+ }]
904
+ }, {
905
+ name: 'dfDrawMessage',
906
+ shortDescription: 'dest is an roScreen/roBitmap/roRegion and region is an roRegion.\nGreys the entire dest region and draws it the region centered on the drawable dest.',
907
+ type: new TypedFunctionType_1.TypedFunctionType(new VoidType_1.VoidType()),
908
+ file: exports.globalFile,
909
+ params: [{
910
+ name: 'dest',
911
+ type: new ObjectType_1.ObjectType(),
912
+ isOptional: false
913
+ }, {
914
+ name: 'region',
915
+ type: new ObjectType_1.ObjectType(),
916
+ isOptional: false
917
+ }]
918
+ }, {
919
+ name: 'dfDrawImage',
920
+ shortDescription: 'Returns True if successful.\nCreates a bitmap out of the image stored in the filename "path" and draws it at position (x,y) of the drawable dest.',
921
+ type: new TypedFunctionType_1.TypedFunctionType(new BooleanType_1.BooleanType()),
922
+ file: exports.globalFile,
923
+ params: [{
924
+ name: 'dest',
925
+ type: new ObjectType_1.ObjectType(),
926
+ isOptional: false
927
+ }, {
928
+ name: 'path',
929
+ type: new StringType_1.StringType(),
930
+ isOptional: false
931
+ }, {
932
+ name: 'x',
933
+ type: new IntegerType_1.IntegerType(),
934
+ isOptional: false
935
+ }, {
936
+ name: 'y',
937
+ type: new IntegerType_1.IntegerType(),
938
+ isOptional: false
939
+ }]
940
+ }, {
941
+ name: 'dfSetupDisplayRegions',
942
+ shortDescription: `Helper function to setup screen scaling with supplied pillar box or letterbox images to fill the entire screen.
943
+ screen is an roScreen
944
+ topx and topy are the coordinates of the upper left hand corner of the main drawing region
945
+ Width and height is the size of the main drawing region
946
+
947
+ Returns an associative array containing the following roRegions
948
+ Main: main drawable region
949
+ Left: left region if there is pillar box area on the left
950
+ Right: right region if there is a pillar box area on the right
951
+ Upper: upper region if there is a letterbox area at thetop
952
+ Lower: lower region if there is a letterbox area at the bottom
953
+ When using these regions as drawables, your graphics will be translated and clipped to these regions.`,
954
+ type: new TypedFunctionType_1.TypedFunctionType(new ObjectType_1.ObjectType()),
955
+ file: exports.globalFile,
956
+ params: [{
957
+ name: 'screen',
958
+ type: new ObjectType_1.ObjectType(),
959
+ isOptional: false
960
+ }, {
961
+ name: 'topx',
962
+ type: new IntegerType_1.IntegerType(),
963
+ isOptional: false
964
+ }, {
965
+ name: 'topy',
966
+ type: new IntegerType_1.IntegerType(),
967
+ isOptional: false
968
+ }, {
969
+ name: 'width',
970
+ type: new IntegerType_1.IntegerType(),
971
+ isOptional: false
972
+ }, {
973
+ name: 'height',
974
+ type: new IntegerType_1.IntegerType(),
975
+ isOptional: false
976
+ }]
977
+ }, {
978
+ name: 'dfSetBackground',
979
+ shortDescription: `dfSetBackground helps manage the limited video memory. The video memory does not currently run a defragmenter, and is very limited. These constraints make it important that large bitmaps (like backgrounds that fill the entire screen) are only allocated when needed. It is also helpful if you set your first initial background very early in your program, and then immediately replace the background after it is no longer in use. This helper function supports this background management for your application.
980
+ backgroundName is a key for the Backgrounds roAssociative array of backgrounds.
981
+ Backgrounds is an roAssociative array of background name keys and file path string values
982
+ This function creates an roBitmap out of the background image file and returns a region the size of the entire roBitmap.`,
983
+ type: new TypedFunctionType_1.TypedFunctionType(new ObjectType_1.ObjectType()),
984
+ file: exports.globalFile,
985
+ params: [{
986
+ name: 'backgroundName',
987
+ type: new StringType_1.StringType(),
988
+ isOptional: false
989
+ }, {
990
+ name: 'backgrounds',
991
+ type: new ObjectType_1.ObjectType(),
992
+ isOptional: false
993
+ }]
722
994
  }
723
995
  ];
724
996
  exports.globalCallables = [...mathFunctions, ...runtimeFunctions, ...globalUtilityFunctions, ...globalStringFunctions, ...programStatementFunctions];
@@ -727,7 +999,7 @@ for (let callable of exports.globalCallables) {
727
999
  callable.nameRange = util_1.default.createRange(0, 0, 0, callable.name.length);
728
1000
  //add each parameter to the type
729
1001
  for (let param of callable.params) {
730
- callable.type.addParameter(param.name, param.type, param.isOptional);
1002
+ callable.type.addParameter(param);
731
1003
  }
732
1004
  //set name in type
733
1005
  callable.type.setName(callable.name);