brighterscript 1.0.0-alpha.2 → 1.0.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +542 -253
- package/README.md +30 -9
- package/bsconfig.schema.json +13 -1
- package/dist/BsConfig.d.ts +4 -0
- package/dist/Cache.d.ts +3 -8
- package/dist/Cache.js +9 -14
- 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.js +5 -4
- package/dist/DependencyGraph.js.map +1 -1
- package/dist/DiagnosticFilterer.js +1 -1
- 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 +4 -14
- package/dist/LanguageServer.js +40 -26
- 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 +180 -82
- package/dist/Program.js.map +1 -1
- package/dist/ProgramBuilder.d.ts +4 -0
- package/dist/ProgramBuilder.js +30 -14
- package/dist/ProgramBuilder.js.map +1 -1
- package/dist/Scope.d.ts +100 -28
- package/dist/Scope.js +382 -154
- 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 +40 -13
- package/dist/SymbolTable.js.map +1 -1
- package/dist/XmlScope.d.ts +8 -3
- package/dist/XmlScope.js +65 -27
- package/dist/XmlScope.js.map +1 -1
- package/dist/astUtils/AstEditor.d.ts +33 -0
- package/dist/astUtils/AstEditor.js +107 -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 +170 -0
- package/dist/astUtils/AstEditor.spec.js.map +1 -0
- package/dist/astUtils/creators.d.ts +24 -6
- package/dist/astUtils/creators.js +130 -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 +27 -8
- package/dist/astUtils/reflection.js +66 -1
- 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 +17 -2
- package/dist/astUtils/visitors.js +2 -2
- package/dist/astUtils/visitors.js.map +1 -1
- package/dist/astUtils/visitors.spec.js +31 -29
- 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 +97 -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 +73 -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 +9 -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 +634 -145
- package/dist/files/BrsFile.Class.spec.js.map +1 -1
- package/dist/files/BrsFile.d.ts +62 -30
- package/dist/files/BrsFile.js +683 -335
- package/dist/files/BrsFile.js.map +1 -1
- package/dist/files/BrsFile.spec.js +1055 -449
- package/dist/files/BrsFile.spec.js.map +1 -1
- package/dist/files/XmlFile.d.ts +11 -10
- package/dist/files/XmlFile.js +33 -26
- 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 +23 -4
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +129 -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 +7 -0
- package/dist/parser/BrsTranspileState.js +9 -0
- package/dist/parser/BrsTranspileState.js.map +1 -1
- package/dist/parser/Expression.d.ts +150 -34
- package/dist/parser/Expression.js +337 -150
- 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 +152 -29
- package/dist/parser/Parser.js +1095 -501
- 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 +194 -40
- package/dist/parser/Statement.js +597 -160
- 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/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 +87 -16
- package/dist/util.js +339 -94
- package/dist/util.js.map +1 -1
- package/dist/validators/ClassValidator.d.ts +19 -2
- package/dist/validators/ClassValidator.js +163 -102
- package/dist/validators/ClassValidator.js.map +1 -1
- package/package.json +26 -15
- 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/types/VoidType.js
CHANGED
|
@@ -3,21 +3,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.VoidType = void 0;
|
|
4
4
|
const reflection_1 = require("../astUtils/reflection");
|
|
5
5
|
class VoidType {
|
|
6
|
+
constructor(typeText) {
|
|
7
|
+
this.typeText = typeText;
|
|
8
|
+
}
|
|
6
9
|
isAssignableTo(targetType) {
|
|
7
|
-
return (reflection_1.isVoidType(targetType) ||
|
|
8
|
-
reflection_1.isDynamicType(targetType));
|
|
10
|
+
return ((0, reflection_1.isVoidType)(targetType) ||
|
|
11
|
+
(0, reflection_1.isDynamicType)(targetType));
|
|
9
12
|
}
|
|
10
13
|
isConvertibleTo(targetType) {
|
|
11
14
|
return this.isAssignableTo(targetType);
|
|
12
15
|
}
|
|
13
16
|
toString() {
|
|
14
|
-
|
|
17
|
+
var _a;
|
|
18
|
+
return (_a = this.typeText) !== null && _a !== void 0 ? _a : 'void';
|
|
15
19
|
}
|
|
16
20
|
toTypeString() {
|
|
17
21
|
return this.toString();
|
|
18
22
|
}
|
|
19
23
|
equals(targetType) {
|
|
20
|
-
return reflection_1.isVoidType(targetType);
|
|
24
|
+
return (0, reflection_1.isVoidType)(targetType);
|
|
21
25
|
}
|
|
22
26
|
}
|
|
23
27
|
exports.VoidType = VoidType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VoidType.js","sourceRoot":"","sources":["../../src/types/VoidType.ts"],"names":[],"mappings":";;;AAAA,uDAAmE;AAGnE,MAAa,QAAQ;
|
|
1
|
+
{"version":3,"file":"VoidType.js","sourceRoot":"","sources":["../../src/types/VoidType.ts"],"names":[],"mappings":";;;AAAA,uDAAmE;AAGnE,MAAa,QAAQ;IACjB,YACW,QAAiB;QAAjB,aAAQ,GAAR,QAAQ,CAAS;IACxB,CAAC;IAEE,cAAc,CAAC,UAAmB;QACrC,OAAO,CACH,IAAA,uBAAU,EAAC,UAAU,CAAC;YACtB,IAAA,0BAAa,EAAC,UAAU,CAAC,CAC5B,CAAC;IACN,CAAC;IAEM,eAAe,CAAC,UAAmB;QACtC,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;IAEM,QAAQ;;QACX,OAAO,MAAA,IAAI,CAAC,QAAQ,mCAAI,MAAM,CAAC;IACnC,CAAC;IAEM,YAAY;QACf,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAEM,MAAM,CAAC,UAAmB;QAC7B,OAAO,IAAA,uBAAU,EAAC,UAAU,CAAC,CAAC;IAClC,CAAC;CACJ;AA3BD,4BA2BC"}
|
|
@@ -5,8 +5,8 @@ const DynamicType_1 = require("./DynamicType");
|
|
|
5
5
|
const VoidType_1 = require("./VoidType");
|
|
6
6
|
describe('VoidType', () => {
|
|
7
7
|
it('is equivalent to dynamic types', () => {
|
|
8
|
-
chai_1.expect(new VoidType_1.VoidType().isAssignableTo(new VoidType_1.VoidType())).to.be.true;
|
|
9
|
-
chai_1.expect(new VoidType_1.VoidType().isAssignableTo(new DynamicType_1.DynamicType())).to.be.true;
|
|
8
|
+
(0, chai_1.expect)(new VoidType_1.VoidType().isAssignableTo(new VoidType_1.VoidType())).to.be.true;
|
|
9
|
+
(0, chai_1.expect)(new VoidType_1.VoidType().isAssignableTo(new DynamicType_1.DynamicType())).to.be.true;
|
|
10
10
|
});
|
|
11
11
|
});
|
|
12
12
|
//# sourceMappingURL=VoidType.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VoidType.spec.js","sourceRoot":"","sources":["../../src/types/VoidType.spec.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAE9B,+CAA4C;AAC5C,yCAAsC;AAEtC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACtB,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACtC,aAAM,
|
|
1
|
+
{"version":3,"file":"VoidType.spec.js","sourceRoot":"","sources":["../../src/types/VoidType.spec.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAE9B,+CAA4C;AAC5C,yCAAsC;AAEtC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACtB,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACtC,IAAA,aAAM,EAAC,IAAI,mBAAQ,EAAE,CAAC,cAAc,CAAC,IAAI,mBAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QACjE,IAAA,aAAM,EAAC,IAAI,mBAAQ,EAAE,CAAC,cAAc,CAAC,IAAI,yBAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IACxE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { CallExpression, DottedGetExpression, FunctionExpression, NewExpression, VariableExpression } from '../parser/Expression';
|
|
2
|
+
import type { BscType } from './BscType';
|
|
3
|
+
/**
|
|
4
|
+
* Gets the return type of a function, taking into account that the function may not have been declared yet
|
|
5
|
+
* If the callee already exists in symbol table, use that return type
|
|
6
|
+
* otherwise, make a lazy type which will not compute its type until the file is done parsing
|
|
7
|
+
*
|
|
8
|
+
* @param call the Expression to process
|
|
9
|
+
* @param functionExpression the wrapping function expression
|
|
10
|
+
* @return the best guess type of that expression
|
|
11
|
+
*/
|
|
12
|
+
export declare function getTypeFromCallExpression(call: CallExpression, functionExpression: FunctionExpression): BscType;
|
|
13
|
+
/**
|
|
14
|
+
* Gets the type of a variable
|
|
15
|
+
* if it already exists in symbol table, use that type
|
|
16
|
+
* otherwise defer the type until first read, which will allow us to derive types from variables defined after this one (like from a loop perhaps)
|
|
17
|
+
*
|
|
18
|
+
* @param variable the Expression to process
|
|
19
|
+
* @param functionExpression the wrapping function expression
|
|
20
|
+
* @return the best guess type of that expression
|
|
21
|
+
*/
|
|
22
|
+
export declare function getTypeFromVariableExpression(variable: VariableExpression, functionExpression: FunctionExpression): BscType;
|
|
23
|
+
/**
|
|
24
|
+
* Gets the type of a variable
|
|
25
|
+
* if it already exists in symbol table, use that type
|
|
26
|
+
* otherwise defer the type until first read, which will allow us to derive types from variables defined after this one (like from a loop perhaps)
|
|
27
|
+
*
|
|
28
|
+
* @param newExp the Expression to process
|
|
29
|
+
* @param functionExpression the wrapping function expression
|
|
30
|
+
* @return the best guess type of that expression
|
|
31
|
+
*/
|
|
32
|
+
export declare function getTypeFromNewExpression(newExp: NewExpression, functionExpression: FunctionExpression): BscType;
|
|
33
|
+
/**
|
|
34
|
+
* Gets the type of a variable
|
|
35
|
+
* if it already exists in symbol table, use that type
|
|
36
|
+
* otherwise defer the type until first read, which will allow us to derive types from variables defined after this one (like from a loop perhaps)
|
|
37
|
+
*
|
|
38
|
+
* @param variable the Expression to process
|
|
39
|
+
* @param functionExpression the wrapping function expression
|
|
40
|
+
* @return the best guess type of that expression
|
|
41
|
+
*/
|
|
42
|
+
export declare function getTypeFromDottedGetExpression(expr: DottedGetExpression, functionExpression: FunctionExpression): BscType;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTypeFromDottedGetExpression = exports.getTypeFromNewExpression = exports.getTypeFromVariableExpression = exports.getTypeFromCallExpression = void 0;
|
|
4
|
+
const reflection_1 = require("../astUtils/reflection");
|
|
5
|
+
const LazyType_1 = require("./LazyType");
|
|
6
|
+
const UninitializedType_1 = require("./UninitializedType");
|
|
7
|
+
const Parser_1 = require("../parser/Parser");
|
|
8
|
+
const CustomType_1 = require("./CustomType");
|
|
9
|
+
const DynamicType_1 = require("./DynamicType");
|
|
10
|
+
/**
|
|
11
|
+
* Gets the return type of a function, taking into account that the function may not have been declared yet
|
|
12
|
+
* If the callee already exists in symbol table, use that return type
|
|
13
|
+
* otherwise, make a lazy type which will not compute its type until the file is done parsing
|
|
14
|
+
*
|
|
15
|
+
* @param call the Expression to process
|
|
16
|
+
* @param functionExpression the wrapping function expression
|
|
17
|
+
* @return the best guess type of that expression
|
|
18
|
+
*/
|
|
19
|
+
function getTypeFromCallExpression(call, functionExpression) {
|
|
20
|
+
let calleeName = call.callee.name;
|
|
21
|
+
if (calleeName) {
|
|
22
|
+
const currentKnownType = functionExpression.symbolTable.getSymbolType(calleeName.text.toLowerCase());
|
|
23
|
+
if ((0, reflection_1.isTypedFunctionType)(currentKnownType)) {
|
|
24
|
+
return currentKnownType.returnType;
|
|
25
|
+
}
|
|
26
|
+
if (currentKnownType) {
|
|
27
|
+
// this will probably only happen if a functionName has been assigned to something else previously?
|
|
28
|
+
return currentKnownType;
|
|
29
|
+
}
|
|
30
|
+
return new LazyType_1.LazyType((context) => {
|
|
31
|
+
var _a;
|
|
32
|
+
let futureType;
|
|
33
|
+
if ((0, reflection_1.isBrsFile)(context === null || context === void 0 ? void 0 : context.file)) {
|
|
34
|
+
const file = context.file;
|
|
35
|
+
futureType = (_a = file.getSymbolTypeFromToken(calleeName, functionExpression, context.scope)) === null || _a === void 0 ? void 0 : _a.type;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
// Give best guess if there is no file context
|
|
39
|
+
futureType = functionExpression.symbolTable.getSymbolType(calleeName.text);
|
|
40
|
+
}
|
|
41
|
+
if ((0, reflection_1.isTypedFunctionType)(futureType)) {
|
|
42
|
+
return futureType.returnType;
|
|
43
|
+
}
|
|
44
|
+
return futureType;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
//return dynamic if we can't figure out the type
|
|
49
|
+
return new DynamicType_1.DynamicType();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.getTypeFromCallExpression = getTypeFromCallExpression;
|
|
53
|
+
/**
|
|
54
|
+
* Gets the type of a variable
|
|
55
|
+
* if it already exists in symbol table, use that type
|
|
56
|
+
* otherwise defer the type until first read, which will allow us to derive types from variables defined after this one (like from a loop perhaps)
|
|
57
|
+
*
|
|
58
|
+
* @param variable the Expression to process
|
|
59
|
+
* @param functionExpression the wrapping function expression
|
|
60
|
+
* @return the best guess type of that expression
|
|
61
|
+
*/
|
|
62
|
+
function getTypeFromVariableExpression(variable, functionExpression) {
|
|
63
|
+
let variableName = variable.name.text.toLowerCase();
|
|
64
|
+
const currentKnownType = functionExpression.symbolTable.getSymbolType(variableName);
|
|
65
|
+
if ((0, reflection_1.isPrimitiveType)(currentKnownType) || (0, reflection_1.isArrayType)(currentKnownType)) {
|
|
66
|
+
// for "contextless" types, eg. myVar = 3.14
|
|
67
|
+
return currentKnownType;
|
|
68
|
+
}
|
|
69
|
+
return resolveLazyType(variable.name, functionExpression);
|
|
70
|
+
}
|
|
71
|
+
exports.getTypeFromVariableExpression = getTypeFromVariableExpression;
|
|
72
|
+
/**
|
|
73
|
+
* Gets the type of a variable
|
|
74
|
+
* if it already exists in symbol table, use that type
|
|
75
|
+
* otherwise defer the type until first read, which will allow us to derive types from variables defined after this one (like from a loop perhaps)
|
|
76
|
+
*
|
|
77
|
+
* @param newExp the Expression to process
|
|
78
|
+
* @param functionExpression the wrapping function expression
|
|
79
|
+
* @return the best guess type of that expression
|
|
80
|
+
*/
|
|
81
|
+
function getTypeFromNewExpression(newExp, functionExpression) {
|
|
82
|
+
let className = newExp.className.getName(Parser_1.ParseMode.BrighterScript);
|
|
83
|
+
return new LazyType_1.LazyType((context) => {
|
|
84
|
+
var _a, _b, _c;
|
|
85
|
+
return new CustomType_1.CustomType(className, (_c = (_a = context === null || context === void 0 ? void 0 : context.scope) === null || _a === void 0 ? void 0 : _a.getClass(className, (_b = functionExpression.namespaceName) === null || _b === void 0 ? void 0 : _b.getName())) === null || _c === void 0 ? void 0 : _c.memberTable);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
exports.getTypeFromNewExpression = getTypeFromNewExpression;
|
|
89
|
+
function resolveLazyType(currentToken, functionExpression) {
|
|
90
|
+
return new LazyType_1.LazyType((context) => {
|
|
91
|
+
var _a, _b;
|
|
92
|
+
let futureType;
|
|
93
|
+
if ((0, reflection_1.isBrsFile)(context === null || context === void 0 ? void 0 : context.file)) {
|
|
94
|
+
const file = context.file;
|
|
95
|
+
futureType = (_a = file.getSymbolTypeFromToken(currentToken, functionExpression, context.scope)) === null || _a === void 0 ? void 0 : _a.type;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
// Give best guess if there is no file context
|
|
99
|
+
futureType = (_b = functionExpression.symbolTable.getSymbolType(currentToken.text)) !== null && _b !== void 0 ? _b : new UninitializedType_1.UninitializedType();
|
|
100
|
+
}
|
|
101
|
+
return futureType;
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Gets the type of a variable
|
|
106
|
+
* if it already exists in symbol table, use that type
|
|
107
|
+
* otherwise defer the type until first read, which will allow us to derive types from variables defined after this one (like from a loop perhaps)
|
|
108
|
+
*
|
|
109
|
+
* @param variable the Expression to process
|
|
110
|
+
* @param functionExpression the wrapping function expression
|
|
111
|
+
* @return the best guess type of that expression
|
|
112
|
+
*/
|
|
113
|
+
function getTypeFromDottedGetExpression(expr, functionExpression) {
|
|
114
|
+
const currentToken = (0, reflection_1.isCallExpression)(expr) ? (expr.callee).name : expr.name;
|
|
115
|
+
return resolveLazyType(currentToken, functionExpression);
|
|
116
|
+
}
|
|
117
|
+
exports.getTypeFromDottedGetExpression = getTypeFromDottedGetExpression;
|
|
118
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/types/helpers.ts"],"names":[],"mappings":"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"}
|
package/dist/util.d.ts
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import * as rokuDeploy from 'roku-deploy';
|
|
2
2
|
import type { Diagnostic, Position, Range } from 'vscode-languageserver';
|
|
3
3
|
import type { BsConfig } from './BsConfig';
|
|
4
|
-
import type { CallableContainer, BsDiagnostic, FileReference, CallableContainerMap, CompilerPlugin, ExpressionInfo, FunctionCall } from './interfaces';
|
|
4
|
+
import type { CallableContainer, BsDiagnostic, FileReference, CallableContainerMap, CompilerPlugin, ExpressionInfo, FunctionCall, CallableParam, TranspileResult } from './interfaces';
|
|
5
5
|
import { BooleanType } from './types/BooleanType';
|
|
6
6
|
import { DoubleType } from './types/DoubleType';
|
|
7
7
|
import { DynamicType } from './types/DynamicType';
|
|
8
8
|
import { FloatType } from './types/FloatType';
|
|
9
|
-
import { FunctionType } from './types/FunctionType';
|
|
10
9
|
import { IntegerType } from './types/IntegerType';
|
|
11
10
|
import { InvalidType } from './types/InvalidType';
|
|
12
11
|
import { LongIntegerType } from './types/LongIntegerType';
|
|
13
|
-
import { ObjectType } from './types/ObjectType';
|
|
14
12
|
import { StringType } from './types/StringType';
|
|
15
13
|
import { VoidType } from './types/VoidType';
|
|
16
|
-
import type { DottedGetExpression, Expression, VariableExpression } from './parser/Expression';
|
|
17
|
-
import type { Token } from './lexer';
|
|
18
|
-
import { CustomType } from './types/CustomType';
|
|
14
|
+
import type { DottedGetExpression, Expression, NamespacedVariableNameExpression, VariableExpression } from './parser/Expression';
|
|
15
|
+
import type { Locatable, Token } from './lexer/Token';
|
|
19
16
|
import { SourceNode } from 'source-map';
|
|
20
|
-
import
|
|
17
|
+
import { SGAttribute } from './parser/SGTypes';
|
|
18
|
+
import type { BscType } from './types/BscType';
|
|
19
|
+
import { FunctionType } from './types/FunctionType';
|
|
21
20
|
export declare class Util {
|
|
22
21
|
clearConsole(): void;
|
|
23
22
|
/**
|
|
@@ -62,12 +61,11 @@ export declare class Util {
|
|
|
62
61
|
*/
|
|
63
62
|
loadConfigFile(configFilePath: string, parentProjectPaths?: string[], cwd?: string): BsConfig;
|
|
64
63
|
/**
|
|
65
|
-
*
|
|
66
|
-
* and
|
|
67
|
-
* @param
|
|
68
|
-
* @param configFilePath Path of the configuration file
|
|
64
|
+
* Convert relative paths to absolute paths, relative to the given directory. Also de-dupes the paths. Modifies the array in-place
|
|
65
|
+
* @param paths the list of paths to be resolved and deduped
|
|
66
|
+
* @param relativeDir the path to the folder where the paths should be resolved relative to. This should be an absolute path
|
|
69
67
|
*/
|
|
70
|
-
|
|
68
|
+
resolvePathsRelativeTo(collection: any, key: string, relativeDir: string): void;
|
|
71
69
|
/**
|
|
72
70
|
* Do work within the scope of a changed current working directory
|
|
73
71
|
* @param targetCwd
|
|
@@ -258,6 +256,13 @@ export declare class Util {
|
|
|
258
256
|
* Create a `Range` from two `Position`s
|
|
259
257
|
*/
|
|
260
258
|
createRangeFromPositions(startPosition: Position, endPosition: Position): Range;
|
|
259
|
+
/**
|
|
260
|
+
* Given a list of ranges, create a range that starts with the first non-null lefthand range, and ends with the first non-null
|
|
261
|
+
* righthand range. Returns undefined if none of the items have a range.
|
|
262
|
+
*/
|
|
263
|
+
createBoundingRange(...locatables: Array<{
|
|
264
|
+
range?: Range;
|
|
265
|
+
}>): Range;
|
|
261
266
|
/**
|
|
262
267
|
* Create a `Position` object. Prefer this over `Position.create` for performance reasons
|
|
263
268
|
*/
|
|
@@ -272,7 +277,7 @@ export declare class Util {
|
|
|
272
277
|
/**
|
|
273
278
|
* Convert a token into a BscType
|
|
274
279
|
*/
|
|
275
|
-
tokenToBscType(token: Token,
|
|
280
|
+
tokenToBscType(token: Token, allowBrighterscriptTypes?: boolean, currentNamespaceName?: NamespacedVariableNameExpression): DynamicType | BscType | FloatType | IntegerType | DoubleType | LongIntegerType | StringType | BooleanType | FunctionType | InvalidType | VoidType;
|
|
276
281
|
/**
|
|
277
282
|
* Get the extension for the given file path. Basically the part after the final dot, except for
|
|
278
283
|
* `d.bs` which is treated as single extension
|
|
@@ -294,14 +299,26 @@ export declare class Util {
|
|
|
294
299
|
*/
|
|
295
300
|
simpleMap(source: string, src: string): SourceNode;
|
|
296
301
|
/**
|
|
297
|
-
* Creates a new SGAttribute object, but keeps the existing Range references (since those
|
|
302
|
+
* Creates a new SGAttribute object, but keeps the existing Range references (since those should be immutable)
|
|
298
303
|
*/
|
|
299
304
|
cloneSGAttribute(attr: SGAttribute, value: string): SGAttribute;
|
|
305
|
+
/**
|
|
306
|
+
* Shorthand for creating a new source node
|
|
307
|
+
*/
|
|
308
|
+
sourceNode(source: string, locatable: {
|
|
309
|
+
range: Range;
|
|
310
|
+
}, code: string | SourceNode | TranspileResult): SourceNode | undefined;
|
|
300
311
|
/**
|
|
301
312
|
* Remove leading simple protocols from a path (if present)
|
|
302
313
|
*/
|
|
303
314
|
removeProtocol(pkgPath: string): string;
|
|
315
|
+
/**
|
|
316
|
+
* Converts a path into a standardized format (drive letter to lower, remove extra slashes, use single slash type, resolve relative parts, etc...)
|
|
317
|
+
*/
|
|
304
318
|
standardizePath(thePath: string): string;
|
|
319
|
+
/**
|
|
320
|
+
* Copy the version of bslib from local node_modules to the staging folder
|
|
321
|
+
*/
|
|
305
322
|
copyBslibToStaging(stagingDir: string): Promise<void>;
|
|
306
323
|
/**
|
|
307
324
|
* Given a Diagnostic or BsDiagnostic, return a copy of the diagnostic
|
|
@@ -318,11 +335,60 @@ export declare class Util {
|
|
|
318
335
|
source: string;
|
|
319
336
|
};
|
|
320
337
|
/**
|
|
321
|
-
*
|
|
338
|
+
* Gets the minimum and maximum number of allowed params
|
|
339
|
+
* @param params The list of callable parameters to check
|
|
340
|
+
* @returns the minimum and maximum number of allowed params
|
|
341
|
+
*/
|
|
342
|
+
getMinMaxParamCount(params: CallableParam[]): MinMax;
|
|
343
|
+
/**
|
|
344
|
+
* Gets the minimum and maximum number of allowed params for ALL functions with the name of the function call
|
|
345
|
+
* @param callablesByLowerName The map of callable containers
|
|
346
|
+
* @param expCall function call expression to use for the name
|
|
347
|
+
* @returns the minimum and maximum number of allowed params
|
|
348
|
+
*/
|
|
349
|
+
getMinMaxParamCountByFunctionCall(callablesByLowerName: CallableContainerMap, expCall: FunctionCall): MinMax;
|
|
350
|
+
/**
|
|
351
|
+
* Finds the array of callables from a container map, based on the name of the function call
|
|
322
352
|
* If the callable was called in a function in a namespace, functions in that namespace are preferred
|
|
353
|
+
* @param callablesByLowerName The map of callable containers
|
|
354
|
+
* @param expCall function call expression to use for the name
|
|
323
355
|
* @return an array with callable containers - could be empty if nothing was found
|
|
324
356
|
*/
|
|
325
|
-
|
|
357
|
+
getCallableContainersByName(callablesByLowerName: CallableContainerMap, expCall: FunctionCall): CallableContainer[];
|
|
358
|
+
/**
|
|
359
|
+
* Sort an array of objects that have a Range
|
|
360
|
+
*/
|
|
361
|
+
sortByRange(locatables: Locatable[]): Locatable[];
|
|
362
|
+
/**
|
|
363
|
+
* Split the given text and return ranges for each chunk.
|
|
364
|
+
* Only works for single-line strings
|
|
365
|
+
*/
|
|
366
|
+
splitGetRange(separator: string, text: string, range: Range): {
|
|
367
|
+
text: string;
|
|
368
|
+
range: Range;
|
|
369
|
+
}[];
|
|
370
|
+
mdFence(code: string, language?: string): string;
|
|
371
|
+
/**
|
|
372
|
+
* Finds a callable from a container map based on the name AND number of arguments
|
|
373
|
+
* If the callable was called in a function in a namespace, functions in that namespace are preferred
|
|
374
|
+
* The first callable that matches the name AND will accept the number of arguments given is returned
|
|
375
|
+
* @return a callable containers that matches the call
|
|
376
|
+
*/
|
|
377
|
+
getCallableContainerByFunctionCall(callablesByLowerName: CallableContainerMap, expCall: FunctionCall): CallableContainer;
|
|
378
|
+
/**
|
|
379
|
+
* Gets each part of the dotted get.
|
|
380
|
+
* @param expression
|
|
381
|
+
* @returns an array of the parts of the dotted get. If not fully a dotted get, then returns undefined
|
|
382
|
+
*/
|
|
383
|
+
getAllDottedGetParts(expression: Expression): string[] | undefined;
|
|
384
|
+
/**
|
|
385
|
+
* Returns an integer if valid, or undefined. Eliminates checking for NaN
|
|
386
|
+
*/
|
|
387
|
+
parseInt(value: any): number;
|
|
388
|
+
/**
|
|
389
|
+
* Converts a range to a string in the format 1:2-3:4
|
|
390
|
+
*/
|
|
391
|
+
rangeToString(range: Range): string;
|
|
326
392
|
}
|
|
327
393
|
/**
|
|
328
394
|
* A tagged template literal function for standardizing the path. This has to be defined as standalone function since it's a tagged template literal function,
|
|
@@ -331,3 +397,8 @@ export declare class Util {
|
|
|
331
397
|
export declare function standardizePath(stringParts: any, ...expressions: any[]): string;
|
|
332
398
|
export declare let util: Util;
|
|
333
399
|
export default util;
|
|
400
|
+
export interface MinMax {
|
|
401
|
+
min: number;
|
|
402
|
+
max: number;
|
|
403
|
+
}
|
|
404
|
+
export declare const MAX_PARAM_COUNT = 32;
|