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
package/dist/Scope.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import type { CompletionItem, Position, Range } from 'vscode-languageserver';
|
|
2
2
|
import { Location } from 'vscode-languageserver';
|
|
3
|
-
import type { CallableContainer, BsDiagnostic, BscFile, CallableContainerMap } from './interfaces';
|
|
4
|
-
import type {
|
|
5
|
-
import type { NamespaceStatement, Statement,
|
|
6
|
-
import {
|
|
3
|
+
import type { CallableContainer, BsDiagnostic, BscFile, CallableContainerMap, FileLink, InheritableStatement, InheritableType, NamedTypeStatement } from './interfaces';
|
|
4
|
+
import type { Program } from './Program';
|
|
5
|
+
import type { NamespaceStatement, Statement, FunctionStatement, ClassStatement, EnumStatement, InterfaceStatement } from './parser/Statement';
|
|
6
|
+
import type { FunctionExpression, NewExpression } from './parser/Expression';
|
|
7
|
+
import { ParseMode } from './parser/Parser';
|
|
7
8
|
import { Cache } from './Cache';
|
|
8
|
-
import type { BrsFile } from './files/BrsFile';
|
|
9
|
+
import type { BrsFile, TokenSymbolLookup } from './files/BrsFile';
|
|
9
10
|
import type { DependencyGraph, DependencyChangedEvent } from './DependencyGraph';
|
|
10
11
|
import { SymbolTable } from './SymbolTable';
|
|
12
|
+
import type { BscType, TypeContext } from './types/BscType';
|
|
13
|
+
import type { Token } from './lexer/Token';
|
|
11
14
|
/**
|
|
12
15
|
* A class to keep track of all declarations within a given scope (like source scope, component scope)
|
|
13
16
|
*/
|
|
@@ -21,20 +24,44 @@ export declare class Scope {
|
|
|
21
24
|
* Will be true when first constructed, or anytime one of its dependencies changes
|
|
22
25
|
*/
|
|
23
26
|
isValidated: boolean;
|
|
24
|
-
protected cache: Cache
|
|
27
|
+
protected cache: Cache<any, any>;
|
|
25
28
|
get dependencyGraphKey(): string;
|
|
26
29
|
/**
|
|
27
30
|
* A dictionary of namespaces, indexed by the lower case full name of each namespace.
|
|
28
31
|
* If a namespace is declared as "NameA.NameB.NameC", there will be 3 entries in this dictionary,
|
|
29
32
|
* "namea", "namea.nameb", "namea.nameb.namec"
|
|
30
33
|
*/
|
|
31
|
-
get namespaceLookup():
|
|
34
|
+
get namespaceLookup(): Map<string, NamespaceContainer>;
|
|
32
35
|
/**
|
|
33
36
|
* Get the class with the specified name.
|
|
34
37
|
* @param className - The class name, including the namespace of the class if possible
|
|
35
38
|
* @param containingNamespace - The namespace used to resolve relative class names. (i.e. the namespace around the current statement trying to find a class)
|
|
36
39
|
*/
|
|
37
40
|
getClass(className: string, containingNamespace?: string): ClassStatement;
|
|
41
|
+
/**
|
|
42
|
+
* Get the interface with the specified name.
|
|
43
|
+
* @param ifaceName - The interface name, including the namespace of the interface if possible
|
|
44
|
+
* @param containingNamespace - The namespace used to resolve relative interface names. (i.e. the namespace around the current statement trying to find a interface)
|
|
45
|
+
*/
|
|
46
|
+
getInterface(ifaceName: string, containingNamespace?: string): InterfaceStatement;
|
|
47
|
+
/**
|
|
48
|
+
* Get either the class or interface, etc. with a given name
|
|
49
|
+
* @param name - The name, including the namespace of the interface if possible
|
|
50
|
+
* @param containingNamespace - The namespace used to resolve relative names. (i.e. the namespace around the current statement trying to find the interface or class)
|
|
51
|
+
*/
|
|
52
|
+
getNamedTypeStatement(name: string, containingNamespace?: string): NamedTypeStatement;
|
|
53
|
+
/**
|
|
54
|
+
* A cache of a map of tokens -> TokenSymbolLookups, which are the result of getSymbolTypeFromToken()
|
|
55
|
+
* Sometimes the lookup of symbols may take a while if there are lazyTypes or multiple tokens in a chain
|
|
56
|
+
* By caching the result of this lookup, subsequent lookups of the same tokens are quicker
|
|
57
|
+
*/
|
|
58
|
+
get symbolCache(): Map<Token, TokenSymbolLookup>;
|
|
59
|
+
/**
|
|
60
|
+
* Get the enum with the specified name.
|
|
61
|
+
* @param enumName - The enum name, including the namespace if possible
|
|
62
|
+
* @param containingNamespace - The namespace used to resolve relative enum names. (i.e. the namespace around the current statement trying to find an enum)
|
|
63
|
+
*/
|
|
64
|
+
getEnum(enumName: string, containingNamespace?: string): EnumStatement;
|
|
38
65
|
/**
|
|
39
66
|
* Get a class and its containing file by the class name
|
|
40
67
|
* @param className - The class name, including the namespace of the class if possible
|
|
@@ -42,16 +69,85 @@ export declare class Scope {
|
|
|
42
69
|
*/
|
|
43
70
|
getClassFileLink(className: string, containingNamespace?: string): FileLink<ClassStatement>;
|
|
44
71
|
/**
|
|
72
|
+
* Get an interface and its containing file by the interface name
|
|
73
|
+
* @param ifaceName - The interface name, including the namespace of the interface if possible
|
|
74
|
+
* @param containingNamespace - The namespace used to resolve relative interface names. (i.e. the namespace around the current statement trying to find a interface)
|
|
75
|
+
*/
|
|
76
|
+
getInterfaceFileLink(ifaceName: string, containingNamespace?: string): FileLink<InterfaceStatement>;
|
|
77
|
+
/**
|
|
78
|
+
* Get an Enum and its containing file by the Enum name
|
|
79
|
+
* @param enumName - The Enum name, including the namespace of the enum if possible
|
|
80
|
+
* @param containingNamespace - The namespace used to resolve relative enum names. (i.e. the namespace around the current statement trying to find a enum)
|
|
81
|
+
*/
|
|
82
|
+
getEnumFileLink(enumName: string, containingNamespace?: string): FileLink<EnumStatement>;
|
|
83
|
+
/**
|
|
84
|
+
* Get a Named Type (e.g. Class, Interface, Enum) and its containing file by the name
|
|
85
|
+
* @param name - The name of the type, including the namespace of the class/interface/enum, etc. if possible
|
|
86
|
+
* @param containingNamespace - The namespace used to resolve relative names. (i.e. the namespace around the current statement trying to find a class)
|
|
87
|
+
*/
|
|
88
|
+
getNamedTypeFileLink(name: string, containingNamespace?: string): FileLink<NamedTypeStatement>;
|
|
89
|
+
/**
|
|
90
|
+
* Get a InheritableStatement and its containing file by the name of the interface or class
|
|
91
|
+
* @param name - The name of the interface or class, including the namespace of the class if possible
|
|
92
|
+
* @param containingNamespace - The namespace used to resolve relative names. (i.e. the namespace around the current statement trying to find a class)
|
|
93
|
+
*/
|
|
94
|
+
getInheritableFileLink(name: string, containingNamespace?: string): FileLink<InheritableStatement>;
|
|
95
|
+
/**
|
|
96
|
+
* Gets the parent class of the given class
|
|
97
|
+
* @param klass - The class to get the parent of, if possible
|
|
98
|
+
*/
|
|
99
|
+
getParentClass(klass: ClassStatement): ClassStatement;
|
|
100
|
+
/**
|
|
101
|
+
* Gets the parent interface of the given interface
|
|
102
|
+
* @param iface - The interface to get the parent of, if possible
|
|
103
|
+
*/
|
|
104
|
+
getParentInterface(iface: InterfaceStatement): InterfaceStatement;
|
|
105
|
+
/**
|
|
106
|
+
* Gets the parent of an Interface or Class
|
|
107
|
+
* @param stmt - The class or interface to get the parent of, if possible
|
|
108
|
+
*/
|
|
109
|
+
getParentStatement(stmt: InheritableStatement): InheritableStatement;
|
|
110
|
+
/**
|
|
45
111
|
* Tests if a class exists with the specified name
|
|
46
112
|
* @param className - the all-lower-case namespace-included class name
|
|
47
|
-
* @param namespaceName -
|
|
113
|
+
* @param namespaceName - the current namespace name
|
|
48
114
|
*/
|
|
49
115
|
hasClass(className: string, namespaceName?: string): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Tests if an interface exists with the specified name
|
|
118
|
+
* @param ifaceName - the all-lower-case namespace-included interface name
|
|
119
|
+
* @param namespaceName - the current namespace name
|
|
120
|
+
*/
|
|
121
|
+
hasInterface(ifaceName: string, namespaceName?: string): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Tests if an enum exists with the specified name
|
|
124
|
+
* @param enumName - the all-lower-case namespace-included enum name
|
|
125
|
+
* @param namespaceName - the current namespace name
|
|
126
|
+
*/
|
|
127
|
+
hasEnum(enumName: string, namespaceName?: string): boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Tests if a class OR an interface, etc. exists with the specified name
|
|
130
|
+
* @param name - the all-lower-case namespace-included class or interface name
|
|
131
|
+
* @param namespaceName - the current namespace name
|
|
132
|
+
*/
|
|
133
|
+
hasNamedType(name: string, namespaceName?: string): boolean;
|
|
50
134
|
/**
|
|
51
135
|
* A dictionary of all classes in this scope. This includes namespaced classes always with their full name.
|
|
52
136
|
* The key is stored in lower case
|
|
53
137
|
*/
|
|
54
138
|
getClassMap(): Map<string, FileLink<ClassStatement>>;
|
|
139
|
+
getAncestorTypeListByContext(thisType: BscType, context?: TypeContext): InheritableType[];
|
|
140
|
+
/**
|
|
141
|
+
* A dictionary of all Interfaces in this scope. This includes namespaced Interfaces always with their full name.
|
|
142
|
+
* The key is stored in lower case
|
|
143
|
+
*/
|
|
144
|
+
getInterfaceMap(): Map<string, FileLink<InterfaceStatement>>;
|
|
145
|
+
getAncestorTypeList(className: string, functionExpression?: FunctionExpression): InheritableType[];
|
|
146
|
+
/**
|
|
147
|
+
* A dictionary of all enums in this scope. This includes namespaced enums always with their full name.
|
|
148
|
+
* The key is stored in lower case
|
|
149
|
+
*/
|
|
150
|
+
getEnumMap(): Map<string, FileLink<EnumStatement>>;
|
|
55
151
|
/**
|
|
56
152
|
* The list of diagnostics found specifically for this scope. Individual file diagnostics are stored on the files themselves.
|
|
57
153
|
*/
|
|
@@ -83,17 +179,17 @@ export declare class Scope {
|
|
|
83
179
|
* @param filePath can be a srcPath, a pkgPath, or a destPath (same as pkgPath but without `pkg:/`)
|
|
84
180
|
* @param normalizePath should this function repair and standardize the path? Passing false should have a performance boost if you can guarantee your path is already sanitized
|
|
85
181
|
*/
|
|
86
|
-
getFile(srcPath: string, normalizePath?: boolean):
|
|
182
|
+
getFile(srcPath: string, normalizePath?: boolean): BscFile;
|
|
87
183
|
/**
|
|
88
184
|
* Get the list of files referenced by this scope that are actually loaded in the program.
|
|
89
185
|
* Excludes files from ancestor scopes
|
|
90
186
|
*/
|
|
91
|
-
getOwnFiles():
|
|
187
|
+
getOwnFiles(): BscFile[];
|
|
92
188
|
/**
|
|
93
189
|
* Get the list of files referenced by this scope that are actually loaded in the program.
|
|
94
190
|
* Includes files from this scope and all ancestor scopes
|
|
95
191
|
*/
|
|
96
|
-
getAllFiles():
|
|
192
|
+
getAllFiles(): BscFile[];
|
|
97
193
|
/**
|
|
98
194
|
* Get the list of errors for this scope. It's calculated on the fly, so
|
|
99
195
|
* call this sparingly.
|
|
@@ -110,6 +206,12 @@ export declare class Scope {
|
|
|
110
206
|
* @param name
|
|
111
207
|
*/
|
|
112
208
|
getCallableByName(name: string): import("./interfaces").Callable;
|
|
209
|
+
/**
|
|
210
|
+
* Get the global callable with the specified name.
|
|
211
|
+
* If there are overridden callables with the same name, the closest callable to this scope is returned
|
|
212
|
+
* @param name
|
|
213
|
+
*/
|
|
214
|
+
getGlobalCallableByName(name: string): import("./interfaces").Callable;
|
|
113
215
|
/**
|
|
114
216
|
* Iterate over Brs files not shadowed by typedefs
|
|
115
217
|
*/
|
|
@@ -126,7 +228,7 @@ export declare class Scope {
|
|
|
126
228
|
/**
|
|
127
229
|
* Builds a tree of namespace objects
|
|
128
230
|
*/
|
|
129
|
-
buildNamespaceLookup():
|
|
231
|
+
buildNamespaceLookup(): Map<string, NamespaceContainer>;
|
|
130
232
|
getAllNamespaceStatements(): NamespaceStatement[];
|
|
131
233
|
protected logDebug(...args: any[]): void;
|
|
132
234
|
private _debugLogComponentName;
|
|
@@ -138,7 +240,9 @@ export declare class Scope {
|
|
|
138
240
|
invalidate(): void;
|
|
139
241
|
get symbolTable(): SymbolTable;
|
|
140
242
|
private _symbolTable;
|
|
141
|
-
|
|
243
|
+
protected _memberTable: SymbolTable;
|
|
244
|
+
get memberTable(): SymbolTable;
|
|
245
|
+
protected clearSymbolTable(): void;
|
|
142
246
|
/**
|
|
143
247
|
* Builds the current symbol table for the scope, by merging the tables for all the files in this scope.
|
|
144
248
|
* Also links all file symbols tables to this new table
|
|
@@ -155,27 +259,19 @@ export declare class Scope {
|
|
|
155
259
|
* Find function parameters and function return types that are neither built-in types or known Class references
|
|
156
260
|
*/
|
|
157
261
|
private diagnosticDetectInvalidFunctionExpressionTypes;
|
|
262
|
+
/**
|
|
263
|
+
* Find functions with either the wrong type of parameters, or the wrong number of parameters
|
|
264
|
+
*/
|
|
158
265
|
private diagnosticDetectInvalidFunctionCalls;
|
|
266
|
+
private addMismatchParamCountDiagnostic;
|
|
159
267
|
getNewExpressions(): AugmentedNewExpression[];
|
|
160
268
|
private validateClasses;
|
|
161
|
-
/**
|
|
162
|
-
* Detect calls to functions with the incorrect number of parameters
|
|
163
|
-
* @param file
|
|
164
|
-
* @param callableContainersByLowerName
|
|
165
|
-
*/
|
|
166
|
-
private diagnosticDetectFunctionCallsWithWrongParamCount;
|
|
167
269
|
/**
|
|
168
270
|
* Detect local variables (vars declared within a function expression) that have the same name as scope calls
|
|
169
271
|
* @param file
|
|
170
272
|
* @param callableContainerMap
|
|
171
273
|
*/
|
|
172
274
|
private diagnosticDetectShadowedLocalVars;
|
|
173
|
-
/**
|
|
174
|
-
* Detect calls to functions that are not defined in this scope
|
|
175
|
-
* @param file
|
|
176
|
-
* @param callablesByLowerName
|
|
177
|
-
*/
|
|
178
|
-
private diagnosticDetectCallsToUnknownFunctions;
|
|
179
275
|
/**
|
|
180
276
|
* Create diagnostics for any duplicate function declarations
|
|
181
277
|
* @param callablesByLowerName
|
|
@@ -193,7 +289,7 @@ export declare class Scope {
|
|
|
193
289
|
* Find the file with the specified relative path
|
|
194
290
|
* @param relativePath
|
|
195
291
|
*/
|
|
196
|
-
protected getFileByRelativePath(relativePath: string):
|
|
292
|
+
protected getFileByRelativePath(relativePath: string): BscFile;
|
|
197
293
|
/**
|
|
198
294
|
* Determine if this file is included in this scope (excluding parent scopes)
|
|
199
295
|
* @param file
|
|
@@ -217,11 +313,11 @@ export declare class Scope {
|
|
|
217
313
|
/**
|
|
218
314
|
* @param className - The name of the class (including namespace if possible)
|
|
219
315
|
* @param callsiteNamespace - the name of the namespace where the call site resides (this is NOT the known namespace of the class).
|
|
220
|
-
* This is used to help resolve non-namespaced class names that reside in the same
|
|
316
|
+
* This is used to help resolve non-namespaced class names that reside in the same namespace as the call site.
|
|
221
317
|
*/
|
|
222
318
|
getClassHierarchy(className: string, callsiteNamespace?: string): FileLink<ClassStatement>[];
|
|
223
319
|
}
|
|
224
|
-
interface NamespaceContainer {
|
|
320
|
+
export interface NamespaceContainer {
|
|
225
321
|
file: BscFile;
|
|
226
322
|
fullName: string;
|
|
227
323
|
nameRange: Range;
|
|
@@ -229,7 +325,8 @@ interface NamespaceContainer {
|
|
|
229
325
|
statements: Statement[];
|
|
230
326
|
classStatements: Record<string, ClassStatement>;
|
|
231
327
|
functionStatements: Record<string, FunctionStatement>;
|
|
232
|
-
|
|
328
|
+
enumStatements: Map<string, EnumStatement>;
|
|
329
|
+
namespaces: Map<string, NamespaceContainer>;
|
|
233
330
|
symbolTable: SymbolTable;
|
|
234
331
|
}
|
|
235
332
|
interface AugmentedNewExpression extends NewExpression {
|