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.
- package/CHANGELOG.md +643 -253
- package/README.md +33 -9
- package/bsconfig.schema.json +22 -2
- package/dist/BsConfig.d.ts +9 -0
- package/dist/Cache.d.ts +5 -6
- package/dist/Cache.js +12 -11
- package/dist/Cache.js.map +1 -1
- package/dist/CodeActionUtil.d.ts +11 -2
- package/dist/CodeActionUtil.js +17 -3
- package/dist/CodeActionUtil.js.map +1 -1
- package/dist/CommentFlagProcessor.d.ts +4 -4
- package/dist/CommentFlagProcessor.js +5 -3
- package/dist/CommentFlagProcessor.js.map +1 -1
- package/dist/DependencyGraph.d.ts +2 -2
- package/dist/DependencyGraph.js +20 -7
- package/dist/DependencyGraph.js.map +1 -1
- package/dist/DiagnosticCollection.d.ts +3 -3
- package/dist/DiagnosticCollection.js +11 -11
- package/dist/DiagnosticCollection.js.map +1 -1
- package/dist/DiagnosticFilterer.js +5 -4
- package/dist/DiagnosticFilterer.js.map +1 -1
- package/dist/DiagnosticMessages.d.ts +59 -4
- package/dist/DiagnosticMessages.js +65 -7
- package/dist/DiagnosticMessages.js.map +1 -1
- package/dist/LanguageServer.d.ts +51 -39
- package/dist/LanguageServer.js +316 -232
- package/dist/LanguageServer.js.map +1 -1
- package/dist/Logger.d.ts +2 -0
- package/dist/Logger.js +10 -8
- package/dist/Logger.js.map +1 -1
- package/dist/PluginInterface.d.ts +7 -3
- package/dist/PluginInterface.js +9 -0
- package/dist/PluginInterface.js.map +1 -1
- package/dist/Program.d.ts +43 -25
- package/dist/Program.js +212 -95
- package/dist/Program.js.map +1 -1
- package/dist/ProgramBuilder.d.ts +4 -0
- package/dist/ProgramBuilder.js +36 -20
- package/dist/ProgramBuilder.js.map +1 -1
- package/dist/Scope.d.ts +126 -29
- package/dist/Scope.js +433 -156
- package/dist/Scope.js.map +1 -1
- package/dist/SemanticTokenUtils.d.ts +14 -0
- package/dist/SemanticTokenUtils.js +81 -0
- package/dist/SemanticTokenUtils.js.map +1 -0
- package/dist/SymbolTable.d.ts +10 -4
- package/dist/SymbolTable.js +55 -13
- package/dist/SymbolTable.js.map +1 -1
- package/dist/XmlScope.d.ts +7 -2
- package/dist/XmlScope.js +65 -27
- package/dist/XmlScope.js.map +1 -1
- package/dist/astUtils/AstEditor.d.ts +65 -0
- package/dist/astUtils/AstEditor.js +239 -0
- package/dist/astUtils/AstEditor.js.map +1 -0
- package/dist/{types/FunctionType.spec.d.ts → astUtils/AstEditor.spec.d.ts} +0 -0
- package/dist/astUtils/AstEditor.spec.js +254 -0
- package/dist/astUtils/AstEditor.spec.js.map +1 -0
- package/dist/astUtils/creators.d.ts +28 -6
- package/dist/astUtils/creators.js +137 -19
- package/dist/astUtils/creators.js.map +1 -1
- package/dist/astUtils/creators.spec.js +14 -4
- package/dist/astUtils/creators.spec.js.map +1 -1
- package/dist/astUtils/reflection.d.ts +32 -10
- package/dist/astUtils/reflection.js +82 -7
- package/dist/astUtils/reflection.js.map +1 -1
- package/dist/astUtils/reflection.spec.js +130 -119
- package/dist/astUtils/reflection.spec.js.map +1 -1
- package/dist/astUtils/stackedVisitor.js.map +1 -1
- package/dist/astUtils/stackedVisitor.spec.js +13 -13
- package/dist/astUtils/stackedVisitor.spec.js.map +1 -1
- package/dist/astUtils/visitors.d.ts +76 -51
- package/dist/astUtils/visitors.js +31 -11
- package/dist/astUtils/visitors.js.map +1 -1
- package/dist/astUtils/visitors.spec.js +126 -32
- package/dist/astUtils/visitors.spec.js.map +1 -1
- package/dist/astUtils/xml.d.ts +4 -3
- package/dist/astUtils/xml.js +8 -3
- package/dist/astUtils/xml.js.map +1 -1
- package/dist/bscPlugin/BscPlugin.d.ts +7 -1
- package/dist/bscPlugin/BscPlugin.js +28 -0
- package/dist/bscPlugin/BscPlugin.js.map +1 -1
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +4 -4
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js +26 -26
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js.map +1 -1
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.d.ts +9 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +108 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.d.ts +1 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js +130 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.d.ts +8 -0
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js +52 -0
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js.map +1 -0
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.d.ts +1 -0
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js +32 -0
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/validation/BrsFileValidator.d.ts +9 -0
- package/dist/bscPlugin/validation/BrsFileValidator.js +66 -0
- package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -0
- package/dist/bscPlugin/validation/ScopeValidator.d.ts +29 -0
- package/dist/bscPlugin/validation/ScopeValidator.js +183 -0
- package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -0
- package/dist/cli.js +10 -3
- package/dist/cli.js.map +1 -1
- package/dist/diagnosticUtils.d.ts +1 -0
- package/dist/diagnosticUtils.js +15 -8
- package/dist/diagnosticUtils.js.map +1 -1
- package/dist/examples/plugins/removePrint.js +12 -14
- package/dist/examples/plugins/removePrint.js.map +1 -1
- package/dist/files/BrsFile.Class.spec.js +717 -147
- package/dist/files/BrsFile.Class.spec.js.map +1 -1
- package/dist/files/BrsFile.d.ts +70 -30
- package/dist/files/BrsFile.js +719 -353
- package/dist/files/BrsFile.js.map +1 -1
- package/dist/files/BrsFile.spec.js +1238 -449
- package/dist/files/BrsFile.spec.js.map +1 -1
- package/dist/files/XmlFile.d.ts +6 -5
- package/dist/files/XmlFile.js +38 -30
- package/dist/files/XmlFile.js.map +1 -1
- package/dist/files/XmlFile.spec.js +302 -237
- package/dist/files/XmlFile.spec.js.map +1 -1
- package/dist/files/tests/imports.spec.js +44 -42
- package/dist/files/tests/imports.spec.js.map +1 -1
- package/dist/files/tests/optionalChaning.spec.d.ts +1 -0
- package/dist/files/tests/optionalChaning.spec.js +88 -0
- package/dist/files/tests/optionalChaning.spec.js.map +1 -0
- package/dist/globalCallables.d.ts +3 -1
- package/dist/globalCallables.js +424 -152
- package/dist/globalCallables.js.map +1 -1
- package/dist/index.d.ts +13 -3
- package/dist/index.js +28 -5
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +133 -16
- package/dist/lexer/Lexer.d.ts +19 -1
- package/dist/lexer/Lexer.js +127 -21
- package/dist/lexer/Lexer.js.map +1 -1
- package/dist/lexer/Lexer.spec.js +657 -536
- package/dist/lexer/Lexer.spec.js.map +1 -1
- package/dist/lexer/Token.d.ts +2 -2
- package/dist/lexer/TokenKind.d.ts +13 -1
- package/dist/lexer/TokenKind.js +60 -3
- package/dist/lexer/TokenKind.js.map +1 -1
- package/dist/parser/BrsTranspileState.d.ts +9 -0
- package/dist/parser/BrsTranspileState.js +14 -0
- package/dist/parser/BrsTranspileState.js.map +1 -1
- package/dist/parser/Expression.d.ts +150 -34
- package/dist/parser/Expression.js +335 -165
- package/dist/parser/Expression.js.map +1 -1
- package/dist/parser/Parser.Class.spec.js +189 -89
- package/dist/parser/Parser.Class.spec.js.map +1 -1
- package/dist/parser/Parser.d.ts +153 -30
- package/dist/parser/Parser.js +1100 -503
- package/dist/parser/Parser.js.map +1 -1
- package/dist/parser/Parser.spec.js +687 -266
- package/dist/parser/Parser.spec.js.map +1 -1
- package/dist/parser/SGParser.d.ts +41 -4
- package/dist/parser/SGParser.js +186 -175
- package/dist/parser/SGParser.js.map +1 -1
- package/dist/parser/SGParser.spec.js +35 -22
- package/dist/parser/SGParser.spec.js.map +1 -1
- package/dist/parser/SGTypes.d.ts +206 -38
- package/dist/parser/SGTypes.js +470 -161
- package/dist/parser/SGTypes.js.map +1 -1
- package/dist/parser/SGTypes.spec.d.ts +1 -0
- package/dist/parser/SGTypes.spec.js +351 -0
- package/dist/parser/SGTypes.spec.js.map +1 -0
- package/dist/parser/Statement.d.ts +202 -48
- package/dist/parser/Statement.js +648 -193
- package/dist/parser/Statement.js.map +1 -1
- package/dist/parser/Statement.spec.js +11 -11
- package/dist/parser/Statement.spec.js.map +1 -1
- package/dist/parser/TranspileState.d.ts +1 -1
- package/dist/parser/TranspileState.js +15 -7
- package/dist/parser/TranspileState.js.map +1 -1
- package/dist/parser/tests/Parser.spec.d.ts +10 -9
- package/dist/parser/tests/Parser.spec.js +15 -11
- package/dist/parser/tests/Parser.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/For.spec.js +60 -60
- package/dist/parser/tests/controlFlow/For.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/ForEach.spec.js +40 -39
- package/dist/parser/tests/controlFlow/ForEach.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/If.spec.js +213 -194
- package/dist/parser/tests/controlFlow/If.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/While.spec.js +37 -37
- package/dist/parser/tests/controlFlow/While.spec.js.map +1 -1
- package/dist/parser/tests/expression/Additive.spec.js +30 -30
- package/dist/parser/tests/expression/Additive.spec.js.map +1 -1
- package/dist/parser/tests/expression/ArrayLiterals.spec.js +119 -119
- package/dist/parser/tests/expression/ArrayLiterals.spec.js.map +1 -1
- package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js +162 -138
- package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js.map +1 -1
- package/dist/parser/tests/expression/Boolean.spec.js +24 -24
- package/dist/parser/tests/expression/Boolean.spec.js.map +1 -1
- package/dist/parser/tests/expression/Call.spec.js +41 -40
- package/dist/parser/tests/expression/Call.spec.js.map +1 -1
- package/dist/parser/tests/expression/Exponential.spec.js +17 -17
- package/dist/parser/tests/expression/Exponential.spec.js.map +1 -1
- package/dist/parser/tests/expression/Function.spec.js +256 -256
- package/dist/parser/tests/expression/Function.spec.js.map +1 -1
- package/dist/parser/tests/expression/Indexing.spec.js +87 -87
- package/dist/parser/tests/expression/Indexing.spec.js.map +1 -1
- package/dist/parser/tests/expression/Multiplicative.spec.js +37 -37
- package/dist/parser/tests/expression/Multiplicative.spec.js.map +1 -1
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +75 -63
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/PrefixUnary.spec.js +41 -41
- package/dist/parser/tests/expression/PrefixUnary.spec.js.map +1 -1
- package/dist/parser/tests/expression/Primary.spec.js +41 -41
- package/dist/parser/tests/expression/Primary.spec.js.map +1 -1
- package/dist/parser/tests/expression/RegexLiteralExpression.spec.d.ts +1 -0
- package/dist/parser/tests/expression/RegexLiteralExpression.spec.js +171 -0
- package/dist/parser/tests/expression/RegexLiteralExpression.spec.js.map +1 -0
- package/dist/parser/tests/expression/Relational.spec.js +43 -43
- package/dist/parser/tests/expression/Relational.spec.js.map +1 -1
- package/dist/parser/tests/expression/SourceLiteralExpression.spec.js +9 -9
- package/dist/parser/tests/expression/SourceLiteralExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js +28 -28
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TernaryExpression.spec.js +102 -102
- package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
- package/dist/parser/tests/statement/AssignmentOperators.spec.js +36 -36
- package/dist/parser/tests/statement/AssignmentOperators.spec.js.map +1 -1
- package/dist/parser/tests/statement/Declaration.spec.js +44 -44
- package/dist/parser/tests/statement/Declaration.spec.js.map +1 -1
- package/dist/parser/tests/statement/Dim.spec.js +21 -21
- package/dist/parser/tests/statement/Dim.spec.js.map +1 -1
- package/dist/parser/tests/statement/Enum.spec.d.ts +1 -0
- package/dist/parser/tests/statement/Enum.spec.js +840 -0
- package/dist/parser/tests/statement/Enum.spec.js.map +1 -0
- package/dist/parser/tests/statement/For.spec.d.ts +1 -0
- package/dist/parser/tests/statement/For.spec.js +46 -0
- package/dist/parser/tests/statement/For.spec.js.map +1 -0
- package/dist/parser/tests/statement/ForEach.spec.d.ts +1 -0
- package/dist/parser/tests/statement/ForEach.spec.js +37 -0
- package/dist/parser/tests/statement/ForEach.spec.js.map +1 -0
- package/dist/parser/tests/statement/Function.spec.js +198 -197
- package/dist/parser/tests/statement/Function.spec.js.map +1 -1
- package/dist/parser/tests/statement/Goto.spec.js +15 -14
- package/dist/parser/tests/statement/Goto.spec.js.map +1 -1
- package/dist/parser/tests/statement/Increment.spec.js +50 -50
- package/dist/parser/tests/statement/Increment.spec.js.map +1 -1
- package/dist/parser/tests/statement/InterfaceStatement.spec.d.ts +1 -0
- package/dist/parser/tests/statement/InterfaceStatement.spec.js +254 -0
- package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +1 -0
- package/dist/parser/tests/statement/LibraryStatement.spec.js +17 -17
- package/dist/parser/tests/statement/LibraryStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/Misc.spec.js +108 -106
- package/dist/parser/tests/statement/Misc.spec.js.map +1 -1
- package/dist/parser/tests/statement/PrintStatement.spec.js +40 -40
- package/dist/parser/tests/statement/PrintStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/ReturnStatement.spec.js +46 -46
- package/dist/parser/tests/statement/ReturnStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/Set.spec.js +83 -83
- package/dist/parser/tests/statement/Set.spec.js.map +1 -1
- package/dist/parser/tests/statement/Stop.spec.js +12 -11
- package/dist/parser/tests/statement/Stop.spec.js.map +1 -1
- package/dist/parser/tests/statement/Throw.spec.js +5 -5
- package/dist/parser/tests/statement/Throw.spec.js.map +1 -1
- package/dist/parser/tests/statement/TryCatch.spec.js +15 -13
- package/dist/parser/tests/statement/TryCatch.spec.js.map +1 -1
- package/dist/preprocessor/Chunk.d.ts +1 -1
- package/dist/preprocessor/Chunk.js.map +1 -1
- package/dist/preprocessor/Manifest.d.ts +5 -5
- package/dist/preprocessor/Manifest.js +14 -35
- package/dist/preprocessor/Manifest.js.map +1 -1
- package/dist/preprocessor/Manifest.spec.d.ts +1 -0
- package/dist/preprocessor/Manifest.spec.js +78 -103
- package/dist/preprocessor/Manifest.spec.js.map +1 -1
- package/dist/preprocessor/Preprocessor.d.ts +1 -1
- package/dist/preprocessor/Preprocessor.js +8 -8
- package/dist/preprocessor/Preprocessor.js.map +1 -1
- package/dist/preprocessor/Preprocessor.spec.js +49 -49
- package/dist/preprocessor/Preprocessor.spec.js.map +1 -1
- package/dist/preprocessor/PreprocessorParser.spec.js +72 -72
- package/dist/preprocessor/PreprocessorParser.spec.js.map +1 -1
- package/dist/roku-types/data.json +21891 -0
- package/dist/roku-types/index.d.ts +6776 -0
- package/dist/roku-types/index.js +11 -0
- package/dist/roku-types/index.js.map +1 -0
- package/dist/types/ArrayType.d.ts +8 -5
- package/dist/types/ArrayType.js +52 -12
- package/dist/types/ArrayType.js.map +1 -1
- package/dist/types/ArrayType.spec.js +72 -11
- package/dist/types/ArrayType.spec.js.map +1 -1
- package/dist/types/BooleanType.d.ts +4 -2
- package/dist/types/BooleanType.js +9 -4
- package/dist/types/BooleanType.js.map +1 -1
- package/dist/types/BooleanType.spec.js +5 -3
- package/dist/types/BooleanType.spec.js.map +1 -1
- package/dist/types/BscType.d.ts +20 -5
- package/dist/types/BscType.js +24 -0
- package/dist/types/BscType.js.map +1 -1
- package/dist/types/CustomType.d.ts +8 -6
- package/dist/types/CustomType.js +20 -11
- package/dist/types/CustomType.js.map +1 -1
- package/dist/types/DoubleType.d.ts +2 -0
- package/dist/types/DoubleType.js +14 -9
- package/dist/types/DoubleType.js.map +1 -1
- package/dist/types/DoubleType.spec.js +5 -3
- package/dist/types/DoubleType.spec.js.map +1 -1
- package/dist/types/DynamicType.d.ts +2 -0
- package/dist/types/DynamicType.js +6 -2
- package/dist/types/DynamicType.js.map +1 -1
- package/dist/types/DynamicType.spec.js +2 -2
- package/dist/types/DynamicType.spec.js.map +1 -1
- package/dist/types/EnumType.d.ts +22 -0
- package/dist/types/EnumType.js +55 -0
- package/dist/types/EnumType.js.map +1 -0
- package/dist/types/FloatType.d.ts +2 -0
- package/dist/types/FloatType.js +14 -9
- package/dist/types/FloatType.js.map +1 -1
- package/dist/types/FloatType.spec.js +4 -2
- package/dist/types/FloatType.spec.js.map +1 -1
- package/dist/types/FunctionType.d.ts +7 -31
- package/dist/types/FunctionType.js +11 -57
- package/dist/types/FunctionType.js.map +1 -1
- package/dist/types/IntegerType.d.ts +2 -0
- package/dist/types/IntegerType.js +14 -9
- package/dist/types/IntegerType.js.map +1 -1
- package/dist/types/IntegerType.spec.js +5 -3
- package/dist/types/IntegerType.spec.js.map +1 -1
- package/dist/types/InterfaceType.d.ts +13 -4
- package/dist/types/InterfaceType.js +48 -8
- package/dist/types/InterfaceType.js.map +1 -1
- package/dist/types/InterfaceType.spec.d.ts +1 -0
- package/dist/types/InterfaceType.spec.js +194 -0
- package/dist/types/InterfaceType.spec.js.map +1 -0
- package/dist/types/InvalidType.d.ts +4 -2
- package/dist/types/InvalidType.js +10 -5
- package/dist/types/InvalidType.js.map +1 -1
- package/dist/types/InvalidType.spec.js +4 -2
- package/dist/types/InvalidType.spec.js.map +1 -1
- package/dist/types/LazyType.d.ts +8 -7
- package/dist/types/LazyType.js +22 -10
- package/dist/types/LazyType.js.map +1 -1
- package/dist/types/LongIntegerType.d.ts +2 -0
- package/dist/types/LongIntegerType.js +14 -9
- package/dist/types/LongIntegerType.js.map +1 -1
- package/dist/types/LongIntegerType.spec.js +4 -2
- package/dist/types/LongIntegerType.spec.js.map +1 -1
- package/dist/types/ObjectType.d.ts +8 -4
- package/dist/types/ObjectType.js +9 -4
- package/dist/types/ObjectType.js.map +1 -1
- package/dist/types/ObjectType.spec.js +2 -2
- package/dist/types/ObjectType.spec.js.map +1 -1
- package/dist/types/StringType.d.ts +4 -2
- package/dist/types/StringType.js +9 -4
- package/dist/types/StringType.js.map +1 -1
- package/dist/types/StringType.spec.js +4 -2
- package/dist/types/StringType.spec.js.map +1 -1
- package/dist/types/TypedFunctionType.d.ts +28 -0
- package/dist/types/TypedFunctionType.js +88 -0
- package/dist/types/TypedFunctionType.js.map +1 -0
- package/dist/types/TypedFunctionType.spec.d.ts +1 -0
- package/dist/types/TypedFunctionType.spec.js +37 -0
- package/dist/types/TypedFunctionType.spec.js.map +1 -0
- package/dist/types/UninitializedType.js +3 -3
- package/dist/types/UninitializedType.js.map +1 -1
- package/dist/types/VoidType.d.ts +4 -2
- package/dist/types/VoidType.js +8 -4
- package/dist/types/VoidType.js.map +1 -1
- package/dist/types/VoidType.spec.js +2 -2
- package/dist/types/VoidType.spec.js.map +1 -1
- package/dist/types/helpers.d.ts +42 -0
- package/dist/types/helpers.js +118 -0
- package/dist/types/helpers.js.map +1 -0
- package/dist/util.d.ts +91 -21
- package/dist/util.js +364 -114
- package/dist/util.js.map +1 -1
- package/dist/validators/ClassValidator.d.ts +19 -2
- package/dist/validators/ClassValidator.js +164 -103
- package/dist/validators/ClassValidator.js.map +1 -1
- package/package.json +30 -19
- package/dist/astUtils/index.d.ts +0 -7
- package/dist/astUtils/index.js +0 -26
- package/dist/astUtils/index.js.map +0 -1
- package/dist/lexer/index.d.ts +0 -3
- package/dist/lexer/index.js +0 -17
- package/dist/lexer/index.js.map +0 -1
- package/dist/parser/index.d.ts +0 -3
- package/dist/parser/index.js +0 -16
- package/dist/parser/index.js.map +0 -1
- package/dist/preprocessor/index.d.ts +0 -3
- package/dist/preprocessor/index.js +0 -16
- package/dist/preprocessor/index.js.map +0 -1
- package/dist/types/FunctionType.spec.js +0 -23
- package/dist/types/FunctionType.spec.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Token, Identifier } from '../lexer';
|
|
1
|
+
import type { Token, Identifier } from '../lexer/Token';
|
|
2
2
|
import type { Block, CommentStatement, FunctionStatement, LabelStatement } from './Statement';
|
|
3
3
|
import type { Range } from 'vscode-languageserver';
|
|
4
4
|
import type { BrsTranspileState } from './BrsTranspileState';
|
|
@@ -6,9 +6,12 @@ import { ParseMode } from './Parser';
|
|
|
6
6
|
import type { WalkOptions, WalkVisitor } from '../astUtils/visitors';
|
|
7
7
|
import { InternalWalkMode } from '../astUtils/visitors';
|
|
8
8
|
import type { TranspileResult, TypedefProvider } from '../interfaces';
|
|
9
|
-
import
|
|
9
|
+
import { VoidType } from '../types/VoidType';
|
|
10
|
+
import { DynamicType } from '../types/DynamicType';
|
|
11
|
+
import type { BscType, SymbolContainer } from '../types/BscType';
|
|
10
12
|
import { SymbolTable } from '../SymbolTable';
|
|
11
|
-
import {
|
|
13
|
+
import { TypedFunctionType } from '../types/TypedFunctionType';
|
|
14
|
+
import { ArrayType } from '../types/ArrayType';
|
|
12
15
|
export declare type ExpressionVisitor = (expression: Expression, parent: Expression) => void;
|
|
13
16
|
/** A BrightScript expression */
|
|
14
17
|
export declare abstract class Expression {
|
|
@@ -34,6 +37,9 @@ export declare class BinaryExpression extends Expression {
|
|
|
34
37
|
}
|
|
35
38
|
export declare class CallExpression extends Expression {
|
|
36
39
|
readonly callee: Expression;
|
|
40
|
+
/**
|
|
41
|
+
* Can either be `(`, or `?(` for optional chaining
|
|
42
|
+
*/
|
|
37
43
|
readonly openingParen: Token;
|
|
38
44
|
readonly closingParen: Token;
|
|
39
45
|
readonly args: Expression[];
|
|
@@ -42,7 +48,11 @@ export declare class CallExpression extends Expression {
|
|
|
42
48
|
*/
|
|
43
49
|
readonly namespaceName: NamespacedVariableNameExpression;
|
|
44
50
|
static MaximumArguments: number;
|
|
45
|
-
constructor(callee: Expression,
|
|
51
|
+
constructor(callee: Expression,
|
|
52
|
+
/**
|
|
53
|
+
* Can either be `(`, or `?(` for optional chaining
|
|
54
|
+
*/
|
|
55
|
+
openingParen: Token, closingParen: Token, args: Expression[],
|
|
46
56
|
/**
|
|
47
57
|
* The namespace that currently wraps this call expression. This is NOT the namespace of the callee...that will be represented in the callee expression itself.
|
|
48
58
|
*/
|
|
@@ -59,24 +69,31 @@ export declare class FunctionExpression extends Expression implements TypedefPro
|
|
|
59
69
|
readonly leftParen: Token;
|
|
60
70
|
readonly rightParen: Token;
|
|
61
71
|
readonly asToken?: Token;
|
|
62
|
-
readonly
|
|
72
|
+
readonly returnType?: TypeExpression;
|
|
63
73
|
/**
|
|
64
74
|
* If this function is enclosed within another function, this will reference that parent function
|
|
65
75
|
*/
|
|
66
76
|
readonly parentFunction?: FunctionExpression;
|
|
67
77
|
readonly namespaceName?: NamespacedVariableNameExpression;
|
|
68
78
|
readonly parentSymbolTable?: SymbolTable;
|
|
69
|
-
constructor(parameters: FunctionParameterExpression[], body: Block, functionType: Token | null, end: Token, leftParen: Token, rightParen: Token, asToken?: Token,
|
|
79
|
+
constructor(parameters: FunctionParameterExpression[], body: Block, functionType: Token | null, end: Token, leftParen: Token, rightParen: Token, asToken?: Token, returnType?: TypeExpression,
|
|
70
80
|
/**
|
|
71
81
|
* If this function is enclosed within another function, this will reference that parent function
|
|
72
82
|
*/
|
|
73
83
|
parentFunction?: FunctionExpression, namespaceName?: NamespacedVariableNameExpression, parentSymbolTable?: SymbolTable);
|
|
84
|
+
get range(): Range;
|
|
85
|
+
/**
|
|
86
|
+
* The range of the function
|
|
87
|
+
*/
|
|
88
|
+
cacheRange(): Range;
|
|
89
|
+
private _range;
|
|
74
90
|
readonly symbolTable: SymbolTable;
|
|
75
91
|
labelStatements: LabelStatement[];
|
|
92
|
+
private _returnType;
|
|
76
93
|
/**
|
|
77
94
|
* The type this function returns
|
|
78
95
|
*/
|
|
79
|
-
|
|
96
|
+
getReturnType(): BscType;
|
|
80
97
|
/**
|
|
81
98
|
* The list of function calls that are declared within this function scope. This excludes CallExpressions
|
|
82
99
|
* declared in child functions
|
|
@@ -91,42 +108,51 @@ export declare class FunctionExpression extends Expression implements TypedefPro
|
|
|
91
108
|
*/
|
|
92
109
|
childFunctionExpressions: FunctionExpression[];
|
|
93
110
|
/**
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
get
|
|
111
|
+
* The range of the function declaration, starting at the 'f' in function or 's' in sub (or the open paren if the keyword is missing),
|
|
112
|
+
* and ending with the last character in the returnTypeToken, or the 's' in 'as', or the rightParen
|
|
113
|
+
*/
|
|
114
|
+
get functionDeclarationRange(): Range;
|
|
98
115
|
transpile(state: BrsTranspileState, name?: Identifier, includeBody?: boolean): any[];
|
|
99
116
|
getTypedef(state: BrsTranspileState, name?: Identifier): any[];
|
|
100
117
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
101
|
-
getFunctionType():
|
|
118
|
+
getFunctionType(): TypedFunctionType;
|
|
102
119
|
}
|
|
103
120
|
export declare class FunctionParameterExpression extends Expression {
|
|
104
121
|
name: Identifier;
|
|
105
|
-
|
|
122
|
+
private typeInContext;
|
|
106
123
|
equalsToken?: Token;
|
|
107
124
|
defaultValue?: Expression;
|
|
108
125
|
asToken?: Token;
|
|
109
|
-
|
|
126
|
+
type?: TypeExpression;
|
|
110
127
|
readonly namespaceName?: NamespacedVariableNameExpression;
|
|
111
|
-
constructor(name: Identifier,
|
|
112
|
-
|
|
128
|
+
constructor(name: Identifier, typeInContext: BscType, equalsToken?: Token, defaultValue?: Expression, asToken?: Token, type?: TypeExpression, namespaceName?: NamespacedVariableNameExpression);
|
|
129
|
+
readonly range: Range;
|
|
130
|
+
getType(): BscType;
|
|
113
131
|
transpile(state: BrsTranspileState): any[];
|
|
114
132
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
133
|
+
get isOptional(): boolean;
|
|
115
134
|
}
|
|
116
135
|
export declare class NamespacedVariableNameExpression extends Expression {
|
|
117
136
|
readonly expression: DottedGetExpression | VariableExpression;
|
|
118
137
|
constructor(expression: DottedGetExpression | VariableExpression);
|
|
119
|
-
range: Range;
|
|
138
|
+
readonly range: Range;
|
|
120
139
|
transpile(state: BrsTranspileState): import("source-map").SourceNode[];
|
|
121
140
|
getNameParts(): string[];
|
|
122
|
-
getName(parseMode
|
|
141
|
+
getName(parseMode?: ParseMode): string;
|
|
123
142
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
124
143
|
}
|
|
125
144
|
export declare class DottedGetExpression extends Expression {
|
|
126
145
|
readonly obj: Expression;
|
|
127
146
|
readonly name: Identifier;
|
|
147
|
+
/**
|
|
148
|
+
* Can either be `.`, or `?.` for optional chaining
|
|
149
|
+
*/
|
|
128
150
|
readonly dot: Token;
|
|
129
|
-
constructor(obj: Expression, name: Identifier,
|
|
151
|
+
constructor(obj: Expression, name: Identifier,
|
|
152
|
+
/**
|
|
153
|
+
* Can either be `.`, or `?.` for optional chaining
|
|
154
|
+
*/
|
|
155
|
+
dot: Token);
|
|
130
156
|
readonly range: Range;
|
|
131
157
|
transpile(state: BrsTranspileState): (string | import("source-map").SourceNode)[];
|
|
132
158
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
@@ -134,18 +160,33 @@ export declare class DottedGetExpression extends Expression {
|
|
|
134
160
|
export declare class XmlAttributeGetExpression extends Expression {
|
|
135
161
|
readonly obj: Expression;
|
|
136
162
|
readonly name: Identifier;
|
|
163
|
+
/**
|
|
164
|
+
* Can either be `@`, or `?@` for optional chaining
|
|
165
|
+
*/
|
|
137
166
|
readonly at: Token;
|
|
138
|
-
constructor(obj: Expression, name: Identifier,
|
|
167
|
+
constructor(obj: Expression, name: Identifier,
|
|
168
|
+
/**
|
|
169
|
+
* Can either be `@`, or `?@` for optional chaining
|
|
170
|
+
*/
|
|
171
|
+
at: Token);
|
|
139
172
|
readonly range: Range;
|
|
140
173
|
transpile(state: BrsTranspileState): (string | import("source-map").SourceNode)[];
|
|
141
174
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
142
175
|
}
|
|
143
176
|
export declare class IndexedGetExpression extends Expression {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
177
|
+
obj: Expression;
|
|
178
|
+
index: Expression;
|
|
179
|
+
/**
|
|
180
|
+
* Can either be `[` or `?[`. If `?.[` is used, this will be `[` and `optionalChainingToken` will be `?.`
|
|
181
|
+
*/
|
|
182
|
+
openingSquare: Token;
|
|
183
|
+
closingSquare: Token;
|
|
184
|
+
questionDotToken?: Token;
|
|
185
|
+
constructor(obj: Expression, index: Expression,
|
|
186
|
+
/**
|
|
187
|
+
* Can either be `[` or `?[`. If `?.[` is used, this will be `[` and `optionalChainingToken` will be `?.`
|
|
188
|
+
*/
|
|
189
|
+
openingSquare: Token, closingSquare: Token, questionDotToken?: Token);
|
|
149
190
|
readonly range: Range;
|
|
150
191
|
transpile(state: BrsTranspileState): (string | import("source-map").SourceNode)[];
|
|
151
192
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
@@ -167,7 +208,7 @@ export declare class GroupingExpression extends Expression {
|
|
|
167
208
|
export declare class LiteralExpression extends Expression {
|
|
168
209
|
token: Token;
|
|
169
210
|
constructor(token: Token);
|
|
170
|
-
|
|
211
|
+
readonly range: Range;
|
|
171
212
|
/**
|
|
172
213
|
* The (data) type of this expression
|
|
173
214
|
*/
|
|
@@ -205,19 +246,25 @@ export declare class AAMemberExpression extends Expression {
|
|
|
205
246
|
colonToken: Token;
|
|
206
247
|
/** The expression evaluated to determine the member's initial value. */
|
|
207
248
|
value: Expression;
|
|
249
|
+
type: BscType;
|
|
208
250
|
constructor(keyToken: Token, colonToken: Token,
|
|
209
251
|
/** The expression evaluated to determine the member's initial value. */
|
|
210
|
-
value: Expression);
|
|
211
|
-
range: Range;
|
|
252
|
+
value: Expression, type: BscType);
|
|
253
|
+
readonly range: Range;
|
|
254
|
+
commaToken?: Token;
|
|
212
255
|
transpile(state: BrsTranspileState): any[];
|
|
213
256
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
214
257
|
}
|
|
215
|
-
export declare class AALiteralExpression extends Expression {
|
|
258
|
+
export declare class AALiteralExpression extends Expression implements SymbolContainer {
|
|
216
259
|
readonly elements: Array<AAMemberExpression | CommentStatement>;
|
|
217
260
|
readonly open: Token;
|
|
218
261
|
readonly close: Token;
|
|
219
|
-
|
|
262
|
+
readonly functionExpression: FunctionExpression;
|
|
263
|
+
constructor(elements: Array<AAMemberExpression | CommentStatement>, open: Token, close: Token, functionExpression: FunctionExpression);
|
|
220
264
|
readonly range: Range;
|
|
265
|
+
readonly symbolTable: SymbolTable;
|
|
266
|
+
readonly memberTable: SymbolTable;
|
|
267
|
+
buildSymbolTable(): void;
|
|
221
268
|
transpile(state: BrsTranspileState): any[];
|
|
222
269
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
223
270
|
}
|
|
@@ -234,7 +281,6 @@ export declare class VariableExpression extends Expression {
|
|
|
234
281
|
namespaceName: NamespacedVariableNameExpression;
|
|
235
282
|
constructor(name: Identifier, namespaceName: NamespacedVariableNameExpression);
|
|
236
283
|
readonly range: Range;
|
|
237
|
-
isCalled: boolean;
|
|
238
284
|
getName(parseMode: ParseMode): string;
|
|
239
285
|
transpile(state: BrsTranspileState): any[];
|
|
240
286
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
@@ -256,12 +302,12 @@ export declare class NewExpression extends Expression {
|
|
|
256
302
|
readonly newKeyword: Token;
|
|
257
303
|
readonly call: CallExpression;
|
|
258
304
|
constructor(newKeyword: Token, call: CallExpression);
|
|
305
|
+
readonly range: Range;
|
|
259
306
|
/**
|
|
260
307
|
* The name of the class to initialize (with optional namespace prefixed)
|
|
261
308
|
*/
|
|
262
309
|
get className(): NamespacedVariableNameExpression;
|
|
263
310
|
get namespaceName(): NamespacedVariableNameExpression;
|
|
264
|
-
readonly range: Range;
|
|
265
311
|
transpile(state: BrsTranspileState): any[];
|
|
266
312
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
267
313
|
}
|
|
@@ -313,8 +359,10 @@ export declare class AnnotationExpression extends Expression {
|
|
|
313
359
|
readonly atToken: Token;
|
|
314
360
|
readonly nameToken: Token;
|
|
315
361
|
constructor(atToken: Token, nameToken: Token);
|
|
362
|
+
get range(): Range;
|
|
363
|
+
cacheRange(): Range;
|
|
364
|
+
private _range;
|
|
316
365
|
name: string;
|
|
317
|
-
range: Range;
|
|
318
366
|
call: CallExpression;
|
|
319
367
|
/**
|
|
320
368
|
* Convert annotation arguments to JavaScript types
|
|
@@ -332,7 +380,7 @@ export declare class TernaryExpression extends Expression {
|
|
|
332
380
|
readonly colonToken?: Token;
|
|
333
381
|
readonly alternate?: Expression;
|
|
334
382
|
constructor(test: Expression, questionMarkToken: Token, consequent?: Expression, colonToken?: Token, alternate?: Expression);
|
|
335
|
-
range: Range;
|
|
383
|
+
readonly range: Range;
|
|
336
384
|
transpile(state: BrsTranspileState): any[];
|
|
337
385
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
338
386
|
}
|
|
@@ -345,6 +393,74 @@ export declare class NullCoalescingExpression extends Expression {
|
|
|
345
393
|
transpile(state: BrsTranspileState): any[];
|
|
346
394
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
347
395
|
}
|
|
396
|
+
export declare class RegexLiteralExpression extends Expression {
|
|
397
|
+
tokens: {
|
|
398
|
+
regexLiteral: Token;
|
|
399
|
+
};
|
|
400
|
+
constructor(tokens: {
|
|
401
|
+
regexLiteral: Token;
|
|
402
|
+
});
|
|
403
|
+
readonly range: Range;
|
|
404
|
+
transpile(state: BrsTranspileState): TranspileResult;
|
|
405
|
+
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
406
|
+
}
|
|
407
|
+
export declare class TypeExpression extends Expression {
|
|
408
|
+
private tokens;
|
|
409
|
+
namespaceName?: NamespacedVariableNameExpression;
|
|
410
|
+
constructor(tokens: {
|
|
411
|
+
type?: Token;
|
|
412
|
+
}, namespaceName?: NamespacedVariableNameExpression);
|
|
413
|
+
readonly range: Range;
|
|
414
|
+
private _type;
|
|
415
|
+
/**
|
|
416
|
+
* The this TypeExpression refers to
|
|
417
|
+
*/
|
|
418
|
+
get type(): BscType;
|
|
419
|
+
/**
|
|
420
|
+
* Derive a BscType from the type token
|
|
421
|
+
* Can deal with multiple brackets to make multidimensional arrays, eg. float[][]
|
|
422
|
+
* Defaults to `DynamicType`
|
|
423
|
+
*/
|
|
424
|
+
getType(parseMode?: ParseMode): DynamicType | BscType | import("../types/FloatType").FloatType | import("../types/IntegerType").IntegerType | import("../types/DoubleType").DoubleType | import("../types/LongIntegerType").LongIntegerType | import("../types/StringType").StringType | import("../types/BooleanType").BooleanType | import("../types/FunctionType").FunctionType | import("../types/InvalidType").InvalidType | VoidType;
|
|
425
|
+
/**
|
|
426
|
+
* Is this a valid, (eg. known) type?
|
|
427
|
+
*/
|
|
428
|
+
isValidType(parseMode?: ParseMode): boolean;
|
|
429
|
+
/**
|
|
430
|
+
* Gives a human readable string that says the type
|
|
431
|
+
* @returns text to display to show the type
|
|
432
|
+
*/
|
|
433
|
+
getText(): string;
|
|
434
|
+
transpile(state: BrsTranspileState): TranspileResult;
|
|
435
|
+
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
436
|
+
}
|
|
437
|
+
export declare class ArrayTypeExpression extends TypeExpression {
|
|
438
|
+
innerTypes: TypeExpression[];
|
|
439
|
+
private bracketTokens;
|
|
440
|
+
namespaceName?: NamespacedVariableNameExpression;
|
|
441
|
+
constructor(innerTypes: TypeExpression[], // this is an array so that in the future when we support union types
|
|
442
|
+
bracketTokens: {
|
|
443
|
+
leftBracket?: Token;
|
|
444
|
+
rightBracket?: Token;
|
|
445
|
+
}, namespaceName?: NamespacedVariableNameExpression);
|
|
446
|
+
readonly range: Range;
|
|
447
|
+
private get defaultTypeExpression();
|
|
448
|
+
/**
|
|
449
|
+
* Derive a BscType from the type token
|
|
450
|
+
* Returns an array type with the inner types based on the inner type expressions
|
|
451
|
+
*/
|
|
452
|
+
getType(parseMode?: ParseMode): ArrayType;
|
|
453
|
+
/**
|
|
454
|
+
* Is this a valid, (eg. known) type?
|
|
455
|
+
*/
|
|
456
|
+
isValidType(parseMode?: ParseMode): boolean;
|
|
457
|
+
/**
|
|
458
|
+
* Gives a human readable string that says the type
|
|
459
|
+
* @returns text to display to show the type
|
|
460
|
+
*/
|
|
461
|
+
getText(): string;
|
|
462
|
+
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
463
|
+
}
|
|
348
464
|
declare type ExpressionValue = string | number | boolean | Expression | ExpressionValue[] | {
|
|
349
465
|
[key: string]: ExpressionValue;
|
|
350
466
|
};
|