brighterscript 0.66.0-alpha.1 → 0.66.0-alpha.11
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 +224 -10
- package/README.md +13 -3
- package/bsconfig.schema.json +15 -0
- package/dist/ActionPipeline.d.ts +10 -0
- package/dist/ActionPipeline.js +40 -0
- package/dist/ActionPipeline.js.map +1 -0
- package/dist/AstValidationSegmenter.d.ts +25 -0
- package/dist/AstValidationSegmenter.js +150 -0
- package/dist/AstValidationSegmenter.js.map +1 -0
- package/dist/BsConfig.d.ts +13 -4
- package/dist/BusyStatusTracker.d.ts +31 -0
- package/dist/BusyStatusTracker.js +83 -0
- package/dist/BusyStatusTracker.js.map +1 -0
- package/dist/Cache.js +3 -3
- package/dist/Cache.js.map +1 -1
- package/dist/CacheVerifier.d.ts +0 -1
- package/dist/CodeActionUtil.d.ts +2 -2
- package/dist/CommentFlagProcessor.d.ts +4 -3
- package/dist/CommentFlagProcessor.js.map +1 -1
- package/dist/DiagnosticCollection.js +8 -5
- package/dist/DiagnosticCollection.js.map +1 -1
- package/dist/DiagnosticMessages.d.ts +34 -4
- package/dist/DiagnosticMessages.js +59 -4
- package/dist/DiagnosticMessages.js.map +1 -1
- package/dist/FunctionScope.d.ts +1 -1
- package/dist/LanguageServer.d.ts +23 -1
- package/dist/LanguageServer.js +139 -57
- package/dist/LanguageServer.js.map +1 -1
- package/dist/Logger.d.ts +3 -2
- package/dist/Logger.js +10 -2
- package/dist/Logger.js.map +1 -1
- package/dist/PluginInterface.d.ts +11 -2
- package/dist/PluginInterface.js +69 -10
- package/dist/PluginInterface.js.map +1 -1
- package/dist/Program.d.ts +138 -49
- package/dist/Program.js +644 -349
- package/dist/Program.js.map +1 -1
- package/dist/ProgramBuilder.d.ts +10 -4
- package/dist/ProgramBuilder.js +76 -74
- package/dist/ProgramBuilder.js.map +1 -1
- package/dist/Scope.d.ts +52 -49
- package/dist/Scope.js +298 -274
- package/dist/Scope.js.map +1 -1
- package/dist/SymbolTable.d.ts +35 -14
- package/dist/SymbolTable.js +90 -29
- package/dist/SymbolTable.js.map +1 -1
- package/dist/Throttler.d.ts +12 -0
- package/dist/Throttler.js +39 -0
- package/dist/Throttler.js.map +1 -1
- package/dist/XmlScope.d.ts +7 -4
- package/dist/XmlScope.js +52 -12
- package/dist/XmlScope.js.map +1 -1
- package/dist/astUtils/{AstEditor.d.ts → Editor.d.ts} +6 -1
- package/dist/astUtils/{AstEditor.js → Editor.js} +9 -3
- package/dist/astUtils/Editor.js.map +1 -0
- package/dist/astUtils/{AstEditor.spec.js → Editor.spec.js} +10 -6
- package/dist/astUtils/Editor.spec.js.map +1 -0
- package/dist/astUtils/creators.d.ts +3 -1
- package/dist/astUtils/creators.js +14 -4
- package/dist/astUtils/creators.js.map +1 -1
- package/dist/astUtils/reflection.d.ts +37 -9
- package/dist/astUtils/reflection.js +83 -14
- package/dist/astUtils/reflection.js.map +1 -1
- package/dist/astUtils/reflection.spec.js +87 -5
- package/dist/astUtils/reflection.spec.js.map +1 -1
- package/dist/astUtils/visitors.d.ts +14 -3
- package/dist/astUtils/visitors.js +22 -2
- package/dist/astUtils/visitors.js.map +1 -1
- package/dist/astUtils/visitors.spec.js +58 -7
- package/dist/astUtils/visitors.spec.js.map +1 -1
- package/dist/bscPlugin/BscPlugin.d.ts +10 -2
- package/dist/bscPlugin/BscPlugin.js +24 -4
- package/dist/bscPlugin/BscPlugin.js.map +1 -1
- package/dist/bscPlugin/CallExpressionInfo.d.ts +3 -3
- package/dist/bscPlugin/CallExpressionInfo.js.map +1 -1
- package/dist/bscPlugin/FileWriter.d.ts +6 -0
- package/dist/bscPlugin/FileWriter.js +24 -0
- package/dist/bscPlugin/FileWriter.js.map +1 -0
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +8 -8
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js +4 -4
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js.map +1 -1
- package/dist/bscPlugin/completions/CompletionsProcessor.d.ts +50 -1
- package/dist/bscPlugin/completions/CompletionsProcessor.js +445 -23
- package/dist/bscPlugin/completions/CompletionsProcessor.js.map +1 -1
- package/dist/bscPlugin/completions/CompletionsProcessor.spec.js +1737 -0
- package/dist/bscPlugin/completions/CompletionsProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/fileProviders/FileProvider.d.ts +9 -0
- package/dist/bscPlugin/fileProviders/FileProvider.js +51 -0
- package/dist/bscPlugin/fileProviders/FileProvider.js.map +1 -0
- package/dist/bscPlugin/hover/HoverProcessor.d.ts +7 -3
- package/dist/bscPlugin/hover/HoverProcessor.js +133 -103
- package/dist/bscPlugin/hover/HoverProcessor.js.map +1 -1
- package/dist/bscPlugin/hover/HoverProcessor.spec.js +241 -29
- package/dist/bscPlugin/hover/HoverProcessor.spec.js.map +1 -1
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.d.ts +1 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +43 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -1
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js +22 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js.map +1 -1
- package/dist/bscPlugin/serialize/BslibInjector.spec.js +19 -0
- package/dist/bscPlugin/serialize/BslibInjector.spec.js.map +1 -0
- package/dist/bscPlugin/serialize/BslibManager.d.ts +9 -0
- package/dist/bscPlugin/serialize/BslibManager.js +40 -0
- package/dist/bscPlugin/serialize/BslibManager.js.map +1 -0
- package/dist/bscPlugin/serialize/FileSerializer.d.ts +9 -0
- package/dist/bscPlugin/serialize/FileSerializer.js +72 -0
- package/dist/bscPlugin/serialize/FileSerializer.js.map +1 -0
- package/dist/bscPlugin/transpile/{BrsFilePreTranspileProcessor.d.ts → BrsFileTranspileProcessor.d.ts} +4 -2
- package/dist/bscPlugin/transpile/{BrsFilePreTranspileProcessor.js → BrsFileTranspileProcessor.js} +29 -5
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js.map +1 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.d.ts +1 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js +41 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.d.ts +2 -2
- package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.js.map +1 -1
- package/dist/bscPlugin/validation/BrsFileValidator.d.ts +0 -4
- package/dist/bscPlugin/validation/BrsFileValidator.js +34 -29
- package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -1
- package/dist/bscPlugin/validation/BrsFileValidator.spec.js +1 -1
- package/dist/bscPlugin/validation/BrsFileValidator.spec.js.map +1 -1
- package/dist/bscPlugin/validation/ScopeValidator.d.ts +28 -7
- package/dist/bscPlugin/validation/ScopeValidator.js +393 -205
- package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -1
- package/dist/bscPlugin/validation/ScopeValidator.spec.d.ts +1 -0
- package/dist/bscPlugin/validation/ScopeValidator.spec.js +2038 -0
- package/dist/bscPlugin/validation/ScopeValidator.spec.js.map +1 -0
- package/dist/bscPlugin/validation/XmlFileValidator.js +2 -2
- package/dist/bscPlugin/validation/XmlFileValidator.js.map +1 -1
- package/dist/cli.js +104 -13
- package/dist/cli.js.map +1 -1
- package/dist/deferred.d.ts +3 -3
- package/dist/deferred.js.map +1 -1
- package/dist/diagnosticUtils.d.ts +8 -2
- package/dist/diagnosticUtils.js +45 -16
- package/dist/diagnosticUtils.js.map +1 -1
- package/dist/examples/plugins/removePrint.js +1 -1
- package/dist/examples/plugins/removePrint.js.map +1 -1
- package/dist/files/AssetFile.d.ts +26 -0
- package/dist/files/AssetFile.js +26 -0
- package/dist/files/AssetFile.js.map +1 -0
- package/dist/files/BrsFile.Class.spec.js +383 -56
- package/dist/files/BrsFile.Class.spec.js.map +1 -1
- package/dist/files/BrsFile.d.ts +73 -46
- package/dist/files/BrsFile.js +370 -534
- package/dist/files/BrsFile.js.map +1 -1
- package/dist/files/BrsFile.spec.js +1139 -682
- package/dist/files/BrsFile.spec.js.map +1 -1
- package/dist/files/Factory.d.ts +25 -0
- package/dist/files/Factory.js +22 -0
- package/dist/files/Factory.js.map +1 -0
- package/dist/files/File.d.ts +106 -0
- package/dist/files/File.js +16 -0
- package/dist/files/File.js.map +1 -0
- package/dist/files/LazyFileData.d.ts +20 -0
- package/dist/files/LazyFileData.js +54 -0
- package/dist/files/LazyFileData.js.map +1 -0
- package/dist/files/LazyFileData.spec.d.ts +1 -0
- package/dist/files/LazyFileData.spec.js +27 -0
- package/dist/files/LazyFileData.spec.js.map +1 -0
- package/dist/files/XmlFile.d.ts +56 -23
- package/dist/files/XmlFile.js +88 -60
- package/dist/files/XmlFile.js.map +1 -1
- package/dist/files/XmlFile.spec.js +64 -93
- package/dist/files/XmlFile.spec.js.map +1 -1
- package/dist/files/tests/imports.spec.js +21 -8
- package/dist/files/tests/imports.spec.js.map +1 -1
- package/dist/files/tests/optionalChaning.spec.js +14 -14
- package/dist/files/tests/optionalChaning.spec.js.map +1 -1
- package/dist/globalCallables.js +88 -84
- package/dist/globalCallables.js.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +389 -94
- package/dist/interfaces.js +13 -2
- package/dist/interfaces.js.map +1 -1
- package/dist/lexer/Lexer.d.ts +12 -0
- package/dist/lexer/Lexer.js +28 -8
- package/dist/lexer/Lexer.js.map +1 -1
- package/dist/lexer/Lexer.spec.js +40 -0
- package/dist/lexer/Lexer.spec.js.map +1 -1
- package/dist/lexer/Token.d.ts +4 -0
- package/dist/lexer/Token.js.map +1 -1
- package/dist/lexer/TokenKind.d.ts +5 -0
- package/dist/lexer/TokenKind.js +14 -2
- package/dist/lexer/TokenKind.js.map +1 -1
- package/dist/parser/AstNode.d.ts +9 -2
- package/dist/parser/AstNode.js +16 -0
- package/dist/parser/AstNode.js.map +1 -1
- package/dist/parser/BrsTranspileState.d.ts +3 -2
- package/dist/parser/BrsTranspileState.js +3 -2
- package/dist/parser/BrsTranspileState.js.map +1 -1
- package/dist/parser/Expression.d.ts +21 -5
- package/dist/parser/Expression.js +130 -35
- package/dist/parser/Expression.js.map +1 -1
- package/dist/parser/Parser.Class.spec.js +103 -1
- package/dist/parser/Parser.Class.spec.js.map +1 -1
- package/dist/parser/Parser.d.ts +7 -0
- package/dist/parser/Parser.js +117 -21
- package/dist/parser/Parser.js.map +1 -1
- package/dist/parser/Parser.spec.js +557 -5
- package/dist/parser/Parser.spec.js.map +1 -1
- package/dist/parser/SGParser.d.ts +4 -4
- package/dist/parser/SGParser.js +3 -3
- package/dist/parser/SGParser.js.map +1 -1
- package/dist/parser/SGParser.spec.js +2 -2
- package/dist/parser/SGParser.spec.js.map +1 -1
- package/dist/parser/SGTypes.d.ts +2 -2
- package/dist/parser/Statement.d.ts +37 -12
- package/dist/parser/Statement.js +153 -46
- package/dist/parser/Statement.js.map +1 -1
- package/dist/parser/tests/Parser.spec.js +2 -1
- package/dist/parser/tests/Parser.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/For.spec.js +16 -8
- package/dist/parser/tests/controlFlow/For.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/ForEach.spec.js +12 -6
- package/dist/parser/tests/controlFlow/ForEach.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/While.spec.js +8 -4
- package/dist/parser/tests/controlFlow/While.spec.js.map +1 -1
- package/dist/parser/tests/expression/Call.spec.js +4 -4
- package/dist/parser/tests/expression/Call.spec.js.map +1 -1
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +29 -29
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/RegexLiteralExpression.spec.js +10 -10
- package/dist/parser/tests/expression/RegexLiteralExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/SourceLiteralExpression.spec.js +24 -24
- package/dist/parser/tests/expression/SourceLiteralExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js +75 -36
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TernaryExpression.spec.js +36 -36
- package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/UnaryExpression.spec.d.ts +1 -0
- package/dist/parser/tests/expression/UnaryExpression.spec.js +52 -0
- package/dist/parser/tests/expression/UnaryExpression.spec.js.map +1 -0
- package/dist/parser/tests/statement/ConstStatement.spec.js +71 -22
- package/dist/parser/tests/statement/ConstStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/Continue.spec.js +2 -2
- package/dist/parser/tests/statement/Continue.spec.js.map +1 -1
- package/dist/parser/tests/statement/Enum.spec.js +38 -285
- package/dist/parser/tests/statement/Enum.spec.js.map +1 -1
- package/dist/parser/tests/statement/For.spec.js +6 -6
- package/dist/parser/tests/statement/For.spec.js.map +1 -1
- package/dist/parser/tests/statement/ForEach.spec.js +4 -4
- package/dist/parser/tests/statement/ForEach.spec.js.map +1 -1
- package/dist/parser/tests/statement/InterfaceStatement.spec.js +26 -10
- package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/PrintStatement.spec.js +16 -13
- package/dist/parser/tests/statement/PrintStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/ReturnStatement.spec.js +5 -3
- package/dist/parser/tests/statement/ReturnStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/Set.spec.js +26 -13
- package/dist/parser/tests/statement/Set.spec.js.map +1 -1
- package/dist/preprocessor/Manifest.d.ts +1 -1
- package/dist/preprocessor/Manifest.js +2 -2
- package/dist/preprocessor/Manifest.js.map +1 -1
- package/dist/roku-types/data.json +244 -294
- package/dist/roku-types/index.d.ts +17 -38
- package/dist/types/ArrayType.d.ts +4 -1
- package/dist/types/ArrayType.js +46 -6
- package/dist/types/ArrayType.js.map +1 -1
- package/dist/types/ArrayType.spec.js +32 -3
- package/dist/types/ArrayType.spec.js.map +1 -1
- package/dist/types/AssociativeArrayType.d.ts +11 -0
- package/dist/types/AssociativeArrayType.js +52 -0
- package/dist/types/AssociativeArrayType.js.map +1 -0
- package/dist/types/BaseFunctionType.d.ts +9 -0
- package/dist/types/BaseFunctionType.js +25 -0
- package/dist/types/BaseFunctionType.js.map +1 -0
- package/dist/types/BooleanType.d.ts +2 -1
- package/dist/types/BooleanType.js +8 -2
- package/dist/types/BooleanType.js.map +1 -1
- package/dist/types/BscType.d.ts +10 -6
- package/dist/types/BscType.js +69 -16
- package/dist/types/BscType.js.map +1 -1
- package/dist/types/BscTypeKind.d.ts +3 -0
- package/dist/types/BscTypeKind.js +3 -0
- package/dist/types/BscTypeKind.js.map +1 -1
- package/dist/types/BuiltInInterfaceAdder.d.ts +23 -0
- package/dist/types/BuiltInInterfaceAdder.js +164 -0
- package/dist/types/BuiltInInterfaceAdder.js.map +1 -0
- package/dist/types/BuiltInInterfaceAdder.spec.d.ts +1 -0
- package/dist/types/BuiltInInterfaceAdder.spec.js +116 -0
- package/dist/types/BuiltInInterfaceAdder.spec.js.map +1 -0
- package/dist/types/ClassType.d.ts +10 -4
- package/dist/types/ClassType.js +32 -5
- package/dist/types/ClassType.js.map +1 -1
- package/dist/types/ClassType.spec.js +5 -3
- package/dist/types/ClassType.spec.js.map +1 -1
- package/dist/types/ComponentType.d.ts +26 -0
- package/dist/types/ComponentType.js +83 -0
- package/dist/types/ComponentType.js.map +1 -0
- package/dist/types/DoubleType.d.ts +2 -1
- package/dist/types/DoubleType.js +9 -2
- package/dist/types/DoubleType.js.map +1 -1
- package/dist/types/DynamicType.d.ts +2 -2
- package/dist/types/DynamicType.js +3 -1
- package/dist/types/DynamicType.js.map +1 -1
- package/dist/types/EnumType.d.ts +24 -6
- package/dist/types/EnumType.js +29 -7
- package/dist/types/EnumType.js.map +1 -1
- package/dist/types/FloatType.d.ts +2 -1
- package/dist/types/FloatType.js +9 -2
- package/dist/types/FloatType.js.map +1 -1
- package/dist/types/FunctionType.d.ts +8 -20
- package/dist/types/FunctionType.js +17 -45
- package/dist/types/FunctionType.js.map +1 -1
- package/dist/types/InheritableType.d.ts +7 -4
- package/dist/types/InheritableType.js +67 -3
- package/dist/types/InheritableType.js.map +1 -1
- package/dist/types/IntegerType.d.ts +2 -1
- package/dist/types/IntegerType.js +9 -2
- package/dist/types/IntegerType.js.map +1 -1
- package/dist/types/InterfaceType.d.ts +6 -4
- package/dist/types/InterfaceType.js +8 -11
- package/dist/types/InterfaceType.js.map +1 -1
- package/dist/types/InterfaceType.spec.js +30 -2
- package/dist/types/InterfaceType.spec.js.map +1 -1
- package/dist/types/InvalidType.d.ts +2 -1
- package/dist/types/InvalidType.js +7 -1
- package/dist/types/InvalidType.js.map +1 -1
- package/dist/types/LongIntegerType.d.ts +2 -1
- package/dist/types/LongIntegerType.js +9 -2
- package/dist/types/LongIntegerType.js.map +1 -1
- package/dist/types/NamespaceType.d.ts +2 -1
- package/dist/types/NamespaceType.js +3 -0
- package/dist/types/NamespaceType.js.map +1 -1
- package/dist/types/ObjectType.d.ts +2 -2
- package/dist/types/ObjectType.js +5 -10
- package/dist/types/ObjectType.js.map +1 -1
- package/dist/types/ReferenceType.d.ts +15 -3
- package/dist/types/ReferenceType.js +173 -24
- package/dist/types/ReferenceType.js.map +1 -1
- package/dist/types/ReferenceType.spec.js +21 -6
- package/dist/types/ReferenceType.spec.js.map +1 -1
- package/dist/types/StringType.d.ts +2 -1
- package/dist/types/StringType.js +9 -2
- package/dist/types/StringType.js.map +1 -1
- package/dist/types/TypedFunctionType.d.ts +33 -0
- package/dist/types/TypedFunctionType.js +106 -0
- package/dist/types/TypedFunctionType.js.map +1 -0
- package/dist/types/TypedFunctionType.spec.d.ts +1 -0
- package/dist/types/TypedFunctionType.spec.js +122 -0
- package/dist/types/TypedFunctionType.spec.js.map +1 -0
- package/dist/types/UninitializedType.d.ts +2 -1
- package/dist/types/UninitializedType.js +1 -1
- package/dist/types/UninitializedType.js.map +1 -1
- package/dist/types/UnionType.d.ts +4 -2
- package/dist/types/UnionType.js +36 -4
- package/dist/types/UnionType.js.map +1 -1
- package/dist/types/UnionType.spec.js +46 -19
- package/dist/types/UnionType.spec.js.map +1 -1
- package/dist/types/VoidType.d.ts +2 -1
- package/dist/types/VoidType.js +7 -2
- package/dist/types/VoidType.js.map +1 -1
- package/dist/types/helper.spec.js +15 -0
- package/dist/types/helper.spec.js.map +1 -1
- package/dist/types/helpers.d.ts +5 -0
- package/dist/types/helpers.js +50 -3
- package/dist/types/helpers.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/util.d.ts +71 -15
- package/dist/util.js +578 -150
- package/dist/util.js.map +1 -1
- package/dist/validators/ClassValidator.d.ts +0 -1
- package/dist/validators/ClassValidator.js +0 -22
- package/dist/validators/ClassValidator.js.map +1 -1
- package/package.json +3 -2
- package/dist/astUtils/AstEditor.js.map +0 -1
- package/dist/astUtils/AstEditor.spec.js.map +0 -1
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js.map +0 -1
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js +0 -31
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js.map +0 -1
- package/dist/types/FunctionType.spec.js +0 -23
- package/dist/types/FunctionType.spec.js.map +0 -1
- /package/dist/astUtils/{AstEditor.spec.d.ts → Editor.spec.d.ts} +0 -0
- /package/dist/bscPlugin/{transpile/BrsFilePreTranspileProcessor.spec.d.ts → completions/CompletionsProcessor.spec.d.ts} +0 -0
- /package/dist/{types/FunctionType.spec.d.ts → bscPlugin/serialize/BslibInjector.spec.d.ts} +0 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ComponentType = void 0;
|
|
4
|
+
const SymbolTable_1 = require("../SymbolTable");
|
|
5
|
+
const reflection_1 = require("../astUtils/reflection");
|
|
6
|
+
const BscTypeKind_1 = require("./BscTypeKind");
|
|
7
|
+
const BuiltInInterfaceAdder_1 = require("./BuiltInInterfaceAdder");
|
|
8
|
+
const InheritableType_1 = require("./InheritableType");
|
|
9
|
+
const helpers_1 = require("./helpers");
|
|
10
|
+
const util_1 = require("../util");
|
|
11
|
+
class ComponentType extends InheritableType_1.InheritableType {
|
|
12
|
+
constructor(name, superComponent) {
|
|
13
|
+
super(name, superComponent);
|
|
14
|
+
this.name = name;
|
|
15
|
+
this.kind = BscTypeKind_1.BscTypeKind.ComponentType;
|
|
16
|
+
this.hasAddedBuiltInFields = false;
|
|
17
|
+
this.callFuncMemberTable = new SymbolTable_1.SymbolTable(`${this.name}: CallFunc`, () => { var _a; return (_a = this.parentComponent) === null || _a === void 0 ? void 0 : _a.callFuncMemberTable; });
|
|
18
|
+
}
|
|
19
|
+
get parentComponent() {
|
|
20
|
+
return this.parentType;
|
|
21
|
+
}
|
|
22
|
+
isTypeCompatible(targetType, data) {
|
|
23
|
+
if (this.isEqual(targetType)) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
else if ((0, reflection_1.isDynamicType)(targetType) ||
|
|
27
|
+
(0, reflection_1.isObjectType)(targetType) ||
|
|
28
|
+
(0, helpers_1.isUnionTypeCompatible)(this, targetType, data)) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
else if ((0, reflection_1.isComponentType)(targetType)) {
|
|
32
|
+
return this.isTypeDescendent(targetType);
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
isEqual(targetType) {
|
|
37
|
+
return (0, reflection_1.isComponentType)(targetType) && this.name.toLowerCase() === targetType.name.toLowerCase();
|
|
38
|
+
}
|
|
39
|
+
toString() {
|
|
40
|
+
return util_1.default.getSgNodeTypeName(this.name);
|
|
41
|
+
}
|
|
42
|
+
getBuiltInMemberTable() {
|
|
43
|
+
if (!this.parentType) {
|
|
44
|
+
if (this.builtInMemberTable) {
|
|
45
|
+
return this.builtInMemberTable;
|
|
46
|
+
}
|
|
47
|
+
this.builtInMemberTable = new SymbolTable_1.SymbolTable(`${this.__identifier} Built-in Members`);
|
|
48
|
+
this.pushMemberProvider(() => this.builtInMemberTable);
|
|
49
|
+
return this.builtInMemberTable;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
addBuiltInInterfaces() {
|
|
53
|
+
if (!this.hasAddedBuiltInInterfaces) {
|
|
54
|
+
if (this.parentType) {
|
|
55
|
+
this.parentType.addBuiltInInterfaces();
|
|
56
|
+
}
|
|
57
|
+
BuiltInInterfaceAdder_1.BuiltInInterfaceAdder.addBuiltInInterfacesToType(this);
|
|
58
|
+
}
|
|
59
|
+
this.hasAddedBuiltInInterfaces = true;
|
|
60
|
+
this.addBuiltInFields();
|
|
61
|
+
}
|
|
62
|
+
addBuiltInFields() {
|
|
63
|
+
if (!this.hasAddedBuiltInFields) {
|
|
64
|
+
if ((0, reflection_1.isComponentType)(this.parentType)) {
|
|
65
|
+
this.parentType.addBuiltInFields();
|
|
66
|
+
}
|
|
67
|
+
BuiltInInterfaceAdder_1.BuiltInInterfaceAdder.addBuiltInFieldsToNodeType(this);
|
|
68
|
+
}
|
|
69
|
+
this.hasAddedBuiltInFields = true;
|
|
70
|
+
}
|
|
71
|
+
addCallFuncMember(name, data, type, flags) {
|
|
72
|
+
this.callFuncMemberTable.addSymbol(name, data, type, flags);
|
|
73
|
+
}
|
|
74
|
+
getCallFuncTable() {
|
|
75
|
+
return this.callFuncMemberTable;
|
|
76
|
+
}
|
|
77
|
+
getCallFuncType(name, options) {
|
|
78
|
+
return this.callFuncMemberTable.getSymbolType(name, options);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.ComponentType = ComponentType;
|
|
82
|
+
ComponentType.instance = new ComponentType('Node');
|
|
83
|
+
//# sourceMappingURL=ComponentType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComponentType.js","sourceRoot":"","sources":["../../src/types/ComponentType.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { BscType } from './BscType';
|
|
2
2
|
import { BscTypeKind } from './BscTypeKind';
|
|
3
|
+
import type { TypeCompatibilityData } from '../interfaces';
|
|
3
4
|
export declare class DoubleType extends BscType {
|
|
4
5
|
typeText?: string;
|
|
5
6
|
constructor(typeText?: string);
|
|
6
7
|
readonly kind = BscTypeKind.DoubleType;
|
|
7
8
|
static instance: DoubleType;
|
|
8
|
-
isTypeCompatible(targetType: BscType):
|
|
9
|
+
isTypeCompatible(targetType: BscType, data?: TypeCompatibilityData): any;
|
|
9
10
|
toString(): string;
|
|
10
11
|
toTypeString(): string;
|
|
11
12
|
isEqual(targetType: BscType): boolean;
|
package/dist/types/DoubleType.js
CHANGED
|
@@ -4,18 +4,24 @@ exports.DoubleType = void 0;
|
|
|
4
4
|
const reflection_1 = require("../astUtils/reflection");
|
|
5
5
|
const BscType_1 = require("./BscType");
|
|
6
6
|
const BscTypeKind_1 = require("./BscTypeKind");
|
|
7
|
+
const helpers_1 = require("./helpers");
|
|
8
|
+
const BuiltInInterfaceAdder_1 = require("./BuiltInInterfaceAdder");
|
|
7
9
|
class DoubleType extends BscType_1.BscType {
|
|
8
10
|
constructor(typeText) {
|
|
9
11
|
super();
|
|
10
12
|
this.typeText = typeText;
|
|
11
13
|
this.kind = BscTypeKind_1.BscTypeKind.DoubleType;
|
|
12
14
|
}
|
|
13
|
-
isTypeCompatible(targetType) {
|
|
15
|
+
isTypeCompatible(targetType, data) {
|
|
14
16
|
return ((0, reflection_1.isDynamicType)(targetType) ||
|
|
17
|
+
(0, reflection_1.isObjectType)(targetType) ||
|
|
15
18
|
(0, reflection_1.isIntegerType)(targetType) ||
|
|
16
19
|
(0, reflection_1.isFloatType)(targetType) ||
|
|
17
20
|
(0, reflection_1.isDoubleType)(targetType) ||
|
|
18
|
-
(0, reflection_1.isLongIntegerType)(targetType)
|
|
21
|
+
(0, reflection_1.isLongIntegerType)(targetType) ||
|
|
22
|
+
(0, helpers_1.isUnionTypeCompatible)(this, targetType, data) ||
|
|
23
|
+
(0, helpers_1.isEnumTypeCompatible)(this, targetType, data) ||
|
|
24
|
+
(0, helpers_1.isNativeInterfaceCompatibleNumber)(this, targetType, data));
|
|
19
25
|
}
|
|
20
26
|
toString() {
|
|
21
27
|
var _a;
|
|
@@ -30,4 +36,5 @@ class DoubleType extends BscType_1.BscType {
|
|
|
30
36
|
}
|
|
31
37
|
exports.DoubleType = DoubleType;
|
|
32
38
|
DoubleType.instance = new DoubleType('double');
|
|
39
|
+
BuiltInInterfaceAdder_1.BuiltInInterfaceAdder.primitiveTypeInstanceCache.set('double', DoubleType.instance);
|
|
33
40
|
//# sourceMappingURL=DoubleType.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DoubleType.js","sourceRoot":"","sources":["../../src/types/DoubleType.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"DoubleType.js","sourceRoot":"","sources":["../../src/types/DoubleType.ts"],"names":[],"mappings":";;;AAAA,uDAAkI;AAClI,uCAAoC;AACpC,+CAA4C;AAC5C,uCAA2G;AAE3G,mEAAgE;AAGhE,MAAa,UAAW,SAAQ,iBAAO;IACnC,YACW,QAAiB;QAExB,KAAK,EAAE,CAAC;QAFD,aAAQ,GAAR,QAAQ,CAAS;QAKZ,SAAI,GAAG,yBAAW,CAAC,UAAU,CAAC;IAF9C,CAAC;IAMM,gBAAgB,CAAC,UAAmB,EAAE,IAA4B;QACrE,OAAO,CACH,IAAA,0BAAa,EAAC,UAAU,CAAC;YACzB,IAAA,yBAAY,EAAC,UAAU,CAAC;YACxB,IAAA,0BAAa,EAAC,UAAU,CAAC;YACzB,IAAA,wBAAW,EAAC,UAAU,CAAC;YACvB,IAAA,yBAAY,EAAC,UAAU,CAAC;YACxB,IAAA,8BAAiB,EAAC,UAAU,CAAC;YAC7B,IAAA,+BAAqB,EAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC;YAC7C,IAAA,8BAAoB,EAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC;YAC5C,IAAA,2CAAiC,EAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,CAC5D,CAAC;IACN,CAAC;IACM,QAAQ;;QACX,OAAO,MAAA,IAAI,CAAC,QAAQ,mCAAI,QAAQ,CAAC;IACrC,CAAC;IAEM,YAAY;QACf,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAEM,OAAO,CAAC,UAAmB;QAC9B,OAAO,IAAA,yBAAY,EAAC,UAAU,CAAC,CAAC;IACpC,CAAC;;AAlCL,gCAoCC;AA3BiB,mBAAQ,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAC;AA6BtD,6CAAqB,CAAC,0BAA0B,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GetTypeOptions } from '../interfaces';
|
|
1
|
+
import type { GetTypeOptions, TypeCompatibilityData } from '../interfaces';
|
|
2
2
|
import { BscType } from './BscType';
|
|
3
3
|
import { BscTypeKind } from './BscTypeKind';
|
|
4
4
|
export declare class DynamicType extends BscType {
|
|
@@ -11,7 +11,7 @@ export declare class DynamicType extends BscType {
|
|
|
11
11
|
/**
|
|
12
12
|
* The dynamic type is convertible to everything.
|
|
13
13
|
*/
|
|
14
|
-
isTypeCompatible(targetType: BscType): boolean;
|
|
14
|
+
isTypeCompatible(targetType: BscType, data?: TypeCompatibilityData): boolean;
|
|
15
15
|
toString(): string;
|
|
16
16
|
toTypeString(): string;
|
|
17
17
|
isEqual(targetType: BscType): boolean;
|
|
@@ -4,6 +4,7 @@ exports.DynamicType = void 0;
|
|
|
4
4
|
const reflection_1 = require("../astUtils/reflection");
|
|
5
5
|
const BscType_1 = require("./BscType");
|
|
6
6
|
const BscTypeKind_1 = require("./BscTypeKind");
|
|
7
|
+
const BuiltInInterfaceAdder_1 = require("./BuiltInInterfaceAdder");
|
|
7
8
|
class DynamicType extends BscType_1.BscType {
|
|
8
9
|
constructor(typeText) {
|
|
9
10
|
super();
|
|
@@ -20,7 +21,7 @@ class DynamicType extends BscType_1.BscType {
|
|
|
20
21
|
/**
|
|
21
22
|
* The dynamic type is convertible to everything.
|
|
22
23
|
*/
|
|
23
|
-
isTypeCompatible(targetType) {
|
|
24
|
+
isTypeCompatible(targetType, data) {
|
|
24
25
|
//everything can be dynamic, so as long as a type is provided, this is true
|
|
25
26
|
return !!targetType;
|
|
26
27
|
}
|
|
@@ -40,4 +41,5 @@ class DynamicType extends BscType_1.BscType {
|
|
|
40
41
|
}
|
|
41
42
|
exports.DynamicType = DynamicType;
|
|
42
43
|
DynamicType.instance = new DynamicType();
|
|
44
|
+
BuiltInInterfaceAdder_1.BuiltInInterfaceAdder.primitiveTypeInstanceCache.set('dynamic', DynamicType.instance);
|
|
43
45
|
//# sourceMappingURL=DynamicType.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicType.js","sourceRoot":"","sources":["../../src/types/DynamicType.ts"],"names":[],"mappings":";;;AACA,uDAAuD;AACvD,uCAAoC;AACpC,+CAA4C;
|
|
1
|
+
{"version":3,"file":"DynamicType.js","sourceRoot":"","sources":["../../src/types/DynamicType.ts"],"names":[],"mappings":";;;AACA,uDAAuD;AACvD,uCAAoC;AACpC,+CAA4C;AAC5C,mEAAgE;AAEhE,MAAa,WAAY,SAAQ,iBAAO;IACpC,YACW,QAAiB;QAExB,KAAK,EAAE,CAAC;QAFD,aAAQ,GAAR,QAAQ,CAAS;QAKZ,SAAI,GAAG,yBAAW,CAAC,WAAW,CAAC;IAF/C,CAAC;IAMD,IAAI,UAAU;QACV,OAAO,WAAW,CAAC,QAAQ,CAAC;IAChC,CAAC;IAEM,cAAc,CAAC,UAAmB;QACrC,2EAA2E;QAC3E,OAAO,CAAC,CAAC,UAAU,CAAC;IACxB,CAAC;IAED;;OAEG;IACI,gBAAgB,CAAC,UAAmB,EAAE,IAA4B;QACrE,2EAA2E;QAC3E,OAAO,CAAC,CAAC,UAAU,CAAC;IACxB,CAAC;IAEM,QAAQ;;QACX,OAAO,MAAA,IAAI,CAAC,QAAQ,mCAAI,SAAS,CAAC;IACtC,CAAC;IAEM,YAAY;QACf,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAEM,OAAO,CAAC,UAAmB;QAC9B,OAAO,IAAA,0BAAa,EAAC,UAAU,CAAC,CAAC;IACrC,CAAC;IAED,aAAa,CAAC,UAAkB,EAAE,OAAuB;QACrD,OAAO,WAAW,CAAC,QAAQ,CAAC;IAChC,CAAC;;AA1CL,kCA2CC;AAlC0B,oBAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;AAoCxD,6CAAqB,CAAC,0BAA0B,CAAC,GAAG,CAAC,SAAS,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC"}
|
package/dist/types/EnumType.d.ts
CHANGED
|
@@ -1,21 +1,39 @@
|
|
|
1
|
+
import type { TypeCompatibilityData } from '../interfaces';
|
|
1
2
|
import { BscType } from './BscType';
|
|
2
3
|
import { BscTypeKind } from './BscTypeKind';
|
|
3
4
|
export declare class EnumType extends BscType {
|
|
4
5
|
name: string;
|
|
5
|
-
|
|
6
|
+
/**
|
|
7
|
+
* The runtime type for this enum (i.e. what type the value will be transpiled into)
|
|
8
|
+
*/
|
|
9
|
+
underlyingType: BscType;
|
|
10
|
+
constructor(name: string,
|
|
11
|
+
/**
|
|
12
|
+
* The runtime type for this enum (i.e. what type the value will be transpiled into)
|
|
13
|
+
*/
|
|
14
|
+
underlyingType?: BscType);
|
|
6
15
|
readonly kind = BscTypeKind.EnumType;
|
|
7
|
-
isTypeCompatible(targetType: BscType):
|
|
16
|
+
isTypeCompatible(targetType: BscType, data?: TypeCompatibilityData): boolean;
|
|
8
17
|
toString(): string;
|
|
9
18
|
toTypeString(): string;
|
|
10
|
-
isEqual(targetType: BscType): boolean;
|
|
19
|
+
isEqual(targetType: BscType, data?: TypeCompatibilityData): boolean;
|
|
20
|
+
get defaultMemberType(): EnumMemberType;
|
|
11
21
|
}
|
|
12
22
|
export declare class EnumMemberType extends BscType {
|
|
13
23
|
enumName: string;
|
|
14
24
|
memberName: string;
|
|
15
|
-
|
|
25
|
+
/**
|
|
26
|
+
* The runtime type for this enum (i.e. what type the value will be transpiled into)
|
|
27
|
+
*/
|
|
28
|
+
underlyingType: BscType;
|
|
29
|
+
constructor(enumName: string, memberName: string,
|
|
30
|
+
/**
|
|
31
|
+
* The runtime type for this enum (i.e. what type the value will be transpiled into)
|
|
32
|
+
*/
|
|
33
|
+
underlyingType?: BscType);
|
|
16
34
|
readonly kind = BscTypeKind.EnumMemberType;
|
|
17
|
-
isAssignableTo(targetType: BscType):
|
|
18
|
-
isTypeCompatible(targetType: BscType): boolean;
|
|
35
|
+
isAssignableTo(targetType: BscType): boolean;
|
|
36
|
+
isTypeCompatible(targetType: BscType, data?: TypeCompatibilityData): boolean;
|
|
19
37
|
toString(): string;
|
|
20
38
|
toTypeString(): string;
|
|
21
39
|
isEqual(targetType: BscType): boolean;
|
package/dist/types/EnumType.js
CHANGED
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EnumMemberType = exports.EnumType = void 0;
|
|
4
|
+
const SymbolTable_1 = require("../SymbolTable");
|
|
4
5
|
const reflection_1 = require("../astUtils/reflection");
|
|
5
6
|
const BscType_1 = require("./BscType");
|
|
6
7
|
const BscTypeKind_1 = require("./BscTypeKind");
|
|
8
|
+
const DynamicType_1 = require("./DynamicType");
|
|
9
|
+
const helpers_1 = require("./helpers");
|
|
7
10
|
class EnumType extends BscType_1.BscType {
|
|
8
|
-
constructor(name
|
|
11
|
+
constructor(name,
|
|
12
|
+
/**
|
|
13
|
+
* The runtime type for this enum (i.e. what type the value will be transpiled into)
|
|
14
|
+
*/
|
|
15
|
+
underlyingType = DynamicType_1.DynamicType.instance) {
|
|
9
16
|
super(name);
|
|
10
17
|
this.name = name;
|
|
18
|
+
this.underlyingType = underlyingType;
|
|
11
19
|
this.kind = BscTypeKind_1.BscTypeKind.EnumType;
|
|
12
20
|
}
|
|
13
|
-
isTypeCompatible(targetType) {
|
|
21
|
+
isTypeCompatible(targetType, data) {
|
|
14
22
|
return ((0, reflection_1.isDynamicType)(targetType) ||
|
|
23
|
+
(0, reflection_1.isObjectType)(targetType) ||
|
|
15
24
|
this.isEqual(targetType) ||
|
|
16
|
-
((0, reflection_1.isEnumMemberType)(targetType) && (targetType === null || targetType === void 0 ? void 0 : targetType.enumName.toLowerCase()) === this.name.toLowerCase())
|
|
25
|
+
((0, reflection_1.isEnumMemberType)(targetType) && (targetType === null || targetType === void 0 ? void 0 : targetType.enumName.toLowerCase()) === this.name.toLowerCase()) ||
|
|
26
|
+
(0, helpers_1.isUnionTypeCompatible)(this, targetType, data));
|
|
17
27
|
}
|
|
18
28
|
toString() {
|
|
19
29
|
return this.name;
|
|
@@ -21,16 +31,28 @@ class EnumType extends BscType_1.BscType {
|
|
|
21
31
|
toTypeString() {
|
|
22
32
|
return 'dynamic';
|
|
23
33
|
}
|
|
24
|
-
isEqual(targetType) {
|
|
25
|
-
return (0, reflection_1.isEnumType)(targetType) &&
|
|
34
|
+
isEqual(targetType, data) {
|
|
35
|
+
return (0, reflection_1.isEnumType)(targetType) &&
|
|
36
|
+
(targetType === null || targetType === void 0 ? void 0 : targetType.name.toLowerCase()) === this.name.toLowerCase() &&
|
|
37
|
+
this.underlyingType.isEqual(targetType.underlyingType, data) &&
|
|
38
|
+
this.checkCompatibilityBasedOnMembers(targetType, SymbolTable_1.SymbolTypeFlag.runtime, data) &&
|
|
39
|
+
targetType.checkCompatibilityBasedOnMembers(this, SymbolTable_1.SymbolTypeFlag.runtime, data);
|
|
40
|
+
}
|
|
41
|
+
get defaultMemberType() {
|
|
42
|
+
return new EnumMemberType(this.name, 'default', this.underlyingType);
|
|
26
43
|
}
|
|
27
44
|
}
|
|
28
45
|
exports.EnumType = EnumType;
|
|
29
46
|
class EnumMemberType extends BscType_1.BscType {
|
|
30
|
-
constructor(enumName, memberName
|
|
47
|
+
constructor(enumName, memberName,
|
|
48
|
+
/**
|
|
49
|
+
* The runtime type for this enum (i.e. what type the value will be transpiled into)
|
|
50
|
+
*/
|
|
51
|
+
underlyingType = DynamicType_1.DynamicType.instance) {
|
|
31
52
|
super(`${enumName}.${memberName}`);
|
|
32
53
|
this.enumName = enumName;
|
|
33
54
|
this.memberName = memberName;
|
|
55
|
+
this.underlyingType = underlyingType;
|
|
34
56
|
this.kind = BscTypeKind_1.BscTypeKind.EnumMemberType;
|
|
35
57
|
}
|
|
36
58
|
isAssignableTo(targetType) {
|
|
@@ -39,7 +61,7 @@ class EnumMemberType extends BscType_1.BscType {
|
|
|
39
61
|
(targetType === null || targetType === void 0 ? void 0 : targetType.name.toLowerCase()) === this.enumName.toLowerCase()) ||
|
|
40
62
|
(0, reflection_1.isDynamicType)(targetType));
|
|
41
63
|
}
|
|
42
|
-
isTypeCompatible(targetType) {
|
|
64
|
+
isTypeCompatible(targetType, data) {
|
|
43
65
|
return (this.isEqual(targetType) ||
|
|
44
66
|
(0, reflection_1.isDynamicType)(targetType));
|
|
45
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnumType.js","sourceRoot":"","sources":["../../src/types/EnumType.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"EnumType.js","sourceRoot":"","sources":["../../src/types/EnumType.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { BscType } from './BscType';
|
|
2
2
|
import { BscTypeKind } from './BscTypeKind';
|
|
3
|
+
import type { TypeCompatibilityData } from '../interfaces';
|
|
3
4
|
export declare class FloatType extends BscType {
|
|
4
5
|
typeText?: string;
|
|
5
6
|
constructor(typeText?: string);
|
|
6
7
|
readonly kind = BscTypeKind.FloatType;
|
|
7
8
|
static instance: FloatType;
|
|
8
|
-
isTypeCompatible(targetType: BscType):
|
|
9
|
+
isTypeCompatible(targetType: BscType, data?: TypeCompatibilityData): any;
|
|
9
10
|
toString(): string;
|
|
10
11
|
toTypeString(): string;
|
|
11
12
|
isEqual(targetType: BscType): boolean;
|
package/dist/types/FloatType.js
CHANGED
|
@@ -4,18 +4,24 @@ exports.FloatType = void 0;
|
|
|
4
4
|
const reflection_1 = require("../astUtils/reflection");
|
|
5
5
|
const BscType_1 = require("./BscType");
|
|
6
6
|
const BscTypeKind_1 = require("./BscTypeKind");
|
|
7
|
+
const helpers_1 = require("./helpers");
|
|
8
|
+
const BuiltInInterfaceAdder_1 = require("./BuiltInInterfaceAdder");
|
|
7
9
|
class FloatType extends BscType_1.BscType {
|
|
8
10
|
constructor(typeText) {
|
|
9
11
|
super();
|
|
10
12
|
this.typeText = typeText;
|
|
11
13
|
this.kind = BscTypeKind_1.BscTypeKind.FloatType;
|
|
12
14
|
}
|
|
13
|
-
isTypeCompatible(targetType) {
|
|
15
|
+
isTypeCompatible(targetType, data) {
|
|
14
16
|
return ((0, reflection_1.isDynamicType)(targetType) ||
|
|
17
|
+
(0, reflection_1.isObjectType)(targetType) ||
|
|
15
18
|
(0, reflection_1.isIntegerType)(targetType) ||
|
|
16
19
|
(0, reflection_1.isFloatType)(targetType) ||
|
|
17
20
|
(0, reflection_1.isDoubleType)(targetType) ||
|
|
18
|
-
(0, reflection_1.isLongIntegerType)(targetType)
|
|
21
|
+
(0, reflection_1.isLongIntegerType)(targetType) ||
|
|
22
|
+
(0, helpers_1.isUnionTypeCompatible)(this, targetType, data) ||
|
|
23
|
+
(0, helpers_1.isEnumTypeCompatible)(this, targetType, data) ||
|
|
24
|
+
(0, helpers_1.isNativeInterfaceCompatibleNumber)(this, targetType, data));
|
|
19
25
|
}
|
|
20
26
|
toString() {
|
|
21
27
|
var _a;
|
|
@@ -30,4 +36,5 @@ class FloatType extends BscType_1.BscType {
|
|
|
30
36
|
}
|
|
31
37
|
exports.FloatType = FloatType;
|
|
32
38
|
FloatType.instance = new FloatType('float');
|
|
39
|
+
BuiltInInterfaceAdder_1.BuiltInInterfaceAdder.primitiveTypeInstanceCache.set('float', FloatType.instance);
|
|
33
40
|
//# sourceMappingURL=FloatType.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FloatType.js","sourceRoot":"","sources":["../../src/types/FloatType.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"FloatType.js","sourceRoot":"","sources":["../../src/types/FloatType.ts"],"names":[],"mappings":";;;AAAA,uDAAkI;AAClI,uCAAoC;AACpC,+CAA4C;AAC5C,uCAA2G;AAC3G,mEAAgE;AAGhE,MAAa,SAAU,SAAQ,iBAAO;IAClC,YACW,QAAiB;QAExB,KAAK,EAAE,CAAC;QAFD,aAAQ,GAAR,QAAQ,CAAS;QAKZ,SAAI,GAAG,yBAAW,CAAC,SAAS,CAAC;IAF7C,CAAC;IAMM,gBAAgB,CAAC,UAAmB,EAAE,IAA4B;QACrE,OAAO,CACH,IAAA,0BAAa,EAAC,UAAU,CAAC;YACzB,IAAA,yBAAY,EAAC,UAAU,CAAC;YACxB,IAAA,0BAAa,EAAC,UAAU,CAAC;YACzB,IAAA,wBAAW,EAAC,UAAU,CAAC;YACvB,IAAA,yBAAY,EAAC,UAAU,CAAC;YACxB,IAAA,8BAAiB,EAAC,UAAU,CAAC;YAC7B,IAAA,+BAAqB,EAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC;YAC7C,IAAA,8BAAoB,EAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC;YAC5C,IAAA,2CAAiC,EAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,CAC5D,CAAC;IAEN,CAAC;IAEM,QAAQ;;QACX,OAAO,MAAA,IAAI,CAAC,QAAQ,mCAAI,OAAO,CAAC;IACpC,CAAC;IAEM,YAAY;QACf,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAEM,OAAO,CAAC,UAAmB;QAC9B,OAAO,IAAA,wBAAW,EAAC,UAAU,CAAC,CAAC;IACnC,CAAC;;AApCL,8BAqCC;AA5BiB,kBAAQ,GAAG,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC;AA8BpD,6CAAqB,CAAC,0BAA0B,CAAC,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -1,25 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseFunctionType } from './BaseFunctionType';
|
|
2
|
+
import type { BscType } from './BscType';
|
|
2
3
|
import { BscTypeKind } from './BscTypeKind';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import type { TypeCompatibilityData } from '../interfaces';
|
|
5
|
+
export declare class FunctionType extends BaseFunctionType {
|
|
6
|
+
typeText?: string;
|
|
7
|
+
constructor(typeText?: string);
|
|
6
8
|
readonly kind = BscTypeKind.FunctionType;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*/
|
|
10
|
-
name: string;
|
|
11
|
-
/**
|
|
12
|
-
* Determines if this is a sub or not
|
|
13
|
-
*/
|
|
14
|
-
isSub: boolean;
|
|
15
|
-
params: {
|
|
16
|
-
name: string;
|
|
17
|
-
type: BscType;
|
|
18
|
-
isOptional: boolean;
|
|
19
|
-
}[];
|
|
20
|
-
setName(name: string): this;
|
|
21
|
-
addParameter(name: string, type: BscType, isOptional: boolean): this;
|
|
22
|
-
isTypeCompatible(targetType: BscType): boolean;
|
|
9
|
+
static instance: FunctionType;
|
|
10
|
+
isTypeCompatible(targetType: BscType, data?: TypeCompatibilityData): boolean;
|
|
23
11
|
toString(): string;
|
|
24
12
|
toTypeString(): string;
|
|
25
13
|
isEqual(targetType: BscType): boolean;
|
|
@@ -2,68 +2,40 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FunctionType = void 0;
|
|
4
4
|
const reflection_1 = require("../astUtils/reflection");
|
|
5
|
-
const
|
|
5
|
+
const BaseFunctionType_1 = require("./BaseFunctionType");
|
|
6
6
|
const BscTypeKind_1 = require("./BscTypeKind");
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const helpers_1 = require("./helpers");
|
|
8
|
+
const BuiltInInterfaceAdder_1 = require("./BuiltInInterfaceAdder");
|
|
9
|
+
class FunctionType extends BaseFunctionType_1.BaseFunctionType {
|
|
10
|
+
constructor(typeText) {
|
|
10
11
|
super();
|
|
11
|
-
this.
|
|
12
|
+
this.typeText = typeText;
|
|
12
13
|
this.kind = BscTypeKind_1.BscTypeKind.FunctionType;
|
|
13
|
-
/**
|
|
14
|
-
* Determines if this is a sub or not
|
|
15
|
-
*/
|
|
16
|
-
this.isSub = false;
|
|
17
|
-
this.params = [];
|
|
18
14
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.params.push({
|
|
25
|
-
name: name,
|
|
26
|
-
type: type,
|
|
27
|
-
isOptional: isOptional === true ? true : false
|
|
28
|
-
});
|
|
29
|
-
return this;
|
|
30
|
-
}
|
|
31
|
-
isTypeCompatible(targetType) {
|
|
32
|
-
if (targetType instanceof DynamicType_1.DynamicType) {
|
|
15
|
+
isTypeCompatible(targetType, data) {
|
|
16
|
+
if ((0, reflection_1.isDynamicType)(targetType) ||
|
|
17
|
+
(0, reflection_1.isCallableType)(targetType) ||
|
|
18
|
+
(0, reflection_1.isObjectType)(targetType) ||
|
|
19
|
+
(0, helpers_1.isUnionTypeCompatible)(this, targetType, data)) {
|
|
33
20
|
return true;
|
|
34
21
|
}
|
|
35
|
-
return
|
|
22
|
+
return false;
|
|
36
23
|
}
|
|
37
24
|
toString() {
|
|
38
|
-
|
|
39
|
-
for (let param of this.params) {
|
|
40
|
-
paramTexts.push(`${param.name}${param.isOptional ? '?' : ''} as ${param.type.toString()}`);
|
|
41
|
-
}
|
|
42
|
-
return `${this.isSub ? 'sub' : 'function'} ${this.name}(${paramTexts.join(', ')}) as ${this.returnType.toString()}`;
|
|
25
|
+
return this.toTypeString();
|
|
43
26
|
}
|
|
44
27
|
toTypeString() {
|
|
45
|
-
|
|
28
|
+
var _a;
|
|
29
|
+
return (_a = this.typeText) !== null && _a !== void 0 ? _a : 'function';
|
|
46
30
|
}
|
|
47
31
|
isEqual(targetType) {
|
|
48
32
|
if ((0, reflection_1.isFunctionType)(targetType)) {
|
|
49
|
-
//compare all parameters
|
|
50
|
-
let len = Math.max(this.params.length, targetType.params.length);
|
|
51
|
-
for (let i = 0; i < len; i++) {
|
|
52
|
-
let myParam = this.params[i];
|
|
53
|
-
let targetParam = targetType.params[i];
|
|
54
|
-
if (!myParam || !targetParam || !myParam.type.isAssignableTo(targetParam.type)) {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
//compare return type
|
|
59
|
-
if (!this.returnType || !targetType.returnType || !this.returnType.isAssignableTo(targetType.returnType)) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
//made it here, all params and return type are equivalent
|
|
63
33
|
return true;
|
|
64
34
|
}
|
|
65
35
|
return false;
|
|
66
36
|
}
|
|
67
37
|
}
|
|
68
38
|
exports.FunctionType = FunctionType;
|
|
39
|
+
FunctionType.instance = new FunctionType('function');
|
|
40
|
+
BuiltInInterfaceAdder_1.BuiltInInterfaceAdder.primitiveTypeInstanceCache.set('function', new FunctionType());
|
|
69
41
|
//# sourceMappingURL=FunctionType.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionType.js","sourceRoot":"","sources":["../../src/types/FunctionType.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"FunctionType.js","sourceRoot":"","sources":["../../src/types/FunctionType.ts"],"names":[],"mappings":";;;AAAA,uDAAqG;AACrG,yDAAsD;AAEtD,+CAA4C;AAC5C,uCAAkD;AAClD,mEAAgE;AAGhE,MAAa,YAAa,SAAQ,mCAAgB;IAC9C,YAAmB,QAAiB;QAChC,KAAK,EAAE,CAAC;QADO,aAAQ,GAAR,QAAQ,CAAS;QAIpB,SAAI,GAAG,yBAAW,CAAC,YAAY,CAAC;IAFhD,CAAC;IAMM,gBAAgB,CAAC,UAAmB,EAAE,IAA4B;QACrE,IACI,IAAA,0BAAa,EAAC,UAAU,CAAC;YACzB,IAAA,2BAAc,EAAC,UAAU,CAAC;YAC1B,IAAA,yBAAY,EAAC,UAAU,CAAC;YACxB,IAAA,+BAAqB,EAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,EAC/C;YACE,OAAO,IAAI,CAAC;SACf;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,QAAQ;QACX,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;IAE/B,CAAC;IAEM,YAAY;;QACf,OAAO,MAAA,IAAI,CAAC,QAAQ,mCAAI,UAAU,CAAC;IACvC,CAAC;IAED,OAAO,CAAC,UAAmB;QACvB,IAAI,IAAA,2BAAc,EAAC,UAAU,CAAC,EAAE;YAC5B,OAAO,IAAI,CAAC;SACf;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;;AAnCL,oCAoCC;AA7BiB,qBAAQ,GAAG,IAAI,YAAY,CAAC,UAAU,CAAC,CAAC;AA+B1D,6CAAqB,CAAC,0BAA0B,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,YAAY,EAAE,CAAC,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { GetTypeOptions } from '../interfaces';
|
|
1
|
+
import type { GetTypeOptions, TypeCompatibilityData } from '../interfaces';
|
|
2
2
|
import { BscType } from './BscType';
|
|
3
|
+
import type { ReferenceType } from './ReferenceType';
|
|
3
4
|
export declare abstract class InheritableType extends BscType {
|
|
4
5
|
name: string;
|
|
5
|
-
readonly parentType?:
|
|
6
|
-
constructor(name: string, parentType?:
|
|
6
|
+
readonly parentType?: InheritableType | ReferenceType;
|
|
7
|
+
constructor(name: string, parentType?: InheritableType | ReferenceType);
|
|
7
8
|
getMemberType(memberName: string, options: GetTypeOptions): BscType;
|
|
8
9
|
toString(): string;
|
|
9
10
|
toTypeString(): string;
|
|
10
|
-
isResolvable(): boolean;
|
|
11
11
|
protected getAncestorTypeList(): InheritableType[];
|
|
12
12
|
/**
|
|
13
13
|
* Checks if other type is an ancestor of this
|
|
@@ -22,4 +22,7 @@ export declare abstract class InheritableType extends BscType {
|
|
|
22
22
|
* Useful for debugging
|
|
23
23
|
*/
|
|
24
24
|
private toJSString;
|
|
25
|
+
isEqual(targetType: BscType, data?: TypeCompatibilityData): boolean;
|
|
26
|
+
protected isParentTypeEqual(targetType: BscType, data?: TypeCompatibilityData): boolean;
|
|
27
|
+
protected isAncestorUnresolvedReferenceType(): boolean;
|
|
25
28
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InheritableType = void 0;
|
|
4
4
|
const reflection_1 = require("../astUtils/reflection");
|
|
5
|
+
const SymbolTable_1 = require("../SymbolTable");
|
|
5
6
|
const BscType_1 = require("./BscType");
|
|
6
7
|
class InheritableType extends BscType_1.BscType {
|
|
7
8
|
constructor(name, parentType) {
|
|
@@ -21,9 +22,6 @@ class InheritableType extends BscType_1.BscType {
|
|
|
21
22
|
toTypeString() {
|
|
22
23
|
return 'dynamic';
|
|
23
24
|
}
|
|
24
|
-
isResolvable() {
|
|
25
|
-
return this.parentType ? this.parentType.isResolvable() : true;
|
|
26
|
-
}
|
|
27
25
|
getAncestorTypeList() {
|
|
28
26
|
const ancestors = [];
|
|
29
27
|
let currentParentType = this.parentType;
|
|
@@ -83,6 +81,72 @@ class InheritableType extends BscType_1.BscType {
|
|
|
83
81
|
}
|
|
84
82
|
return result + '}';
|
|
85
83
|
}
|
|
84
|
+
isEqual(targetType, data = {}) {
|
|
85
|
+
var _a, _b, _c;
|
|
86
|
+
if (this === targetType) {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
if ((0, reflection_1.isReferenceType)(targetType)) {
|
|
90
|
+
const lowerTargetName = ((_a = targetType.memberKey) !== null && _a !== void 0 ? _a : targetType.fullName).toLowerCase();
|
|
91
|
+
const myLowerName = this.name.toLowerCase();
|
|
92
|
+
if (myLowerName === lowerTargetName) {
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
//check non-namespaced version
|
|
96
|
+
if (myLowerName.split('.').reverse()[0] === lowerTargetName) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (!(0, reflection_1.isInheritableType)(targetType)) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
if (!targetType) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
if (this === targetType) {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
if (this.isAncestorUnresolvedReferenceType() || targetType.isAncestorUnresolvedReferenceType()) {
|
|
110
|
+
return this.name.toLowerCase() === ((_b = targetType.name) === null || _b === void 0 ? void 0 : _b.toLowerCase()) &&
|
|
111
|
+
this.isParentTypeEqual(targetType, data);
|
|
112
|
+
}
|
|
113
|
+
return this.name.toLowerCase() === ((_c = targetType.name) === null || _c === void 0 ? void 0 : _c.toLowerCase()) &&
|
|
114
|
+
this.isParentTypeEqual(targetType, data) &&
|
|
115
|
+
this.checkCompatibilityBasedOnMembers(targetType, SymbolTable_1.SymbolTypeFlag.runtime, data) &&
|
|
116
|
+
targetType.checkCompatibilityBasedOnMembers(this, SymbolTable_1.SymbolTypeFlag.runtime, data);
|
|
117
|
+
}
|
|
118
|
+
isParentTypeEqual(targetType, data) {
|
|
119
|
+
var _a, _b;
|
|
120
|
+
if ((0, reflection_1.isInheritableType)(targetType)) {
|
|
121
|
+
const targetParent = targetType.parentType;
|
|
122
|
+
if (this.parentType && !targetParent) {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
else if (!this.parentType && !targetParent) {
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
else if (!this.parentType && targetParent) {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
if ((0, reflection_1.isReferenceType)(targetParent) || (0, reflection_1.isReferenceType)(this.parentType)) {
|
|
132
|
+
let thisParentName = (0, reflection_1.isReferenceType)(this.parentType) ? (_a = this.parentType.memberKey) !== null && _a !== void 0 ? _a : this.parentType.fullName : this.parentType.name;
|
|
133
|
+
let targetParentName = (0, reflection_1.isReferenceType)(targetParent) ? (_b = targetParent.memberKey) !== null && _b !== void 0 ? _b : targetParent.fullName : targetParent.name;
|
|
134
|
+
return thisParentName.toLowerCase() === targetParentName.toLowerCase();
|
|
135
|
+
}
|
|
136
|
+
return this.parentType.isEqual(targetParent, data);
|
|
137
|
+
}
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
isAncestorUnresolvedReferenceType() {
|
|
141
|
+
let p = this;
|
|
142
|
+
while (p) {
|
|
143
|
+
if ((0, reflection_1.isReferenceType)(p) && !p.isResolvable()) {
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
p = p.parentType;
|
|
147
|
+
}
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
86
150
|
}
|
|
87
151
|
exports.InheritableType = InheritableType;
|
|
88
152
|
//# sourceMappingURL=InheritableType.js.map
|