brighterscript 0.66.0-alpha.9 → 0.67.1
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 +123 -73
- package/README.md +14 -418
- package/dist/BsConfig.d.ts +25 -2
- package/dist/Cache.js +3 -3
- package/dist/Cache.js.map +1 -1
- package/dist/CodeActionUtil.d.ts +3 -3
- package/dist/CodeActionUtil.js.map +1 -1
- package/dist/CommentFlagProcessor.d.ts +3 -4
- package/dist/CommentFlagProcessor.js +4 -3
- package/dist/CommentFlagProcessor.js.map +1 -1
- package/dist/DependencyGraph.js +8 -8
- package/dist/DependencyGraph.js.map +1 -1
- package/dist/DiagnosticFilterer.d.ts +8 -4
- package/dist/DiagnosticFilterer.js +71 -38
- package/dist/DiagnosticFilterer.js.map +1 -1
- package/dist/DiagnosticMessages.d.ts +15 -36
- package/dist/DiagnosticMessages.js +15 -61
- package/dist/DiagnosticMessages.js.map +1 -1
- package/dist/DiagnosticSeverityAdjuster.js +3 -0
- package/dist/DiagnosticSeverityAdjuster.js.map +1 -1
- package/dist/FunctionScope.d.ts +2 -3
- package/dist/FunctionScope.js +0 -3
- package/dist/FunctionScope.js.map +1 -1
- package/dist/LanguageServer.d.ts +1 -2
- package/dist/LanguageServer.js +31 -35
- package/dist/LanguageServer.js.map +1 -1
- package/dist/Logger.d.ts +5 -9
- package/dist/Logger.js +18 -22
- package/dist/Logger.js.map +1 -1
- package/dist/PluginInterface.d.ts +13 -15
- package/dist/PluginInterface.js +16 -70
- package/dist/PluginInterface.js.map +1 -1
- package/dist/Program.d.ts +105 -138
- package/dist/Program.js +479 -702
- package/dist/Program.js.map +1 -1
- package/dist/ProgramBuilder.d.ts +8 -19
- package/dist/ProgramBuilder.js +85 -89
- package/dist/ProgramBuilder.js.map +1 -1
- package/dist/Scope.d.ts +56 -46
- package/dist/Scope.js +281 -217
- package/dist/Scope.js.map +1 -1
- package/dist/Stopwatch.js +1 -1
- package/dist/Stopwatch.js.map +1 -1
- package/dist/SymbolTable.d.ts +12 -68
- package/dist/SymbolTable.js +28 -213
- package/dist/SymbolTable.js.map +1 -1
- package/dist/XmlScope.d.ts +5 -7
- package/dist/XmlScope.js +36 -76
- package/dist/XmlScope.js.map +1 -1
- package/dist/astUtils/{Editor.d.ts → AstEditor.d.ts} +1 -6
- package/dist/astUtils/{Editor.js → AstEditor.js} +3 -9
- package/dist/astUtils/AstEditor.js.map +1 -0
- package/dist/astUtils/{Editor.spec.js → AstEditor.spec.js} +6 -10
- package/dist/astUtils/AstEditor.spec.js.map +1 -0
- package/dist/astUtils/creators.d.ts +8 -19
- package/dist/astUtils/creators.js +22 -54
- package/dist/astUtils/creators.js.map +1 -1
- package/dist/astUtils/creators.spec.js +0 -10
- package/dist/astUtils/creators.spec.js.map +1 -1
- package/dist/astUtils/reflection.d.ts +45 -81
- package/dist/astUtils/reflection.js +157 -220
- package/dist/astUtils/reflection.js.map +1 -1
- package/dist/astUtils/reflection.spec.js +19 -96
- package/dist/astUtils/reflection.spec.js.map +1 -1
- package/dist/astUtils/stackedVisitor.spec.js.map +1 -1
- package/dist/astUtils/visitors.d.ts +14 -18
- package/dist/astUtils/visitors.js +9 -22
- package/dist/astUtils/visitors.js.map +1 -1
- package/dist/astUtils/visitors.spec.js +9 -62
- package/dist/astUtils/visitors.spec.js.map +1 -1
- package/dist/astUtils/xml.d.ts +9 -9
- package/dist/astUtils/xml.js +6 -6
- package/dist/astUtils/xml.js.map +1 -1
- package/dist/bscPlugin/BscPlugin.d.ts +8 -11
- package/dist/bscPlugin/BscPlugin.js +21 -29
- package/dist/bscPlugin/BscPlugin.js.map +1 -1
- package/dist/bscPlugin/CallExpressionInfo.d.ts +6 -5
- package/dist/bscPlugin/CallExpressionInfo.js +2 -2
- package/dist/bscPlugin/CallExpressionInfo.js.map +1 -1
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +11 -11
- 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 +1 -49
- package/dist/bscPlugin/completions/CompletionsProcessor.js +23 -424
- package/dist/bscPlugin/completions/CompletionsProcessor.js.map +1 -1
- package/dist/bscPlugin/definition/DefinitionProvider.d.ts +13 -0
- package/dist/bscPlugin/definition/DefinitionProvider.js +200 -0
- package/dist/bscPlugin/definition/DefinitionProvider.js.map +1 -0
- package/dist/bscPlugin/definition/DefinitionProvider.spec.js +87 -0
- package/dist/bscPlugin/definition/DefinitionProvider.spec.js.map +1 -0
- package/dist/bscPlugin/hover/HoverProcessor.d.ts +3 -7
- package/dist/bscPlugin/hover/HoverProcessor.js +88 -128
- package/dist/bscPlugin/hover/HoverProcessor.js.map +1 -1
- package/dist/bscPlugin/hover/HoverProcessor.spec.js +24 -336
- package/dist/bscPlugin/hover/HoverProcessor.spec.js.map +1 -1
- package/dist/bscPlugin/references/ReferencesProvider.d.ts +12 -0
- package/dist/bscPlugin/references/ReferencesProvider.js +56 -0
- package/dist/bscPlugin/references/ReferencesProvider.js.map +1 -0
- package/dist/bscPlugin/references/ReferencesProvider.spec.js +51 -0
- package/dist/bscPlugin/references/ReferencesProvider.spec.js.map +1 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.d.ts +0 -1
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +5 -49
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -1
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js +0 -22
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js.map +1 -1
- package/dist/bscPlugin/symbols/DocumentSymbolProcessor.d.ts +7 -0
- package/dist/bscPlugin/symbols/DocumentSymbolProcessor.js +22 -0
- package/dist/bscPlugin/symbols/DocumentSymbolProcessor.js.map +1 -0
- package/dist/bscPlugin/symbols/DocumentSymbolProcessor.spec.js +290 -0
- package/dist/bscPlugin/symbols/DocumentSymbolProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.d.ts +7 -0
- package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.js +26 -0
- package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.js.map +1 -0
- package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.spec.js +245 -0
- package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/symbols/symbolUtils.d.ts +5 -0
- package/dist/bscPlugin/symbols/symbolUtils.js +140 -0
- package/dist/bscPlugin/symbols/symbolUtils.js.map +1 -0
- package/dist/bscPlugin/transpile/{BrsFileTranspileProcessor.d.ts → BrsFilePreTranspileProcessor.d.ts} +2 -4
- package/dist/bscPlugin/transpile/{BrsFileTranspileProcessor.js → BrsFilePreTranspileProcessor.js} +15 -36
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js.map +1 -0
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js +46 -0
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/validation/BrsFileValidator.d.ts +1 -0
- package/dist/bscPlugin/validation/BrsFileValidator.js +30 -41
- package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -1
- package/dist/bscPlugin/validation/BrsFileValidator.spec.js +2 -2
- package/dist/bscPlugin/validation/BrsFileValidator.spec.js.map +1 -1
- package/dist/bscPlugin/validation/ProgramValidator.d.ts +3 -3
- package/dist/bscPlugin/validation/ProgramValidator.js +6 -6
- package/dist/bscPlugin/validation/ProgramValidator.js.map +1 -1
- package/dist/bscPlugin/validation/ScopeValidator.d.ts +6 -28
- package/dist/bscPlugin/validation/ScopeValidator.js +166 -387
- package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -1
- package/dist/bscPlugin/validation/XmlFileValidator.js +9 -9
- package/dist/bscPlugin/validation/XmlFileValidator.js.map +1 -1
- package/dist/diagnosticUtils.d.ts +2 -3
- package/dist/diagnosticUtils.js +5 -5
- 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/BrsFile.Class.spec.js +143 -114
- package/dist/files/BrsFile.Class.spec.js.map +1 -1
- package/dist/files/BrsFile.d.ts +61 -83
- package/dist/files/BrsFile.js +559 -612
- package/dist/files/BrsFile.js.map +1 -1
- package/dist/files/BrsFile.spec.js +1365 -1201
- package/dist/files/BrsFile.spec.js.map +1 -1
- package/dist/files/XmlFile.d.ts +28 -56
- package/dist/files/XmlFile.js +103 -89
- package/dist/files/XmlFile.js.map +1 -1
- package/dist/files/XmlFile.spec.js +179 -122
- package/dist/files/XmlFile.spec.js.map +1 -1
- package/dist/files/tests/imports.spec.js +19 -29
- 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 +83 -88
- package/dist/globalCallables.js.map +1 -1
- package/dist/index.d.ts +1 -9
- package/dist/index.js +1 -9
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +173 -423
- package/dist/interfaces.js +0 -24
- package/dist/interfaces.js.map +1 -1
- package/dist/lexer/Lexer.d.ts +9 -15
- package/dist/lexer/Lexer.js +35 -46
- package/dist/lexer/Lexer.js.map +1 -1
- package/dist/lexer/Lexer.spec.js +48 -40
- package/dist/lexer/Lexer.spec.js.map +1 -1
- package/dist/lexer/Token.d.ts +1 -5
- package/dist/lexer/Token.js +1 -1
- package/dist/lexer/Token.js.map +1 -1
- package/dist/lexer/TokenKind.d.ts +0 -6
- package/dist/lexer/TokenKind.js +2 -14
- package/dist/lexer/TokenKind.js.map +1 -1
- package/dist/logging.d.ts +9 -0
- package/dist/logging.js +16 -0
- package/dist/logging.js.map +1 -0
- package/dist/parser/AstNode.d.ts +6 -90
- package/dist/parser/AstNode.js +5 -96
- package/dist/parser/AstNode.js.map +1 -1
- package/dist/parser/AstNode.spec.js.map +1 -1
- package/dist/parser/BrsTranspileState.d.ts +3 -4
- package/dist/parser/BrsTranspileState.js +2 -3
- package/dist/parser/BrsTranspileState.js.map +1 -1
- package/dist/parser/Expression.d.ts +114 -137
- package/dist/parser/Expression.js +244 -373
- package/dist/parser/Expression.js.map +1 -1
- package/dist/parser/Parser.Class.spec.js +19 -46
- package/dist/parser/Parser.Class.spec.js.map +1 -1
- package/dist/parser/Parser.d.ts +18 -14
- package/dist/parser/Parser.js +196 -175
- package/dist/parser/Parser.js.map +1 -1
- package/dist/parser/Parser.spec.d.ts +0 -2
- package/dist/parser/Parser.spec.js +10 -674
- package/dist/parser/Parser.spec.js.map +1 -1
- package/dist/parser/SGParser.d.ts +6 -44
- package/dist/parser/SGParser.js +198 -194
- package/dist/parser/SGParser.js.map +1 -1
- package/dist/parser/SGParser.spec.js +11 -14
- package/dist/parser/SGParser.spec.js.map +1 -1
- package/dist/parser/SGTypes.d.ts +52 -280
- package/dist/parser/SGTypes.js +185 -562
- package/dist/parser/SGTypes.js.map +1 -1
- package/dist/parser/Statement.d.ts +140 -172
- package/dist/parser/Statement.js +201 -337
- package/dist/parser/Statement.js.map +1 -1
- package/dist/parser/Statement.spec.js.map +1 -1
- package/dist/parser/TranspileState.d.ts +3 -2
- package/dist/parser/TranspileState.js +8 -10
- package/dist/parser/TranspileState.js.map +1 -1
- package/dist/parser/tests/Parser.spec.js +3 -5
- package/dist/parser/tests/Parser.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/For.spec.js +8 -16
- package/dist/parser/tests/controlFlow/For.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/ForEach.spec.js +6 -12
- package/dist/parser/tests/controlFlow/ForEach.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/While.spec.js +4 -8
- 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/Indexing.spec.js +25 -0
- package/dist/parser/tests/expression/Indexing.spec.js.map +1 -1
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +73 -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 +47 -35
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TernaryExpression.spec.js +83 -36
- package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/UnaryExpression.spec.js +2 -2
- package/dist/parser/tests/expression/UnaryExpression.spec.js.map +1 -1
- package/dist/parser/tests/statement/ConstStatement.spec.js +26 -27
- 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/Dim.spec.js.map +1 -1
- package/dist/parser/tests/statement/Enum.spec.js +393 -90
- 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/Function.spec.js +1 -1
- package/dist/parser/tests/statement/Function.spec.js.map +1 -1
- package/dist/parser/tests/statement/InterfaceStatement.spec.js +18 -18
- package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/Misc.spec.js.map +1 -1
- package/dist/parser/tests/statement/PrintStatement.spec.js +13 -16
- package/dist/parser/tests/statement/PrintStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/ReturnStatement.spec.js +3 -5
- package/dist/parser/tests/statement/ReturnStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/Set.spec.js +13 -26
- package/dist/parser/tests/statement/Set.spec.js.map +1 -1
- package/dist/parser/tests/statement/Throw.spec.js.map +1 -1
- package/dist/parser/tests/statement/TryCatch.spec.js.map +1 -1
- package/dist/preprocessor/Chunk.js +1 -2
- package/dist/preprocessor/Chunk.js.map +1 -1
- package/dist/preprocessor/Preprocessor.d.ts +3 -4
- package/dist/preprocessor/Preprocessor.js +3 -3
- package/dist/preprocessor/Preprocessor.js.map +1 -1
- package/dist/preprocessor/PreprocessorParser.js +8 -1
- package/dist/preprocessor/PreprocessorParser.js.map +1 -1
- package/dist/roku-types/data.json +293 -243
- package/dist/roku-types/index.d.ts +38 -17
- package/dist/types/ArrayType.d.ts +4 -9
- package/dist/types/ArrayType.js +24 -72
- package/dist/types/ArrayType.js.map +1 -1
- package/dist/types/ArrayType.spec.js +10 -39
- package/dist/types/ArrayType.spec.js.map +1 -1
- package/dist/types/BooleanType.d.ts +4 -8
- package/dist/types/BooleanType.js +8 -19
- package/dist/types/BooleanType.js.map +1 -1
- package/dist/types/BooleanType.spec.js +3 -9
- package/dist/types/BooleanType.spec.js.map +1 -1
- package/dist/types/BscType.d.ts +2 -29
- package/dist/types/BscType.js +0 -113
- package/dist/types/BscType.js.map +1 -1
- package/dist/types/CustomType.d.ts +9 -0
- package/dist/types/CustomType.js +32 -0
- package/dist/types/CustomType.js.map +1 -0
- package/dist/types/DoubleType.d.ts +4 -8
- package/dist/types/DoubleType.js +20 -23
- package/dist/types/DoubleType.js.map +1 -1
- package/dist/types/DoubleType.spec.js +3 -11
- package/dist/types/DoubleType.spec.js.map +1 -1
- package/dist/types/DynamicType.d.ts +3 -9
- package/dist/types/DynamicType.js +2 -18
- package/dist/types/DynamicType.js.map +1 -1
- package/dist/types/DynamicType.spec.js +4 -15
- package/dist/types/DynamicType.spec.js.map +1 -1
- package/dist/types/FloatType.d.ts +4 -8
- package/dist/types/FloatType.js +20 -23
- package/dist/types/FloatType.js.map +1 -1
- package/dist/types/FloatType.spec.js +3 -3
- package/dist/types/FloatType.spec.js.map +1 -1
- package/dist/types/FunctionType.d.ts +20 -10
- package/dist/types/FunctionType.js +52 -27
- package/dist/types/FunctionType.js.map +1 -1
- package/dist/types/FunctionType.spec.js +23 -0
- package/dist/types/FunctionType.spec.js.map +1 -0
- package/dist/types/IntegerType.d.ts +4 -8
- package/dist/types/IntegerType.js +20 -23
- package/dist/types/IntegerType.js.map +1 -1
- package/dist/types/IntegerType.spec.js +3 -7
- package/dist/types/IntegerType.spec.js.map +1 -1
- package/dist/types/InterfaceType.d.ts +10 -12
- package/dist/types/InterfaceType.js +48 -23
- package/dist/types/InterfaceType.js.map +1 -1
- package/dist/types/InterfaceType.spec.js +45 -82
- package/dist/types/InterfaceType.spec.js.map +1 -1
- package/dist/types/InvalidType.d.ts +4 -7
- package/dist/types/InvalidType.js +8 -18
- package/dist/types/InvalidType.js.map +1 -1
- package/dist/types/InvalidType.spec.js +3 -7
- package/dist/types/InvalidType.spec.js.map +1 -1
- package/dist/types/LongIntegerType.d.ts +4 -8
- package/dist/types/LongIntegerType.js +20 -23
- package/dist/types/LongIntegerType.js.map +1 -1
- package/dist/types/LongIntegerType.spec.js +3 -9
- package/dist/types/LongIntegerType.spec.js.map +1 -1
- package/dist/types/ObjectType.d.ts +4 -8
- package/dist/types/ObjectType.js +7 -21
- 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 -11
- package/dist/types/StringType.js +8 -23
- package/dist/types/StringType.js.map +1 -1
- package/dist/types/StringType.spec.js +2 -2
- package/dist/types/StringType.spec.js.map +1 -1
- package/dist/types/UninitializedType.d.ts +3 -7
- package/dist/types/UninitializedType.js +3 -14
- package/dist/types/UninitializedType.js.map +1 -1
- package/dist/types/VoidType.d.ts +4 -8
- package/dist/types/VoidType.js +8 -18
- 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/util.d.ts +43 -104
- package/dist/util.js +243 -640
- package/dist/util.js.map +1 -1
- package/dist/validators/ClassValidator.d.ts +6 -1
- package/dist/validators/ClassValidator.js +61 -20
- package/dist/validators/ClassValidator.js.map +1 -1
- package/package.json +13 -11
- package/dist/ActionPipeline.d.ts +0 -10
- package/dist/ActionPipeline.js +0 -40
- package/dist/ActionPipeline.js.map +0 -1
- package/dist/AstValidationSegmenter.d.ts +0 -25
- package/dist/AstValidationSegmenter.js +0 -150
- package/dist/AstValidationSegmenter.js.map +0 -1
- package/dist/CacheVerifier.d.ts +0 -7
- package/dist/CacheVerifier.js +0 -20
- package/dist/CacheVerifier.js.map +0 -1
- package/dist/astUtils/Editor.js.map +0 -1
- package/dist/astUtils/Editor.spec.js.map +0 -1
- package/dist/bscPlugin/FileWriter.d.ts +0 -6
- package/dist/bscPlugin/FileWriter.js +0 -24
- package/dist/bscPlugin/FileWriter.js.map +0 -1
- package/dist/bscPlugin/completions/CompletionsProcessor.spec.js +0 -1658
- package/dist/bscPlugin/completions/CompletionsProcessor.spec.js.map +0 -1
- package/dist/bscPlugin/fileProviders/FileProvider.d.ts +0 -9
- package/dist/bscPlugin/fileProviders/FileProvider.js +0 -51
- package/dist/bscPlugin/fileProviders/FileProvider.js.map +0 -1
- package/dist/bscPlugin/serialize/BslibInjector.spec.js +0 -19
- package/dist/bscPlugin/serialize/BslibInjector.spec.js.map +0 -1
- package/dist/bscPlugin/serialize/BslibManager.d.ts +0 -9
- package/dist/bscPlugin/serialize/BslibManager.js +0 -40
- package/dist/bscPlugin/serialize/BslibManager.js.map +0 -1
- package/dist/bscPlugin/serialize/FileSerializer.d.ts +0 -9
- package/dist/bscPlugin/serialize/FileSerializer.js +0 -72
- package/dist/bscPlugin/serialize/FileSerializer.js.map +0 -1
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js.map +0 -1
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js +0 -41
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js.map +0 -1
- package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.d.ts +0 -11
- package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.js +0 -53
- package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.js.map +0 -1
- package/dist/bscPlugin/validation/ScopeValidator.spec.js +0 -2004
- package/dist/bscPlugin/validation/ScopeValidator.spec.js.map +0 -1
- package/dist/files/AssetFile.d.ts +0 -26
- package/dist/files/AssetFile.js +0 -26
- package/dist/files/AssetFile.js.map +0 -1
- package/dist/files/Factory.d.ts +0 -25
- package/dist/files/Factory.js +0 -22
- package/dist/files/Factory.js.map +0 -1
- package/dist/files/File.d.ts +0 -106
- package/dist/files/File.js +0 -16
- package/dist/files/File.js.map +0 -1
- package/dist/files/LazyFileData.d.ts +0 -20
- package/dist/files/LazyFileData.js +0 -54
- package/dist/files/LazyFileData.js.map +0 -1
- package/dist/files/LazyFileData.spec.js +0 -27
- package/dist/files/LazyFileData.spec.js.map +0 -1
- package/dist/parser/tests/expression/TypeExpression.spec.js +0 -127
- package/dist/parser/tests/expression/TypeExpression.spec.js.map +0 -1
- package/dist/types/AssociativeArrayType.d.ts +0 -11
- package/dist/types/AssociativeArrayType.js +0 -52
- package/dist/types/AssociativeArrayType.js.map +0 -1
- package/dist/types/BaseFunctionType.d.ts +0 -9
- package/dist/types/BaseFunctionType.js +0 -25
- package/dist/types/BaseFunctionType.js.map +0 -1
- package/dist/types/BscTypeKind.d.ts +0 -25
- package/dist/types/BscTypeKind.js +0 -30
- package/dist/types/BscTypeKind.js.map +0 -1
- package/dist/types/BuiltInInterfaceAdder.d.ts +0 -23
- package/dist/types/BuiltInInterfaceAdder.js +0 -160
- package/dist/types/BuiltInInterfaceAdder.js.map +0 -1
- package/dist/types/BuiltInInterfaceAdder.spec.d.ts +0 -1
- package/dist/types/BuiltInInterfaceAdder.spec.js +0 -116
- package/dist/types/BuiltInInterfaceAdder.spec.js.map +0 -1
- package/dist/types/ClassType.d.ts +0 -17
- package/dist/types/ClassType.js +0 -58
- package/dist/types/ClassType.js.map +0 -1
- package/dist/types/ClassType.spec.d.ts +0 -1
- package/dist/types/ClassType.spec.js +0 -77
- package/dist/types/ClassType.spec.js.map +0 -1
- package/dist/types/ComponentType.d.ts +0 -26
- package/dist/types/ComponentType.js +0 -83
- package/dist/types/ComponentType.js.map +0 -1
- package/dist/types/EnumType.d.ts +0 -40
- package/dist/types/EnumType.js +0 -81
- package/dist/types/EnumType.js.map +0 -1
- package/dist/types/EnumType.spec.d.ts +0 -1
- package/dist/types/EnumType.spec.js +0 -33
- package/dist/types/EnumType.spec.js.map +0 -1
- package/dist/types/InheritableType.d.ts +0 -28
- package/dist/types/InheritableType.js +0 -152
- package/dist/types/InheritableType.js.map +0 -1
- package/dist/types/NamespaceType.d.ts +0 -12
- package/dist/types/NamespaceType.js +0 -28
- package/dist/types/NamespaceType.js.map +0 -1
- package/dist/types/ReferenceType.d.ts +0 -63
- package/dist/types/ReferenceType.js +0 -423
- package/dist/types/ReferenceType.js.map +0 -1
- package/dist/types/ReferenceType.spec.d.ts +0 -1
- package/dist/types/ReferenceType.spec.js +0 -137
- package/dist/types/ReferenceType.spec.js.map +0 -1
- package/dist/types/TypedFunctionType.d.ts +0 -33
- package/dist/types/TypedFunctionType.js +0 -106
- package/dist/types/TypedFunctionType.js.map +0 -1
- package/dist/types/TypedFunctionType.spec.d.ts +0 -1
- package/dist/types/TypedFunctionType.spec.js +0 -122
- package/dist/types/TypedFunctionType.spec.js.map +0 -1
- package/dist/types/UnionType.d.ts +0 -20
- package/dist/types/UnionType.js +0 -123
- package/dist/types/UnionType.js.map +0 -1
- package/dist/types/UnionType.spec.d.ts +0 -1
- package/dist/types/UnionType.spec.js +0 -130
- package/dist/types/UnionType.spec.js.map +0 -1
- package/dist/types/helper.spec.d.ts +0 -1
- package/dist/types/helper.spec.js +0 -145
- package/dist/types/helper.spec.js.map +0 -1
- package/dist/types/helpers.d.ts +0 -24
- package/dist/types/helpers.js +0 -178
- package/dist/types/helpers.js.map +0 -1
- package/dist/types/index.d.ts +0 -22
- package/dist/types/index.js +0 -39
- package/dist/types/index.js.map +0 -1
- /package/dist/astUtils/{Editor.spec.d.ts → AstEditor.spec.d.ts} +0 -0
- /package/dist/bscPlugin/{completions/CompletionsProcessor.spec.d.ts → definition/DefinitionProvider.spec.d.ts} +0 -0
- /package/dist/bscPlugin/{serialize/BslibInjector.spec.d.ts → references/ReferencesProvider.spec.d.ts} +0 -0
- /package/dist/bscPlugin/{transpile/BrsFileTranspileProcessor.spec.d.ts → symbols/DocumentSymbolProcessor.spec.d.ts} +0 -0
- /package/dist/bscPlugin/{validation/ScopeValidator.spec.d.ts → symbols/WorkspaceSymbolProcessor.spec.d.ts} +0 -0
- /package/dist/{files/LazyFileData.spec.d.ts → bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.d.ts} +0 -0
- /package/dist/{parser/tests/expression/TypeExpression.spec.d.ts → types/FunctionType.spec.d.ts} +0 -0
package/dist/parser/SGTypes.js
CHANGED
|
@@ -1,304 +1,152 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SGAst = exports.SGComponent = exports.SGInterface = exports.
|
|
3
|
+
exports.SGAst = exports.SGComponent = exports.SGInterface = exports.SGFunction = exports.SGFieldTypes = exports.SGField = exports.SGScript = exports.SGChildren = exports.SGNode = exports.SGProlog = exports.SGTag = void 0;
|
|
4
4
|
const source_map_1 = require("source-map");
|
|
5
5
|
const creators_1 = require("../astUtils/creators");
|
|
6
|
-
const
|
|
7
|
-
const DynamicType_1 = require("../types/DynamicType");
|
|
8
|
-
const FloatType_1 = require("../types/FloatType");
|
|
9
|
-
const IntegerType_1 = require("../types/IntegerType");
|
|
10
|
-
const LongIntegerType_1 = require("../types/LongIntegerType");
|
|
11
|
-
const StringType_1 = require("../types/StringType");
|
|
6
|
+
const xml_1 = require("../astUtils/xml");
|
|
12
7
|
const util_1 = require("../util");
|
|
13
|
-
class
|
|
14
|
-
constructor(
|
|
15
|
-
this.
|
|
16
|
-
this._range = null;
|
|
17
|
-
this.tokens.key = key;
|
|
18
|
-
this.tokens.equals = equals;
|
|
19
|
-
this.tokens.openingQuote = openingQuote;
|
|
20
|
-
this.tokens.value = value;
|
|
21
|
-
this.tokens.closingQuote = closingQuote;
|
|
22
|
-
}
|
|
23
|
-
get key() {
|
|
24
|
-
return this.tokens.key.text;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* The value of this attribute. This does not including the opening or closing quote
|
|
28
|
-
*/
|
|
29
|
-
get value() {
|
|
30
|
-
var _a;
|
|
31
|
-
return (_a = this.tokens.value) === null || _a === void 0 ? void 0 : _a.text;
|
|
32
|
-
}
|
|
33
|
-
set value(val) {
|
|
34
|
-
if (val === null || val === undefined) {
|
|
35
|
-
val = '';
|
|
36
|
-
}
|
|
37
|
-
if (!this.tokens.equals) {
|
|
38
|
-
this.tokens.equals = { text: '=' };
|
|
39
|
-
}
|
|
40
|
-
if (this.tokens.value) {
|
|
41
|
-
this.tokens.value.text = val;
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
this.tokens.value = { text: val };
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
get range() {
|
|
48
|
-
if (!this._range) {
|
|
49
|
-
this._range = util_1.default.createBoundingRange(this.tokens.key, this.tokens.equals, this.tokens.openingQuote, this.tokens.value, this.tokens.closingQuote);
|
|
50
|
-
}
|
|
51
|
-
return this._range;
|
|
52
|
-
}
|
|
53
|
-
transpile(state) {
|
|
54
|
-
const result = [
|
|
55
|
-
state.transpileToken(this.tokens.key)
|
|
56
|
-
];
|
|
57
|
-
if (this.tokens.value) {
|
|
58
|
-
result.push(state.transpileToken(this.tokens.equals, '='), state.transpileToken(this.tokens.openingQuote, '"'), state.transpileToken(this.tokens.value), state.transpileToken(this.tokens.closingQuote, '"'));
|
|
59
|
-
}
|
|
60
|
-
return new source_map_1.SourceNode(null, null, null, result);
|
|
61
|
-
}
|
|
62
|
-
clone() {
|
|
63
|
-
return new SGAttribute(Object.assign({}, this.tokens.key), Object.assign({}, this.tokens.equals), Object.assign({}, this.tokens.openingQuote), Object.assign({}, this.tokens.value), Object.assign({}, this.tokens.closingQuote));
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
exports.SGAttribute = SGAttribute;
|
|
67
|
-
class SGElement {
|
|
68
|
-
constructor(startTagOpen, startTagName, attributes = [], startTagClose, elements = [], endTagOpen, endTagName, endTagClose) {
|
|
69
|
-
this.tokens = {};
|
|
70
|
-
/**
|
|
71
|
-
* Array of attributes found on this tag
|
|
72
|
-
*/
|
|
73
|
-
this.attributes = [];
|
|
74
|
-
/**
|
|
75
|
-
* The array of direct children AST elements of this AST node
|
|
76
|
-
*/
|
|
77
|
-
this.elements = [];
|
|
78
|
-
this._range = null;
|
|
79
|
-
this.tokens.startTagOpen = startTagOpen;
|
|
80
|
-
this.tokens.startTagName = startTagName;
|
|
8
|
+
class SGTag {
|
|
9
|
+
constructor(tag, attributes = [], range) {
|
|
10
|
+
this.tag = tag;
|
|
81
11
|
this.attributes = attributes;
|
|
82
|
-
this.
|
|
83
|
-
this.elements = elements;
|
|
84
|
-
this.tokens.endTagOpen = endTagOpen;
|
|
85
|
-
this.tokens.endTagName = endTagName;
|
|
86
|
-
this.tokens.endTagClose = endTagClose;
|
|
87
|
-
}
|
|
88
|
-
get range() {
|
|
89
|
-
var _a, _b, _c, _d;
|
|
90
|
-
if (!this._range) {
|
|
91
|
-
this._range = util_1.default.createBoundingRange(this.tokens.startTagOpen, this.tokens.startTagName, (_a = this.attributes) === null || _a === void 0 ? void 0 : _a[((_b = this.attributes) === null || _b === void 0 ? void 0 : _b.length) - 1], this.tokens.startTagClose, (_c = this.elements) === null || _c === void 0 ? void 0 : _c[((_d = this.elements) === null || _d === void 0 ? void 0 : _d.length) - 1], this.tokens.endTagOpen, this.tokens.endTagName, this.tokens.endTagClose);
|
|
92
|
-
}
|
|
93
|
-
return this._range;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Is this a self-closing tag?
|
|
97
|
-
*/
|
|
98
|
-
get isSelfClosing() {
|
|
99
|
-
var _a;
|
|
100
|
-
return this.tokens.startTagClose && ((_a = this.tokens.startTagClose) === null || _a === void 0 ? void 0 : _a.text) !== '>';
|
|
12
|
+
this.range = range;
|
|
101
13
|
}
|
|
102
14
|
get id() {
|
|
103
15
|
return this.getAttributeValue('id');
|
|
104
16
|
}
|
|
105
17
|
set id(value) {
|
|
106
|
-
this.
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Get the name of this tag.
|
|
110
|
-
*/
|
|
111
|
-
get tagName() {
|
|
112
|
-
var _a;
|
|
113
|
-
return (_a = this.tokens.startTagName) === null || _a === void 0 ? void 0 : _a.text;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Find all direct children by their tag name (case insensitive).
|
|
117
|
-
* This does not step into children's children.
|
|
118
|
-
*
|
|
119
|
-
*/
|
|
120
|
-
getElementsByTagName(tagName) {
|
|
121
|
-
const result = [];
|
|
122
|
-
const lowerTagName = tagName.toLowerCase();
|
|
123
|
-
for (const el of this.elements) {
|
|
124
|
-
if (el.tokens.startTagName.text.toLowerCase() === lowerTagName) {
|
|
125
|
-
result.push(el);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return result;
|
|
18
|
+
this.setAttribute('id', value);
|
|
129
19
|
}
|
|
130
|
-
/**
|
|
131
|
-
* Add a child to the end of the children array
|
|
132
|
-
*/
|
|
133
|
-
addChild(tag) {
|
|
134
|
-
this.elements.push(tag);
|
|
135
|
-
return tag;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Remove a child from the children array.
|
|
139
|
-
* @returns true if node was found and removed, false if the node wasn't there and thus nothing was done
|
|
140
|
-
*/
|
|
141
|
-
removeChild(tag) {
|
|
142
|
-
const idx = this.elements.indexOf(tag);
|
|
143
|
-
if (idx > -1) {
|
|
144
|
-
this.elements.splice(idx, 1);
|
|
145
|
-
return true;
|
|
146
|
-
}
|
|
147
|
-
return false;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Does this node have the specified attribute?
|
|
151
|
-
*/
|
|
152
|
-
hasAttribute(name) {
|
|
153
|
-
return !!this.getAttribute(name);
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Get an SGAttribute by its name (case INsensitive)
|
|
157
|
-
*/
|
|
158
20
|
getAttribute(name) {
|
|
159
|
-
|
|
160
|
-
const nameLower = name.toLowerCase();
|
|
161
|
-
for (const attr of this.attributes) {
|
|
162
|
-
if (((_a = attr.tokens.key) === null || _a === void 0 ? void 0 : _a.text.toLowerCase()) === nameLower) {
|
|
163
|
-
return attr;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
21
|
+
return this.attributes.find(att => att.key.text.toLowerCase() === name);
|
|
166
22
|
}
|
|
167
|
-
/**
|
|
168
|
-
* Get an attribute value by its name
|
|
169
|
-
*/
|
|
170
23
|
getAttributeValue(name) {
|
|
171
24
|
var _a, _b;
|
|
172
|
-
return (_b = (_a = this.getAttribute(name)) === null || _a === void 0 ? void 0 : _a.
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
else {
|
|
182
|
-
let attr = this.getAttribute(name);
|
|
183
|
-
//create an attribute with this name if we don't have one yet
|
|
184
|
-
if (!attr) {
|
|
185
|
-
attr = (0, creators_1.createSGAttribute)(name, value);
|
|
186
|
-
this.attributes.push(attr);
|
|
25
|
+
return (_b = (_a = this.getAttribute(name.toLowerCase())) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.text;
|
|
26
|
+
}
|
|
27
|
+
setAttribute(name, value) {
|
|
28
|
+
const attr = this.getAttribute(name);
|
|
29
|
+
if (attr) {
|
|
30
|
+
if (value) {
|
|
31
|
+
attr.value = { text: value };
|
|
32
|
+
attr.range = undefined;
|
|
187
33
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Remove an attribute by its name. DO NOT USE this to edit AST (use ASTEditor)
|
|
193
|
-
* @returns true if an attribute was found and removed. False if no attribute was found
|
|
194
|
-
*/
|
|
195
|
-
removeAttribute(name) {
|
|
196
|
-
var _a;
|
|
197
|
-
const nameLower = name.toLowerCase();
|
|
198
|
-
for (let i = 0; i < this.attributes.length; i++) {
|
|
199
|
-
if (((_a = this.attributes[i].key) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === nameLower) {
|
|
200
|
-
this.attributes.splice(i, 1);
|
|
201
|
-
return true;
|
|
34
|
+
else {
|
|
35
|
+
this.attributes.splice(this.attributes.indexOf(attr), 1);
|
|
202
36
|
}
|
|
203
37
|
}
|
|
204
|
-
|
|
38
|
+
else if (value) {
|
|
39
|
+
this.attributes.push({
|
|
40
|
+
key: { text: name },
|
|
41
|
+
value: { text: value }
|
|
42
|
+
});
|
|
43
|
+
}
|
|
205
44
|
}
|
|
206
45
|
transpile(state) {
|
|
207
|
-
return new source_map_1.SourceNode(null, null,
|
|
208
|
-
state.
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
this.
|
|
46
|
+
return new source_map_1.SourceNode(null, null, state.srcPath, [
|
|
47
|
+
state.indentText,
|
|
48
|
+
'<',
|
|
49
|
+
state.transpileToken(this.tag),
|
|
50
|
+
...this.transpileAttributes(state, this.attributes),
|
|
51
|
+
...this.transpileBody(state)
|
|
212
52
|
]);
|
|
213
53
|
}
|
|
214
54
|
transpileBody(state) {
|
|
215
|
-
|
|
216
|
-
if (this.isSelfClosing) {
|
|
217
|
-
return new source_map_1.SourceNode(null, null, null, [
|
|
218
|
-
' ',
|
|
219
|
-
state.transpileToken(this.tokens.startTagClose, '/>'),
|
|
220
|
-
state.newline
|
|
221
|
-
]);
|
|
222
|
-
}
|
|
223
|
-
else {
|
|
224
|
-
const chunks = [
|
|
225
|
-
state.transpileToken(this.tokens.startTagClose, '>'),
|
|
226
|
-
state.newline
|
|
227
|
-
];
|
|
228
|
-
state.blockDepth++;
|
|
229
|
-
for (const child of this.elements) {
|
|
230
|
-
chunks.push(state.indentText, child.transpile(state));
|
|
231
|
-
}
|
|
232
|
-
state.blockDepth--;
|
|
233
|
-
chunks.push(state.indentText, state.transpileToken(this.tokens.endTagOpen, '</'), state.transpileToken((_a = this.tokens.endTagName) !== null && _a !== void 0 ? _a : this.tokens.startTagName), state.transpileToken(this.tokens.endTagClose, '>'), state.newline);
|
|
234
|
-
return new source_map_1.SourceNode(null, null, null, chunks);
|
|
235
|
-
}
|
|
55
|
+
return [' />\n'];
|
|
236
56
|
}
|
|
237
57
|
transpileAttributes(state, attributes) {
|
|
238
|
-
|
|
58
|
+
var _a, _b;
|
|
59
|
+
const result = [];
|
|
239
60
|
for (const attr of attributes) {
|
|
240
|
-
|
|
61
|
+
result.push(' ', state.transpileToken(attr.key), '=', state.transpileToken((_a = attr.openQuote) !== null && _a !== void 0 ? _a : { text: '"' }), state.transpileToken(attr.value), state.transpileToken((_b = attr.closeQuote) !== null && _b !== void 0 ? _b : { text: '"' }));
|
|
241
62
|
}
|
|
242
|
-
return
|
|
63
|
+
return result;
|
|
243
64
|
}
|
|
244
65
|
}
|
|
245
|
-
exports.
|
|
246
|
-
class SGProlog extends
|
|
66
|
+
exports.SGTag = SGTag;
|
|
67
|
+
class SGProlog extends SGTag {
|
|
68
|
+
transpile(state) {
|
|
69
|
+
return new source_map_1.SourceNode(null, null, state.srcPath, [
|
|
70
|
+
'<?xml',
|
|
71
|
+
...this.transpileAttributes(state, this.attributes),
|
|
72
|
+
' ?>\n'
|
|
73
|
+
]);
|
|
74
|
+
}
|
|
247
75
|
}
|
|
248
76
|
exports.SGProlog = SGProlog;
|
|
249
|
-
class SGNode extends
|
|
77
|
+
class SGNode extends SGTag {
|
|
78
|
+
constructor(tag, attributes, children = [], range) {
|
|
79
|
+
super(tag, attributes, range);
|
|
80
|
+
this.children = children;
|
|
81
|
+
}
|
|
82
|
+
transpileBody(state) {
|
|
83
|
+
if (this.children.length > 0) {
|
|
84
|
+
const body = ['>\n'];
|
|
85
|
+
state.blockDepth++;
|
|
86
|
+
body.push(...this.children.map(node => node.transpile(state)));
|
|
87
|
+
state.blockDepth--;
|
|
88
|
+
body.push(state.indentText, '</', this.tag.text, '>\n');
|
|
89
|
+
return body;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
return super.transpileBody(state);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
250
95
|
}
|
|
251
96
|
exports.SGNode = SGNode;
|
|
252
|
-
class SGChildren extends
|
|
97
|
+
class SGChildren extends SGNode {
|
|
98
|
+
constructor(tag = { text: 'children' }, children = [], range) {
|
|
99
|
+
super(tag, [], children, range);
|
|
100
|
+
}
|
|
253
101
|
}
|
|
254
102
|
exports.SGChildren = SGChildren;
|
|
255
|
-
class
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
|
|
103
|
+
class SGScript extends SGTag {
|
|
104
|
+
constructor(tag = { text: 'script' }, attributes, cdata, range) {
|
|
105
|
+
super(tag, attributes, range);
|
|
106
|
+
this.cdata = cdata;
|
|
107
|
+
if (!attributes) {
|
|
108
|
+
this.type = 'text/brightscript';
|
|
109
|
+
}
|
|
110
|
+
}
|
|
259
111
|
get type() {
|
|
260
112
|
return this.getAttributeValue('type');
|
|
261
113
|
}
|
|
262
114
|
set type(value) {
|
|
263
|
-
this.
|
|
115
|
+
this.setAttribute('type', value);
|
|
264
116
|
}
|
|
265
117
|
get uri() {
|
|
266
118
|
return this.getAttributeValue('uri');
|
|
267
119
|
}
|
|
268
120
|
set uri(value) {
|
|
269
|
-
this.
|
|
121
|
+
this.setAttribute('uri', value);
|
|
270
122
|
}
|
|
271
123
|
transpileBody(state) {
|
|
272
124
|
if (this.cdata) {
|
|
273
|
-
return
|
|
125
|
+
return [
|
|
274
126
|
'>',
|
|
275
127
|
state.transpileToken(this.cdata),
|
|
276
128
|
'</',
|
|
277
|
-
this.
|
|
278
|
-
'
|
|
279
|
-
|
|
280
|
-
]);
|
|
129
|
+
this.tag.text,
|
|
130
|
+
'>\n'
|
|
131
|
+
];
|
|
281
132
|
}
|
|
282
133
|
else {
|
|
283
134
|
return super.transpileBody(state);
|
|
284
135
|
}
|
|
285
136
|
}
|
|
286
137
|
transpileAttributes(state, attributes) {
|
|
287
|
-
var _a, _b, _c;
|
|
288
138
|
const modifiedAttributes = [];
|
|
289
139
|
let foundType = false;
|
|
290
140
|
const bsExtensionRegexp = /\.bs$/i;
|
|
291
141
|
for (const attr of attributes) {
|
|
292
|
-
const lowerKey =
|
|
293
|
-
if (lowerKey === 'uri' && bsExtensionRegexp.exec(
|
|
294
|
-
|
|
295
|
-
clone.tokens.value.text.replace(bsExtensionRegexp, '.brs');
|
|
296
|
-
modifiedAttributes.push(clone);
|
|
142
|
+
const lowerKey = attr.key.text.toLowerCase();
|
|
143
|
+
if (lowerKey === 'uri' && bsExtensionRegexp.exec(attr.value.text)) {
|
|
144
|
+
modifiedAttributes.push(util_1.default.cloneSGAttribute(attr, attr.value.text.replace(bsExtensionRegexp, '.brs')));
|
|
297
145
|
}
|
|
298
146
|
else if (lowerKey === 'type') {
|
|
299
147
|
foundType = true;
|
|
300
|
-
if (
|
|
301
|
-
modifiedAttributes.push(
|
|
148
|
+
if (attr.value.text.toLowerCase().endsWith('brighterscript')) {
|
|
149
|
+
modifiedAttributes.push(util_1.default.cloneSGAttribute(attr, 'text/brightscript'));
|
|
302
150
|
}
|
|
303
151
|
else {
|
|
304
152
|
modifiedAttributes.push(attr);
|
|
@@ -315,161 +163,85 @@ class SGScript extends SGElement {
|
|
|
315
163
|
}
|
|
316
164
|
}
|
|
317
165
|
exports.SGScript = SGScript;
|
|
318
|
-
class
|
|
166
|
+
class SGField extends SGTag {
|
|
167
|
+
constructor(tag = { text: 'field' }, attributes = [], range) {
|
|
168
|
+
super(tag, attributes, range);
|
|
169
|
+
}
|
|
319
170
|
get type() {
|
|
320
171
|
return this.getAttributeValue('type');
|
|
321
172
|
}
|
|
322
173
|
set type(value) {
|
|
323
|
-
this.
|
|
174
|
+
this.setAttribute('type', value);
|
|
324
175
|
}
|
|
325
176
|
get alias() {
|
|
326
177
|
return this.getAttributeValue('alias');
|
|
327
178
|
}
|
|
328
179
|
set alias(value) {
|
|
329
|
-
this.
|
|
180
|
+
this.setAttribute('alias', value);
|
|
330
181
|
}
|
|
331
182
|
get value() {
|
|
332
183
|
return this.getAttributeValue('value');
|
|
333
184
|
}
|
|
334
185
|
set value(value) {
|
|
335
|
-
this.
|
|
186
|
+
this.setAttribute('value', value);
|
|
336
187
|
}
|
|
337
188
|
get onChange() {
|
|
338
189
|
return this.getAttributeValue('onChange');
|
|
339
190
|
}
|
|
340
191
|
set onChange(value) {
|
|
341
|
-
this.
|
|
192
|
+
this.setAttribute('onChange', value);
|
|
342
193
|
}
|
|
343
194
|
get alwaysNotify() {
|
|
344
195
|
return this.getAttributeValue('alwaysNotify');
|
|
345
196
|
}
|
|
346
197
|
set alwaysNotify(value) {
|
|
347
|
-
this.
|
|
198
|
+
this.setAttribute('alwaysNotify', value);
|
|
348
199
|
}
|
|
349
200
|
}
|
|
350
|
-
exports.
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
SGFieldType["bool"] = "bool";
|
|
361
|
-
SGFieldType["vector2d"] = "vector2d";
|
|
362
|
-
SGFieldType["color"] = "color";
|
|
363
|
-
SGFieldType["time"] = "time";
|
|
364
|
-
SGFieldType["uri"] = "uri";
|
|
365
|
-
SGFieldType["node"] = "node";
|
|
366
|
-
SGFieldType["floatarray"] = "floatarray";
|
|
367
|
-
SGFieldType["intarray"] = "intarray";
|
|
368
|
-
SGFieldType["boolarray"] = "boolarray";
|
|
369
|
-
SGFieldType["stringarray"] = "stringarray";
|
|
370
|
-
SGFieldType["vector2darray"] = "vector2darray";
|
|
371
|
-
SGFieldType["colorarray"] = "colorarray";
|
|
372
|
-
SGFieldType["timearray"] = "timearray";
|
|
373
|
-
SGFieldType["nodearray"] = "nodearray";
|
|
374
|
-
SGFieldType["assocarray"] = "assocarray";
|
|
375
|
-
SGFieldType["array"] = "array";
|
|
376
|
-
SGFieldType["roarray"] = "roarray";
|
|
377
|
-
SGFieldType["rect2d"] = "rect2d";
|
|
378
|
-
SGFieldType["rect2darray"] = "rect2darray";
|
|
379
|
-
})(SGFieldType = exports.SGFieldType || (exports.SGFieldType = {}));
|
|
380
|
-
exports.SGFieldTypes = Object.keys(SGFieldType);
|
|
381
|
-
function getBscTypeFromSGFieldType(sgFieldType) {
|
|
382
|
-
switch (sgFieldType) {
|
|
383
|
-
case SGFieldType.integer:
|
|
384
|
-
case SGFieldType.int: {
|
|
385
|
-
return new IntegerType_1.IntegerType();
|
|
386
|
-
}
|
|
387
|
-
case SGFieldType.longinteger: {
|
|
388
|
-
return new LongIntegerType_1.LongIntegerType();
|
|
389
|
-
}
|
|
390
|
-
case SGFieldType.float: {
|
|
391
|
-
return new FloatType_1.FloatType();
|
|
392
|
-
}
|
|
393
|
-
case SGFieldType.string:
|
|
394
|
-
case SGFieldType.str: {
|
|
395
|
-
return new StringType_1.StringType();
|
|
396
|
-
}
|
|
397
|
-
case SGFieldType.boolean:
|
|
398
|
-
case SGFieldType.bool: {
|
|
399
|
-
return new BooleanType_1.BooleanType();
|
|
400
|
-
}
|
|
401
|
-
default: {
|
|
402
|
-
return new DynamicType_1.DynamicType();
|
|
403
|
-
}
|
|
201
|
+
exports.SGField = SGField;
|
|
202
|
+
exports.SGFieldTypes = [
|
|
203
|
+
'integer', 'int', 'longinteger', 'float', 'string', 'str', 'boolean', 'bool',
|
|
204
|
+
'vector2d', 'color', 'time', 'uri', 'node', 'floatarray', 'intarray', 'boolarray',
|
|
205
|
+
'stringarray', 'vector2darray', 'colorarray', 'timearray', 'nodearray', 'assocarray',
|
|
206
|
+
'array', 'roarray', 'rect2d', 'rect2darray'
|
|
207
|
+
];
|
|
208
|
+
class SGFunction extends SGTag {
|
|
209
|
+
constructor(tag = { text: 'function' }, attributes = [], range) {
|
|
210
|
+
super(tag, attributes, range);
|
|
404
211
|
}
|
|
405
|
-
}
|
|
406
|
-
exports.getBscTypeFromSGFieldType = getBscTypeFromSGFieldType;
|
|
407
|
-
class SGInterfaceFunction extends SGElement {
|
|
408
212
|
get name() {
|
|
409
213
|
return this.getAttributeValue('name');
|
|
410
214
|
}
|
|
411
215
|
set name(value) {
|
|
412
|
-
this.
|
|
216
|
+
this.setAttribute('name', value);
|
|
413
217
|
}
|
|
414
218
|
}
|
|
415
|
-
exports.
|
|
416
|
-
class SGInterface extends
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
result.push(node);
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
return result;
|
|
433
|
-
}
|
|
434
|
-
/**
|
|
435
|
-
* Check if there's an SGField with the specified name
|
|
436
|
-
*/
|
|
437
|
-
hasField(id) {
|
|
438
|
-
var _a;
|
|
439
|
-
for (const node of this.elements) {
|
|
440
|
-
const tagName = (_a = node.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
441
|
-
if (tagName === 'field' && node.id === id) {
|
|
442
|
-
return true;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
return false;
|
|
446
|
-
}
|
|
447
|
-
/**
|
|
448
|
-
* Check if there's an SGFunction with the specified name
|
|
449
|
-
*/
|
|
450
|
-
hasFunction(name) {
|
|
451
|
-
var _a;
|
|
452
|
-
for (const node of this.elements) {
|
|
453
|
-
const tagName = (_a = node.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
454
|
-
if (tagName === 'function' && node.name === name) {
|
|
455
|
-
return true;
|
|
219
|
+
exports.SGFunction = SGFunction;
|
|
220
|
+
class SGInterface extends SGTag {
|
|
221
|
+
constructor(tag = { text: 'interface' }, content, range) {
|
|
222
|
+
super(tag, [], range);
|
|
223
|
+
this.fields = [];
|
|
224
|
+
this.functions = [];
|
|
225
|
+
if (content) {
|
|
226
|
+
for (const tag of content) {
|
|
227
|
+
if ((0, xml_1.isSGField)(tag)) {
|
|
228
|
+
this.fields.push(tag);
|
|
229
|
+
}
|
|
230
|
+
else if ((0, xml_1.isSGFunction)(tag)) {
|
|
231
|
+
this.functions.push(tag);
|
|
232
|
+
}
|
|
456
233
|
}
|
|
457
234
|
}
|
|
458
|
-
return false;
|
|
459
235
|
}
|
|
460
|
-
/**
|
|
461
|
-
* Find a field by its ID
|
|
462
|
-
*/
|
|
463
236
|
getField(id) {
|
|
464
237
|
return this.fields.find(field => field.id === id);
|
|
465
238
|
}
|
|
466
|
-
/**
|
|
467
|
-
* Set the value of a field. Creates a new field if one does not already exist with this ID
|
|
468
|
-
*/
|
|
469
239
|
setField(id, type, onChange, alwaysNotify, alias) {
|
|
470
240
|
let field = this.getField(id);
|
|
471
241
|
if (!field) {
|
|
472
|
-
field =
|
|
242
|
+
field = new SGField();
|
|
243
|
+
field.id = id;
|
|
244
|
+
this.fields.push(field);
|
|
473
245
|
}
|
|
474
246
|
field.type = type;
|
|
475
247
|
field.onChange = onChange;
|
|
@@ -480,254 +252,105 @@ class SGInterface extends SGElement {
|
|
|
480
252
|
field.alwaysNotify = alwaysNotify ? 'true' : 'false';
|
|
481
253
|
}
|
|
482
254
|
field.alias = alias;
|
|
483
|
-
return field;
|
|
484
|
-
}
|
|
485
|
-
/**
|
|
486
|
-
* Remove a field from the interface
|
|
487
|
-
* @returns true if a field was found and removed. Returns false if no field was found with that name
|
|
488
|
-
*/
|
|
489
|
-
removeField(id) {
|
|
490
|
-
var _a;
|
|
491
|
-
for (let i = 0; i < this.elements.length; i++) {
|
|
492
|
-
const node = this.elements[i];
|
|
493
|
-
if (((_a = node.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'field' && node.id === id) {
|
|
494
|
-
this.elements.splice(i, 1);
|
|
495
|
-
return true;
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
return false;
|
|
499
255
|
}
|
|
500
|
-
/**
|
|
501
|
-
* Get the interface function with the specified name
|
|
502
|
-
*/
|
|
503
256
|
getFunction(name) {
|
|
504
|
-
return this.functions.find(
|
|
257
|
+
return this.functions.find(field => field.name === name);
|
|
505
258
|
}
|
|
506
|
-
/**
|
|
507
|
-
* Add or replace a function on the interface
|
|
508
|
-
*/
|
|
509
259
|
setFunction(name) {
|
|
510
260
|
let func = this.getFunction(name);
|
|
511
261
|
if (!func) {
|
|
512
|
-
func =
|
|
262
|
+
func = new SGFunction();
|
|
263
|
+
func.name = name;
|
|
264
|
+
this.functions.push(func);
|
|
513
265
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
const node = this.elements[i];
|
|
524
|
-
if (((_a = node.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'function' && node.getAttributeValue('name') === name) {
|
|
525
|
-
this.elements.splice(i, 1);
|
|
526
|
-
return true;
|
|
527
|
-
}
|
|
266
|
+
}
|
|
267
|
+
transpileBody(state) {
|
|
268
|
+
const body = ['>\n'];
|
|
269
|
+
state.blockDepth++;
|
|
270
|
+
if (this.fields.length > 0) {
|
|
271
|
+
body.push(...this.fields.map(node => node.transpile(state)));
|
|
272
|
+
}
|
|
273
|
+
if (this.functions.length > 0) {
|
|
274
|
+
body.push(...this.functions.map(node => node.transpile(state)));
|
|
528
275
|
}
|
|
529
|
-
|
|
276
|
+
state.blockDepth--;
|
|
277
|
+
body.push(state.indentText, '</', this.tag.text, '>\n');
|
|
278
|
+
return body;
|
|
530
279
|
}
|
|
531
280
|
}
|
|
532
281
|
exports.SGInterface = SGInterface;
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
282
|
+
class SGComponent extends SGTag {
|
|
283
|
+
constructor(tag = { text: 'component' }, attributes, content, range) {
|
|
284
|
+
super(tag, attributes, range);
|
|
285
|
+
this.scripts = [];
|
|
286
|
+
this.customizations = [];
|
|
287
|
+
if (content) {
|
|
288
|
+
for (const tag of content) {
|
|
289
|
+
if ((0, xml_1.isSGInterface)(tag)) {
|
|
290
|
+
this.api = tag;
|
|
291
|
+
}
|
|
292
|
+
else if ((0, xml_1.isSGScript)(tag)) {
|
|
293
|
+
this.scripts.push(tag);
|
|
294
|
+
}
|
|
295
|
+
else if ((0, xml_1.isSGChildren)(tag)) {
|
|
296
|
+
this.children = tag;
|
|
297
|
+
}
|
|
298
|
+
else if ((0, xml_1.isSGCustomization)(tag)) {
|
|
299
|
+
this.customizations.push(tag);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
544
302
|
}
|
|
545
|
-
|
|
546
|
-
}
|
|
547
|
-
get scriptElements() {
|
|
548
|
-
return this.getElementsByTagName('script');
|
|
549
|
-
}
|
|
550
|
-
/**
|
|
551
|
-
* Get the <interface> element from this component (if present), or undefined if not.
|
|
552
|
-
* NOTE: Roku supports and merges multiple <interface> elements in a component, but this
|
|
553
|
-
* property points to the FIRST one. If you need to check whether a member exists,
|
|
554
|
-
* look through `this.interfaceMemebers` instead.
|
|
555
|
-
*/
|
|
556
|
-
get interfaceElement() {
|
|
557
|
-
return this.getElementsByTagName('interface')[0];
|
|
558
|
-
}
|
|
559
|
-
/**
|
|
560
|
-
* Get the `<children>` element of this component. (not to be confused with the AST `childTags` property).
|
|
561
|
-
* If there are multiope `<children>` elements, this function will return the last `<children>` tag because that's what Roku devices do.
|
|
562
|
-
*/
|
|
563
|
-
get childrenElement() {
|
|
564
|
-
const children = this.getElementsByTagName('children');
|
|
565
|
-
return children[children.length - 1];
|
|
566
|
-
}
|
|
567
|
-
get customizationElements() {
|
|
568
|
-
return this.getElementsByTagName('customization');
|
|
569
|
-
}
|
|
570
|
-
/**
|
|
571
|
-
* Specifies the name of the component, that allows you to create the component in your application.
|
|
572
|
-
* For example, if the name of the component is `CastMemberInfo`, you could create instances of the component declaratively
|
|
573
|
-
* in a child node element of a component `<children>` element (`<CastMemberInfo/>`), or using BrightScript in a `<script>`
|
|
574
|
-
* element (`createObject("roSGNode","CastMemberInfo")`).
|
|
575
|
-
*
|
|
576
|
-
* The name attribute is case-sensitive. You cannot successfully create or declare a component unless the component name exactly
|
|
577
|
-
* matches the name attribute, including case. Also be aware that two components with the exact same name in the same application
|
|
578
|
-
* components directory will have undefined and generally undesirable results if you attempt to create a component object with that name in the application.
|
|
579
|
-
*/
|
|
303
|
+
}
|
|
580
304
|
get name() {
|
|
581
305
|
return this.getAttributeValue('name');
|
|
582
306
|
}
|
|
583
307
|
set name(value) {
|
|
584
|
-
this.
|
|
585
|
-
}
|
|
586
|
-
/**
|
|
587
|
-
* Specifies the name of the built-in or extended SceneGraph scene or node class whose functionality is extended by this component.
|
|
588
|
-
*
|
|
589
|
-
* For example, `extends="Group"` specifies that the component has all of the functionality of the Group node class (it can have child nodes, has translation/scale/rotation fields, and so forth).
|
|
590
|
-
*
|
|
591
|
-
* By default, a component extends the Group node class.
|
|
592
|
-
*/
|
|
308
|
+
this.setAttribute('name', value);
|
|
309
|
+
}
|
|
593
310
|
get extends() {
|
|
594
311
|
return this.getAttributeValue('extends');
|
|
595
312
|
}
|
|
596
313
|
set extends(value) {
|
|
597
|
-
this.
|
|
598
|
-
}
|
|
599
|
-
/**
|
|
600
|
-
* Specifies the ID of a node declared in the XML file to have the initial remote control focus when the component is instantiated.
|
|
601
|
-
*/
|
|
602
|
-
get initialFocus() {
|
|
603
|
-
return this.getAttributeValue('initialFocus');
|
|
604
|
-
}
|
|
605
|
-
set initialFocus(value) {
|
|
606
|
-
this.setAttributeValue('initialFocus', value);
|
|
607
|
-
}
|
|
608
|
-
/**
|
|
609
|
-
* Specifies the version of the SceneGraph API. The default is 1.0 if not specified.
|
|
610
|
-
*/
|
|
611
|
-
get version() {
|
|
612
|
-
return this.getAttributeValue('version');
|
|
613
|
-
}
|
|
614
|
-
set version(value) {
|
|
615
|
-
this.setAttributeValue('version', value);
|
|
616
|
-
}
|
|
617
|
-
/**
|
|
618
|
-
* Does the specified field exist in the component interface?
|
|
619
|
-
*/
|
|
620
|
-
hasInterfaceField(id) {
|
|
621
|
-
for (const ifaceNode of this.getElementsByTagName('interface')) {
|
|
622
|
-
if (ifaceNode.hasField(id)) {
|
|
623
|
-
return true;
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
return false;
|
|
627
|
-
}
|
|
628
|
-
/**
|
|
629
|
-
* Does the specified function exist in the component interface?
|
|
630
|
-
*/
|
|
631
|
-
hasInterfaceFunction(name) {
|
|
632
|
-
for (const ifaceNode of this.getElementsByTagName('interface')) {
|
|
633
|
-
if (ifaceNode.hasFunction(name)) {
|
|
634
|
-
return true;
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
return false;
|
|
638
|
-
}
|
|
639
|
-
/**
|
|
640
|
-
* Get an interface field with the specified name
|
|
641
|
-
*/
|
|
642
|
-
getInterfaceField(name) {
|
|
643
|
-
for (const ifaceNode of this.getElementsByTagName('interface')) {
|
|
644
|
-
const field = ifaceNode.getField(name);
|
|
645
|
-
if (field) {
|
|
646
|
-
return field;
|
|
647
|
-
}
|
|
648
|
-
}
|
|
314
|
+
this.setAttribute('extends', value);
|
|
649
315
|
}
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
if (el.tokens.startTagName.text.toLowerCase() === 'interface') {
|
|
656
|
-
return el;
|
|
657
|
-
}
|
|
316
|
+
transpileBody(state) {
|
|
317
|
+
const body = ['>\n'];
|
|
318
|
+
state.blockDepth++;
|
|
319
|
+
if (this.api) {
|
|
320
|
+
body.push(this.api.transpile(state));
|
|
658
321
|
}
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
/**
|
|
662
|
-
* Create or update a <field> interface element.
|
|
663
|
-
* This will create a new `<interface>` element if there are none on the component already
|
|
664
|
-
*/
|
|
665
|
-
setInterfaceField(id, type, onChange, alwaysNotify, alias) {
|
|
666
|
-
let ifaceNode = this.ensureInterfaceNode();
|
|
667
|
-
return ifaceNode.setField(id, type, onChange, alwaysNotify, alias);
|
|
668
|
-
}
|
|
669
|
-
/**
|
|
670
|
-
* Create or update a <function> interface element.
|
|
671
|
-
* This will create a new `<interface>` element if there are none on the component already
|
|
672
|
-
*/
|
|
673
|
-
setInterfaceFunction(name) {
|
|
674
|
-
let ifaceNode = this.ensureInterfaceNode();
|
|
675
|
-
return ifaceNode.setFunction(name);
|
|
676
|
-
}
|
|
677
|
-
/**
|
|
678
|
-
* Remove an interface field.
|
|
679
|
-
* @returns true if a field was found and removed. Returns false if no field was found with that name
|
|
680
|
-
*/
|
|
681
|
-
removeInterfaceField(id) {
|
|
682
|
-
for (const ifaceNode of this.getElementsByTagName('interface')) {
|
|
683
|
-
if (ifaceNode.removeField(id)) {
|
|
684
|
-
return true;
|
|
685
|
-
}
|
|
322
|
+
if (this.scripts.length > 0) {
|
|
323
|
+
body.push(...this.scripts.map(node => node.transpile(state)));
|
|
686
324
|
}
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
/**
|
|
690
|
-
* Get an interface field with the specified name
|
|
691
|
-
*/
|
|
692
|
-
getInterfaceFunction(name) {
|
|
693
|
-
for (const ifaceNode of this.getElementsByTagName('interface')) {
|
|
694
|
-
const func = ifaceNode.getFunction(name);
|
|
695
|
-
if (func) {
|
|
696
|
-
return func;
|
|
697
|
-
}
|
|
325
|
+
if (this.children) {
|
|
326
|
+
body.push(this.children.transpile(state));
|
|
698
327
|
}
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
* Remove an interface function.
|
|
702
|
-
* @returns true if a function was found and removed. Returns false if no function was found with that name
|
|
703
|
-
*/
|
|
704
|
-
removeInterfaceFunction(name) {
|
|
705
|
-
for (const ifaceNode of this.getElementsByTagName('interface')) {
|
|
706
|
-
if (ifaceNode.removeFunction(name)) {
|
|
707
|
-
return true;
|
|
708
|
-
}
|
|
328
|
+
if (this.customizations.length > 0) {
|
|
329
|
+
body.push(...this.customizations.map(node => node.transpile(state)));
|
|
709
330
|
}
|
|
710
|
-
|
|
331
|
+
state.blockDepth--;
|
|
332
|
+
body.push(state.indentText, '</', this.tag.text, '>\n');
|
|
333
|
+
return body;
|
|
711
334
|
}
|
|
712
335
|
}
|
|
713
336
|
exports.SGComponent = SGComponent;
|
|
714
337
|
class SGAst {
|
|
715
|
-
constructor(
|
|
716
|
-
this.
|
|
717
|
-
this.
|
|
718
|
-
this.
|
|
338
|
+
constructor(prolog, root, component) {
|
|
339
|
+
this.prolog = prolog;
|
|
340
|
+
this.root = root;
|
|
341
|
+
this.component = component;
|
|
719
342
|
}
|
|
720
343
|
transpile(state) {
|
|
721
344
|
const chunks = [];
|
|
722
345
|
//write XML prolog
|
|
723
|
-
if (this.
|
|
724
|
-
chunks.push(this.
|
|
346
|
+
if (this.prolog) {
|
|
347
|
+
chunks.push(this.prolog.transpile(state));
|
|
725
348
|
}
|
|
726
|
-
if (this.
|
|
349
|
+
if (this.component) {
|
|
727
350
|
//write content
|
|
728
|
-
chunks.push(this.
|
|
351
|
+
chunks.push(this.component.transpile(state));
|
|
729
352
|
}
|
|
730
|
-
return
|
|
353
|
+
return chunks;
|
|
731
354
|
}
|
|
732
355
|
}
|
|
733
356
|
exports.SGAst = SGAst;
|