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/Parser.js
CHANGED
|
@@ -8,7 +8,7 @@ const Statement_1 = require("./Statement");
|
|
|
8
8
|
const DiagnosticMessages_1 = require("../DiagnosticMessages");
|
|
9
9
|
const util_1 = require("../util");
|
|
10
10
|
const Expression_1 = require("./Expression");
|
|
11
|
-
const
|
|
11
|
+
const logging_1 = require("../logging");
|
|
12
12
|
const reflection_1 = require("../astUtils/reflection");
|
|
13
13
|
const visitors_1 = require("../astUtils/visitors");
|
|
14
14
|
const creators_1 = require("../astUtils/creators");
|
|
@@ -95,16 +95,17 @@ class Parser {
|
|
|
95
95
|
*/
|
|
96
96
|
parse(toParse, options) {
|
|
97
97
|
var _a;
|
|
98
|
+
this.logger = (_a = options === null || options === void 0 ? void 0 : options.logger) !== null && _a !== void 0 ? _a : (0, logging_1.createLogger)();
|
|
99
|
+
options = this.sanitizeParseOptions(options);
|
|
100
|
+
this.options = options;
|
|
98
101
|
let tokens;
|
|
99
102
|
if (typeof toParse === 'string') {
|
|
100
|
-
tokens = Lexer_1.Lexer.scan(toParse).tokens;
|
|
103
|
+
tokens = Lexer_1.Lexer.scan(toParse, { trackLocations: options.trackLocations }).tokens;
|
|
101
104
|
}
|
|
102
105
|
else {
|
|
103
106
|
tokens = toParse;
|
|
104
107
|
}
|
|
105
|
-
this.logger = (_a = options === null || options === void 0 ? void 0 : options.logger) !== null && _a !== void 0 ? _a : new Logger_1.Logger();
|
|
106
108
|
this.tokens = tokens;
|
|
107
|
-
this.options = this.sanitizeParseOptions(options);
|
|
108
109
|
this.allowedLocalIdentifiers = [
|
|
109
110
|
...TokenKind_1.AllowedLocalIdentifiers,
|
|
110
111
|
//when in plain brightscript mode, the BrighterScript source literals can be used as regular variables
|
|
@@ -153,7 +154,11 @@ class Parser {
|
|
|
153
154
|
return body;
|
|
154
155
|
}
|
|
155
156
|
sanitizeParseOptions(options) {
|
|
156
|
-
|
|
157
|
+
var _a, _b;
|
|
158
|
+
options !== null && options !== void 0 ? options : (options = {});
|
|
159
|
+
(_a = options.mode) !== null && _a !== void 0 ? _a : (options.mode = ParseMode.BrightScript);
|
|
160
|
+
(_b = options.trackLocations) !== null && _b !== void 0 ? _b : (options.trackLocations = true);
|
|
161
|
+
return options;
|
|
157
162
|
}
|
|
158
163
|
/**
|
|
159
164
|
* Determine if the parser is currently parsing tokens at the root level.
|
|
@@ -243,30 +248,18 @@ class Parser {
|
|
|
243
248
|
interfaceFieldStatement(optionalKeyword) {
|
|
244
249
|
const name = this.identifier(...TokenKind_1.AllowedProperties);
|
|
245
250
|
let asToken;
|
|
246
|
-
let
|
|
251
|
+
let typeToken;
|
|
252
|
+
let type;
|
|
247
253
|
if (this.check(TokenKind_1.TokenKind.As)) {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
if (asToken) {
|
|
256
|
-
//if there's nothing after the `as`, add a diagnostic and continue
|
|
257
|
-
if (this.checkEndOfStatement()) {
|
|
258
|
-
this.diagnostics.push(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.expectedIdentifierAfterKeyword(asToken.text)), { range: asToken.range }));
|
|
259
|
-
//consume the statement separator
|
|
260
|
-
this.consumeStatementSeparators();
|
|
261
|
-
}
|
|
262
|
-
else if (this.peek().kind !== TokenKind_1.TokenKind.Identifier && !this.checkAny(...TokenKind_1.DeclarableTypes, ...TokenKind_1.AllowedTypeIdentifiers)) {
|
|
263
|
-
this.diagnostics.push(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.expectedIdentifierAfterKeyword(asToken.text)), { range: asToken.range }));
|
|
264
|
-
}
|
|
265
|
-
else {
|
|
266
|
-
typeExpression = this.typeExpression();
|
|
267
|
-
}
|
|
254
|
+
asToken = this.consumeToken(TokenKind_1.TokenKind.As);
|
|
255
|
+
typeToken = this.typeToken();
|
|
256
|
+
type = util_1.util.tokenToBscType(typeToken);
|
|
257
|
+
}
|
|
258
|
+
if (!type) {
|
|
259
|
+
this.diagnostics.push(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.functionParameterTypeIsInvalid(name.text, typeToken.text)), { range: typeToken.range }));
|
|
260
|
+
throw this.lastDiagnosticAsError();
|
|
268
261
|
}
|
|
269
|
-
return
|
|
262
|
+
return new Statement_1.InterfaceFieldStatement(name, asToken, typeToken, type, optionalKeyword);
|
|
270
263
|
}
|
|
271
264
|
/**
|
|
272
265
|
* Create a new InterfaceMethodStatement. This should only be called from within `interfaceDeclaration()`
|
|
@@ -285,36 +278,39 @@ class Parser {
|
|
|
285
278
|
} while (this.match(TokenKind_1.TokenKind.Comma));
|
|
286
279
|
}
|
|
287
280
|
const rightParen = this.consumeToken(TokenKind_1.TokenKind.RightParen);
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
let asToken;
|
|
291
|
-
let returnTypeExpression;
|
|
281
|
+
let asToken = null;
|
|
282
|
+
let returnTypeToken = null;
|
|
292
283
|
if (this.check(TokenKind_1.TokenKind.As)) {
|
|
293
|
-
|
|
284
|
+
asToken = this.advance();
|
|
285
|
+
returnTypeToken = this.typeToken();
|
|
286
|
+
const returnType = util_1.util.tokenToBscType(returnTypeToken);
|
|
287
|
+
if (!returnType) {
|
|
288
|
+
this.diagnostics.push(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.functionParameterTypeIsInvalid(name.text, returnTypeToken.text)), { range: returnTypeToken.range }));
|
|
289
|
+
throw this.lastDiagnosticAsError();
|
|
290
|
+
}
|
|
294
291
|
}
|
|
295
|
-
return new Statement_1.InterfaceMethodStatement(functionType, name, leftParen, params, rightParen, asToken,
|
|
292
|
+
return new Statement_1.InterfaceMethodStatement(functionType, name, leftParen, params, rightParen, asToken, returnTypeToken, util_1.util.tokenToBscType(returnTypeToken), optionalKeyword);
|
|
296
293
|
}
|
|
297
294
|
interfaceDeclaration() {
|
|
298
295
|
this.warnIfNotBrighterScriptMode('interface declarations');
|
|
299
296
|
const parentAnnotations = this.enterAnnotationBlock();
|
|
300
297
|
const interfaceToken = this.consume(DiagnosticMessages_1.DiagnosticMessages.expectedKeyword(TokenKind_1.TokenKind.Interface), TokenKind_1.TokenKind.Interface);
|
|
301
|
-
const nameToken = this.identifier();
|
|
298
|
+
const nameToken = this.identifier(...this.allowedLocalIdentifiers);
|
|
302
299
|
let extendsToken;
|
|
303
300
|
let parentInterfaceName;
|
|
304
301
|
if (this.peek().text.toLowerCase() === 'extends') {
|
|
305
302
|
extendsToken = this.advance();
|
|
306
|
-
|
|
307
|
-
this.diagnostics.push(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.expectedIdentifierAfterKeyword(extendsToken.text)), { range: extendsToken.range }));
|
|
308
|
-
}
|
|
309
|
-
else {
|
|
310
|
-
parentInterfaceName = this.typeExpression();
|
|
311
|
-
}
|
|
303
|
+
parentInterfaceName = this.getNamespacedVariableNameExpression();
|
|
312
304
|
}
|
|
313
305
|
this.consumeStatementSeparators();
|
|
314
306
|
//gather up all interface members (Fields, Methods)
|
|
315
307
|
let body = [];
|
|
316
308
|
while (this.checkAny(TokenKind_1.TokenKind.Comment, TokenKind_1.TokenKind.Identifier, TokenKind_1.TokenKind.At, ...TokenKind_1.AllowedProperties)) {
|
|
317
309
|
try {
|
|
310
|
+
//break out of this loop if we encountered the `EndInterface` token not followed by `as`
|
|
311
|
+
if (this.check(TokenKind_1.TokenKind.EndInterface) && !this.checkNext(TokenKind_1.TokenKind.As)) {
|
|
312
|
+
break;
|
|
313
|
+
}
|
|
318
314
|
let decl;
|
|
319
315
|
//collect leading annotations
|
|
320
316
|
if (this.check(TokenKind_1.TokenKind.At)) {
|
|
@@ -354,10 +350,6 @@ class Parser {
|
|
|
354
350
|
}
|
|
355
351
|
//ensure statement separator
|
|
356
352
|
this.consumeStatementSeparators();
|
|
357
|
-
//break out of this loop if we encountered the `EndInterface` token not followed by `as`
|
|
358
|
-
if (this.check(TokenKind_1.TokenKind.EndInterface) && !this.checkNext(TokenKind_1.TokenKind.As)) {
|
|
359
|
-
break;
|
|
360
|
-
}
|
|
361
353
|
}
|
|
362
354
|
//consume the final `end interface` token
|
|
363
355
|
const endInterfaceToken = this.consumeToken(TokenKind_1.TokenKind.EndInterface);
|
|
@@ -429,12 +421,7 @@ class Parser {
|
|
|
429
421
|
//see if the class inherits from parent
|
|
430
422
|
if (this.peek().text.toLowerCase() === 'extends') {
|
|
431
423
|
extendsKeyword = this.advance();
|
|
432
|
-
|
|
433
|
-
this.diagnostics.push(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.expectedIdentifierAfterKeyword(extendsKeyword.text)), { range: extendsKeyword.range }));
|
|
434
|
-
}
|
|
435
|
-
else {
|
|
436
|
-
parentClassName = this.typeExpression();
|
|
437
|
-
}
|
|
424
|
+
parentClassName = this.getNamespacedVariableNameExpression();
|
|
438
425
|
}
|
|
439
426
|
//ensure statement separator
|
|
440
427
|
this.consumeStatementSeparators();
|
|
@@ -530,10 +517,15 @@ class Parser {
|
|
|
530
517
|
}
|
|
531
518
|
let name = this.consume(DiagnosticMessages_1.DiagnosticMessages.expectedClassFieldIdentifier(), TokenKind_1.TokenKind.Identifier, ...TokenKind_1.AllowedProperties);
|
|
532
519
|
let asToken;
|
|
533
|
-
let
|
|
520
|
+
let fieldType;
|
|
534
521
|
//look for `as SOME_TYPE`
|
|
535
522
|
if (this.check(TokenKind_1.TokenKind.As)) {
|
|
536
|
-
|
|
523
|
+
asToken = this.advance();
|
|
524
|
+
fieldType = this.typeToken();
|
|
525
|
+
//no field type specified
|
|
526
|
+
if (!util_1.util.tokenToBscType(fieldType)) {
|
|
527
|
+
this.diagnostics.push(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.expectedValidTypeToFollowAsKeyword()), { range: this.peek().range }));
|
|
528
|
+
}
|
|
537
529
|
}
|
|
538
530
|
let initialValue;
|
|
539
531
|
let equal;
|
|
@@ -542,10 +534,10 @@ class Parser {
|
|
|
542
534
|
equal = this.advance();
|
|
543
535
|
initialValue = this.expression();
|
|
544
536
|
}
|
|
545
|
-
return new Statement_1.FieldStatement(accessModifier, name, asToken,
|
|
537
|
+
return new Statement_1.FieldStatement(accessModifier, name, asToken, fieldType, equal, initialValue, optionalKeyword);
|
|
546
538
|
}
|
|
547
539
|
functionDeclaration(isAnonymous, checkIdentifier = true, onlyCallableAsMember = false) {
|
|
548
|
-
var _a;
|
|
540
|
+
var _a, _b;
|
|
549
541
|
let previousCallExpressions = this.callExpressions;
|
|
550
542
|
this.callExpressions = [];
|
|
551
543
|
try {
|
|
@@ -566,8 +558,7 @@ class Parser {
|
|
|
566
558
|
start: this.peek().range.start,
|
|
567
559
|
end: this.peek().range.start
|
|
568
560
|
},
|
|
569
|
-
leadingWhitespace: ''
|
|
570
|
-
leadingTrivia: []
|
|
561
|
+
leadingWhitespace: ''
|
|
571
562
|
};
|
|
572
563
|
}
|
|
573
564
|
let isSub = (functionType === null || functionType === void 0 ? void 0 : functionType.kind) === TokenKind_1.TokenKind.Sub;
|
|
@@ -593,18 +584,19 @@ class Parser {
|
|
|
593
584
|
}
|
|
594
585
|
let params = [];
|
|
595
586
|
let asToken;
|
|
596
|
-
let
|
|
587
|
+
let typeToken;
|
|
597
588
|
if (!this.check(TokenKind_1.TokenKind.RightParen)) {
|
|
598
589
|
do {
|
|
599
|
-
if (params.length >= Expression_1.CallExpression.MaximumArguments) {
|
|
600
|
-
this.diagnostics.push(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.tooManyCallableParameters(params.length, Expression_1.CallExpression.MaximumArguments)), { range: this.peek().range }));
|
|
601
|
-
}
|
|
602
590
|
params.push(this.functionParameter());
|
|
603
591
|
} while (this.match(TokenKind_1.TokenKind.Comma));
|
|
604
592
|
}
|
|
605
593
|
let rightParen = this.advance();
|
|
606
594
|
if (this.check(TokenKind_1.TokenKind.As)) {
|
|
607
|
-
|
|
595
|
+
asToken = this.advance();
|
|
596
|
+
typeToken = this.typeToken();
|
|
597
|
+
if (!util_1.util.tokenToBscType(typeToken, this.options.mode === ParseMode.BrighterScript)) {
|
|
598
|
+
this.diagnostics.push(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.invalidFunctionReturnType((_a = typeToken.text) !== null && _a !== void 0 ? _a : '')), { range: typeToken.range }));
|
|
599
|
+
}
|
|
608
600
|
}
|
|
609
601
|
params.reduce((haveFoundOptional, param) => {
|
|
610
602
|
if (haveFoundOptional && !param.defaultValue) {
|
|
@@ -615,7 +607,12 @@ class Parser {
|
|
|
615
607
|
this.consumeStatementSeparators(true);
|
|
616
608
|
let func = new Expression_1.FunctionExpression(params, undefined, //body
|
|
617
609
|
functionType, undefined, //ending keyword
|
|
618
|
-
leftParen, rightParen, asToken,
|
|
610
|
+
leftParen, rightParen, asToken, typeToken);
|
|
611
|
+
// add the function to the relevant symbol tables
|
|
612
|
+
if (!onlyCallableAsMember && name) {
|
|
613
|
+
const funcType = func.getFunctionType();
|
|
614
|
+
funcType.setName(name.text);
|
|
615
|
+
}
|
|
619
616
|
this._references.functionExpressions.push(func);
|
|
620
617
|
//support ending the function with `end sub` OR `end function`
|
|
621
618
|
func.body = this.block();
|
|
@@ -623,7 +620,7 @@ class Parser {
|
|
|
623
620
|
if (!func.body) {
|
|
624
621
|
func.body = new Statement_1.Block([], util_1.util.createRangeFromPositions(func.range.start, func.range.start));
|
|
625
622
|
}
|
|
626
|
-
func.body.symbolTable = new SymbolTable_1.SymbolTable(`Block: Function '${(
|
|
623
|
+
func.body.symbolTable = new SymbolTable_1.SymbolTable(`Block: Function '${(_b = name === null || name === void 0 ? void 0 : name.text) !== null && _b !== void 0 ? _b : ''}'`, () => func.getSymbolTable());
|
|
627
624
|
if (!func.body) {
|
|
628
625
|
this.diagnostics.push(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.callableBlockMissingEndKeyword(functionTypeText)), { range: this.peek().range }));
|
|
629
626
|
throw this.lastDiagnosticAsError();
|
|
@@ -662,19 +659,22 @@ class Parser {
|
|
|
662
659
|
let name = this.advance();
|
|
663
660
|
// force the name into an identifier so the AST makes some sense
|
|
664
661
|
name.kind = TokenKind_1.TokenKind.Identifier;
|
|
665
|
-
let
|
|
662
|
+
let typeToken;
|
|
666
663
|
let defaultValue;
|
|
667
|
-
let equalToken;
|
|
668
664
|
// parse argument default value
|
|
669
|
-
if (
|
|
665
|
+
if (this.match(TokenKind_1.TokenKind.Equal)) {
|
|
670
666
|
// it seems any expression is allowed here -- including ones that operate on other arguments!
|
|
671
667
|
defaultValue = this.expression(false);
|
|
672
668
|
}
|
|
673
669
|
let asToken = null;
|
|
674
670
|
if (this.check(TokenKind_1.TokenKind.As)) {
|
|
675
|
-
|
|
671
|
+
asToken = this.advance();
|
|
672
|
+
typeToken = this.typeToken();
|
|
673
|
+
if (!util_1.util.tokenToBscType(typeToken, this.options.mode === ParseMode.BrighterScript)) {
|
|
674
|
+
this.diagnostics.push(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.functionParameterTypeIsInvalid(name.text, typeToken.text)), { range: typeToken.range }));
|
|
675
|
+
}
|
|
676
676
|
}
|
|
677
|
-
return new Expression_1.FunctionParameterExpression(name,
|
|
677
|
+
return new Expression_1.FunctionParameterExpression(name, typeToken, defaultValue, asToken);
|
|
678
678
|
}
|
|
679
679
|
assignment() {
|
|
680
680
|
let name = this.advance();
|
|
@@ -682,6 +682,12 @@ class Parser {
|
|
|
682
682
|
if (TokenKind_1.DisallowedLocalIdentifiersText.has(name.text.toLowerCase())) {
|
|
683
683
|
this.diagnostics.push(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.cannotUseReservedWordAsIdentifier(name.text)), { range: name.range }));
|
|
684
684
|
}
|
|
685
|
+
if (this.check(TokenKind_1.TokenKind.As)) {
|
|
686
|
+
// v1 syntax allows type declaration on lhs of assignment
|
|
687
|
+
this.warnIfNotBrighterScriptMode('typed assignment');
|
|
688
|
+
this.advance(); // skip 'as'
|
|
689
|
+
this.typeToken(); // skip typeToken;
|
|
690
|
+
}
|
|
685
691
|
let operator = this.consume(DiagnosticMessages_1.DiagnosticMessages.expectedOperatorAfterIdentifier(TokenKind_1.AssignmentOperators, name.text), ...TokenKind_1.AssignmentOperators);
|
|
686
692
|
let value = this.expression();
|
|
687
693
|
let result;
|
|
@@ -786,9 +792,35 @@ class Parser {
|
|
|
786
792
|
// BrightScript is like python, in that variables can be declared without a `var`,
|
|
787
793
|
// `let`, (...) keyword. As such, we must check the token *after* an identifier to figure
|
|
788
794
|
// out what to do with it.
|
|
789
|
-
if (this.checkAny(TokenKind_1.TokenKind.Identifier, ...this.allowedLocalIdentifiers)
|
|
790
|
-
this.checkAnyNext(...TokenKind_1.AssignmentOperators)) {
|
|
791
|
-
|
|
795
|
+
if (this.checkAny(TokenKind_1.TokenKind.Identifier, ...this.allowedLocalIdentifiers)) {
|
|
796
|
+
if (this.checkAnyNext(...TokenKind_1.AssignmentOperators)) {
|
|
797
|
+
return this.assignment();
|
|
798
|
+
}
|
|
799
|
+
else if (this.checkNext(TokenKind_1.TokenKind.As)) {
|
|
800
|
+
// may be a typed assignment - this is v1 syntax
|
|
801
|
+
const backtrack = this.current;
|
|
802
|
+
let validTypeExpression = false;
|
|
803
|
+
try {
|
|
804
|
+
// skip the identifier, and check for valid type expression
|
|
805
|
+
this.advance();
|
|
806
|
+
// skip the 'as'
|
|
807
|
+
this.advance();
|
|
808
|
+
// check if there is a valid type
|
|
809
|
+
const typeToken = this.typeToken(true);
|
|
810
|
+
const allowedNameKinds = [TokenKind_1.TokenKind.Identifier, ...TokenKind_1.DeclarableTypes, ...this.allowedLocalIdentifiers];
|
|
811
|
+
validTypeExpression = allowedNameKinds.includes(typeToken.kind);
|
|
812
|
+
}
|
|
813
|
+
catch (e) {
|
|
814
|
+
// ignore any errors
|
|
815
|
+
}
|
|
816
|
+
finally {
|
|
817
|
+
this.current = backtrack;
|
|
818
|
+
}
|
|
819
|
+
if (validTypeExpression) {
|
|
820
|
+
// there is a valid 'as' and type expression
|
|
821
|
+
return this.assignment();
|
|
822
|
+
}
|
|
823
|
+
}
|
|
792
824
|
}
|
|
793
825
|
//some BrighterScript keywords are allowed as a local identifiers, so we need to check for them AFTER the assignment check
|
|
794
826
|
if (this.check(TokenKind_1.TokenKind.Interface)) {
|
|
@@ -892,10 +924,11 @@ class Parser {
|
|
|
892
924
|
return new Statement_1.ExitForStatement({ exitFor: keyword });
|
|
893
925
|
}
|
|
894
926
|
commentStatement() {
|
|
927
|
+
var _a, _b;
|
|
895
928
|
//if this comment is on the same line as the previous statement,
|
|
896
929
|
//then this comment should be treated as a single-line comment
|
|
897
930
|
let prev = this.previous();
|
|
898
|
-
if ((prev === null || prev === void 0 ? void 0 : prev.range.end.line) === this.peek().range.start.line) {
|
|
931
|
+
if (((_a = prev === null || prev === void 0 ? void 0 : prev.range) === null || _a === void 0 ? void 0 : _a.end.line) === ((_b = this.peek().range) === null || _b === void 0 ? void 0 : _b.start.line)) {
|
|
899
932
|
return new Statement_1.CommentStatement([this.advance()]);
|
|
900
933
|
}
|
|
901
934
|
else {
|
|
@@ -911,7 +944,7 @@ class Parser {
|
|
|
911
944
|
this.warnIfNotBrighterScriptMode('namespace');
|
|
912
945
|
let keyword = this.advance();
|
|
913
946
|
this.namespaceAndFunctionDepth++;
|
|
914
|
-
let name = this.
|
|
947
|
+
let name = this.getNamespacedVariableNameExpression();
|
|
915
948
|
//set the current namespace name
|
|
916
949
|
let result = new Statement_1.NamespaceStatement(keyword, name, null, null);
|
|
917
950
|
this.globalTerminators.push([TokenKind_1.TokenKind.EndNamespace]);
|
|
@@ -937,9 +970,19 @@ class Parser {
|
|
|
937
970
|
/**
|
|
938
971
|
* Get an expression with identifiers separated by periods. Useful for namespaces and class extends
|
|
939
972
|
*/
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
973
|
+
getNamespacedVariableNameExpression(ignoreDiagnostics = false) {
|
|
974
|
+
let firstIdentifier;
|
|
975
|
+
if (ignoreDiagnostics) {
|
|
976
|
+
if (this.checkAny(...this.allowedLocalIdentifiers)) {
|
|
977
|
+
firstIdentifier = this.advance();
|
|
978
|
+
}
|
|
979
|
+
else {
|
|
980
|
+
throw new Error();
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
else {
|
|
984
|
+
firstIdentifier = this.consume(DiagnosticMessages_1.DiagnosticMessages.expectedIdentifierAfterKeyword(this.previous().text), TokenKind_1.TokenKind.Identifier, ...this.allowedLocalIdentifiers);
|
|
985
|
+
}
|
|
943
986
|
let expr;
|
|
944
987
|
if (firstIdentifier) {
|
|
945
988
|
// force it into an identifier so the AST makes some sense
|
|
@@ -952,7 +995,7 @@ class Parser {
|
|
|
952
995
|
if (!dot) {
|
|
953
996
|
break;
|
|
954
997
|
}
|
|
955
|
-
let identifier = this.tryConsume(DiagnosticMessages_1.DiagnosticMessages.expectedIdentifier(), TokenKind_1.TokenKind.Identifier, ...
|
|
998
|
+
let identifier = this.tryConsume(DiagnosticMessages_1.DiagnosticMessages.expectedIdentifier(), TokenKind_1.TokenKind.Identifier, ...this.allowedLocalIdentifiers, ...TokenKind_1.AllowedProperties);
|
|
956
999
|
if (!identifier) {
|
|
957
1000
|
break;
|
|
958
1001
|
}
|
|
@@ -961,7 +1004,7 @@ class Parser {
|
|
|
961
1004
|
expr = new Expression_1.DottedGetExpression(expr, identifier, dot);
|
|
962
1005
|
}
|
|
963
1006
|
}
|
|
964
|
-
return expr;
|
|
1007
|
+
return new Expression_1.NamespacedVariableNameExpression(expr);
|
|
965
1008
|
}
|
|
966
1009
|
/**
|
|
967
1010
|
* Add an 'unexpected token' diagnostic for any token found between current and the first stopToken found.
|
|
@@ -1412,9 +1455,9 @@ class Parser {
|
|
|
1412
1455
|
if ((0, reflection_1.isCallExpression)(expr) || (0, reflection_1.isCallfuncExpression)(expr)) {
|
|
1413
1456
|
return new Statement_1.ExpressionStatement(expr);
|
|
1414
1457
|
}
|
|
1415
|
-
//at this point, it's probably an error. However, we recover a little more gracefully by creating an
|
|
1458
|
+
//at this point, it's probably an error. However, we recover a little more gracefully by creating an assignment
|
|
1416
1459
|
this.diagnostics.push(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.expectedStatementOrFunctionCallButReceivedExpression()), { range: expressionStart.range }));
|
|
1417
|
-
|
|
1460
|
+
throw this.lastDiagnosticAsError();
|
|
1418
1461
|
}
|
|
1419
1462
|
setStatement() {
|
|
1420
1463
|
/**
|
|
@@ -1432,7 +1475,7 @@ class Parser {
|
|
|
1432
1475
|
if ((0, reflection_1.isIndexedGetExpression)(left)) {
|
|
1433
1476
|
return new Statement_1.IndexedSetStatement(left.obj, left.index, operator.kind === TokenKind_1.TokenKind.Equal
|
|
1434
1477
|
? right
|
|
1435
|
-
: new Expression_1.BinaryExpression(left, operator, right), left.openingSquare, left.closingSquare);
|
|
1478
|
+
: new Expression_1.BinaryExpression(left, operator, right), left.openingSquare, left.closingSquare, left.additionalIndexes);
|
|
1436
1479
|
}
|
|
1437
1480
|
else if ((0, reflection_1.isDottedGetExpression)(left)) {
|
|
1438
1481
|
return new Statement_1.DottedSetStatement(left.obj, left.name, operator.kind === TokenKind_1.TokenKind.Equal
|
|
@@ -1443,7 +1486,6 @@ class Parser {
|
|
|
1443
1486
|
return this.expressionStatement(expr);
|
|
1444
1487
|
}
|
|
1445
1488
|
printStatement() {
|
|
1446
|
-
var _a;
|
|
1447
1489
|
let printKeyword = this.advance();
|
|
1448
1490
|
let values = [];
|
|
1449
1491
|
while (!this.checkEndOfStatement()) {
|
|
@@ -1462,8 +1504,7 @@ class Parser {
|
|
|
1462
1504
|
}
|
|
1463
1505
|
//print statements can be empty, so look for empty print conditions
|
|
1464
1506
|
if (!values.length) {
|
|
1465
|
-
|
|
1466
|
-
let emptyStringLiteral = (0, creators_1.createStringLiteral)('', endOfStatementRange);
|
|
1507
|
+
let emptyStringLiteral = (0, creators_1.createStringLiteral)('');
|
|
1467
1508
|
values.push(emptyStringLiteral);
|
|
1468
1509
|
}
|
|
1469
1510
|
let last = values[values.length - 1];
|
|
@@ -1616,7 +1657,7 @@ class Parser {
|
|
|
1616
1657
|
expression(findTypeCast = true) {
|
|
1617
1658
|
let expression = this.anonymousFunction();
|
|
1618
1659
|
let asToken;
|
|
1619
|
-
let
|
|
1660
|
+
let typeToken;
|
|
1620
1661
|
if (findTypeCast) {
|
|
1621
1662
|
do {
|
|
1622
1663
|
if (this.check(TokenKind_1.TokenKind.As)) {
|
|
@@ -1624,15 +1665,16 @@ class Parser {
|
|
|
1624
1665
|
// Check if this expression is wrapped in any type casts
|
|
1625
1666
|
// allows for multiple casts:
|
|
1626
1667
|
// myVal = foo() as dynamic as string
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1668
|
+
asToken = this.advance();
|
|
1669
|
+
typeToken = this.typeToken();
|
|
1670
|
+
if (asToken && typeToken) {
|
|
1671
|
+
expression = new Expression_1.TypeCastExpression(expression, asToken, typeToken);
|
|
1630
1672
|
}
|
|
1631
1673
|
}
|
|
1632
1674
|
else {
|
|
1633
1675
|
break;
|
|
1634
1676
|
}
|
|
1635
|
-
} while (asToken &&
|
|
1677
|
+
} while (asToken && typeToken);
|
|
1636
1678
|
}
|
|
1637
1679
|
this._references.expressions.add(expression);
|
|
1638
1680
|
return expression;
|
|
@@ -1728,9 +1770,7 @@ class Parser {
|
|
|
1728
1770
|
else if (nextKind === TokenKind_1.TokenKind.Minus || nextKind === TokenKind_1.TokenKind.Plus) {
|
|
1729
1771
|
this.current++; //advance
|
|
1730
1772
|
let operator = this.previous();
|
|
1731
|
-
let right =
|
|
1732
|
-
? this.boolean()
|
|
1733
|
-
: this.prefixUnary();
|
|
1773
|
+
let right = this.prefixUnary();
|
|
1734
1774
|
return new Expression_1.UnaryExpression(operator, right);
|
|
1735
1775
|
}
|
|
1736
1776
|
return this.call();
|
|
@@ -1738,32 +1778,31 @@ class Parser {
|
|
|
1738
1778
|
indexedGet(expr) {
|
|
1739
1779
|
let openingSquare = this.previous();
|
|
1740
1780
|
let questionDotToken = this.getMatchingTokenAtOffset(-2, TokenKind_1.TokenKind.QuestionDot);
|
|
1741
|
-
let
|
|
1742
|
-
|
|
1781
|
+
let indexes = [];
|
|
1782
|
+
//consume leading newlines
|
|
1743
1783
|
while (this.match(TokenKind_1.TokenKind.Newline)) { }
|
|
1744
1784
|
try {
|
|
1745
|
-
|
|
1785
|
+
indexes.push(this.expression());
|
|
1786
|
+
//consume additional indexes separated by commas
|
|
1787
|
+
while (this.check(TokenKind_1.TokenKind.Comma)) {
|
|
1788
|
+
//discard the comma
|
|
1789
|
+
this.advance();
|
|
1790
|
+
indexes.push(this.expression());
|
|
1791
|
+
}
|
|
1746
1792
|
}
|
|
1747
1793
|
catch (error) {
|
|
1748
1794
|
this.rethrowNonDiagnosticError(error);
|
|
1749
1795
|
}
|
|
1796
|
+
//consume trailing newlines
|
|
1750
1797
|
while (this.match(TokenKind_1.TokenKind.Newline)) { }
|
|
1751
|
-
closingSquare = this.tryConsume(DiagnosticMessages_1.DiagnosticMessages.expectedRightSquareBraceAfterArrayOrObjectIndex(), TokenKind_1.TokenKind.RightSquareBracket);
|
|
1752
|
-
return new Expression_1.IndexedGetExpression(expr,
|
|
1798
|
+
const closingSquare = this.tryConsume(DiagnosticMessages_1.DiagnosticMessages.expectedRightSquareBraceAfterArrayOrObjectIndex(), TokenKind_1.TokenKind.RightSquareBracket);
|
|
1799
|
+
return new Expression_1.IndexedGetExpression(expr, indexes.shift(), openingSquare, closingSquare, questionDotToken, indexes);
|
|
1753
1800
|
}
|
|
1754
1801
|
newExpression() {
|
|
1755
|
-
var _a;
|
|
1756
1802
|
this.warnIfNotBrighterScriptMode(`using 'new' keyword to construct a class`);
|
|
1757
1803
|
let newToken = this.advance();
|
|
1758
|
-
let nameExpr = this.
|
|
1759
|
-
let leftParen = this.
|
|
1760
|
-
if (!leftParen) {
|
|
1761
|
-
// new expression without a following call expression
|
|
1762
|
-
// wrap the name in an expression
|
|
1763
|
-
const endOfStatementRange = util_1.util.createRangeFromPositions(newToken.range.end, (_a = this.peek()) === null || _a === void 0 ? void 0 : _a.range.end);
|
|
1764
|
-
const exprStmt = nameExpr !== null && nameExpr !== void 0 ? nameExpr : (0, creators_1.createStringLiteral)('', endOfStatementRange);
|
|
1765
|
-
return new Statement_1.ExpressionStatement(exprStmt);
|
|
1766
|
-
}
|
|
1804
|
+
let nameExpr = this.getNamespacedVariableNameExpression();
|
|
1805
|
+
let leftParen = this.consume(DiagnosticMessages_1.DiagnosticMessages.unexpectedToken(this.peek().text), TokenKind_1.TokenKind.LeftParen, TokenKind_1.TokenKind.QuestionLeftParen);
|
|
1767
1806
|
let call = this.finishCall(leftParen, nameExpr);
|
|
1768
1807
|
//pop the call from the callExpressions list because this is technically something else
|
|
1769
1808
|
this.callExpressions.pop();
|
|
@@ -1872,81 +1911,58 @@ class Parser {
|
|
|
1872
1911
|
return expression;
|
|
1873
1912
|
}
|
|
1874
1913
|
/**
|
|
1875
|
-
*
|
|
1914
|
+
* Tries to get the next token as a type
|
|
1915
|
+
* Allows for built-in types (double, string, etc.) or namespaced custom types in Brighterscript mode
|
|
1916
|
+
* Will return a token of whatever is next to be parsed
|
|
1917
|
+
* Will allow v1 type syntax (typed arrays, union types), but there is no validation on types used this way
|
|
1876
1918
|
*/
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1919
|
+
typeToken(ignoreDiagnostics = false) {
|
|
1920
|
+
let typeToken;
|
|
1921
|
+
let lookForUnions = true;
|
|
1922
|
+
let isAUnion = false;
|
|
1923
|
+
let resultToken;
|
|
1924
|
+
while (lookForUnions) {
|
|
1925
|
+
lookForUnions = false;
|
|
1926
|
+
if (this.checkAny(...TokenKind_1.DeclarableTypes)) {
|
|
1927
|
+
// Token is a built in type
|
|
1928
|
+
typeToken = this.advance();
|
|
1929
|
+
}
|
|
1930
|
+
else if (this.options.mode === ParseMode.BrighterScript) {
|
|
1931
|
+
try {
|
|
1932
|
+
// see if we can get a namespaced identifer
|
|
1933
|
+
const qualifiedType = this.getNamespacedVariableNameExpression(ignoreDiagnostics);
|
|
1934
|
+
typeToken = (0, creators_1.createToken)(TokenKind_1.TokenKind.Identifier, qualifiedType.getName(this.options.mode), qualifiedType.range);
|
|
1888
1935
|
}
|
|
1889
|
-
|
|
1890
|
-
|
|
1936
|
+
catch (_a) {
|
|
1937
|
+
//could not get an identifier - just get whatever's next
|
|
1938
|
+
typeToken = this.advance();
|
|
1891
1939
|
}
|
|
1892
1940
|
}
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
throw error;
|
|
1903
|
-
}
|
|
1904
|
-
}
|
|
1905
|
-
/**
|
|
1906
|
-
* Gets a single "part" of a type of a potential Union type
|
|
1907
|
-
* Note: this does not NEED to be part of a union type, but the logic is the same
|
|
1908
|
-
*
|
|
1909
|
-
* @param changedTokens an array that is modified with any tokens that have been changed from their default kind to identifiers - eg. when a keyword is used as type
|
|
1910
|
-
* @returns an expression that was successfully parsed
|
|
1911
|
-
*/
|
|
1912
|
-
getTypeExpressionPart(changedTokens) {
|
|
1913
|
-
let expr;
|
|
1914
|
-
if (this.checkAny(...TokenKind_1.DeclarableTypes)) {
|
|
1915
|
-
// if this is just a type, just use directly
|
|
1916
|
-
expr = new Expression_1.VariableExpression(this.advance());
|
|
1917
|
-
}
|
|
1918
|
-
else {
|
|
1919
|
-
if (this.checkAny(...TokenKind_1.AllowedTypeIdentifiers)) {
|
|
1920
|
-
// Since the next token is allowed as a type identifier, change the kind
|
|
1921
|
-
let nextToken = this.peek();
|
|
1922
|
-
changedTokens.push({ token: nextToken, oldKind: nextToken.kind });
|
|
1923
|
-
nextToken.kind = TokenKind_1.TokenKind.Identifier;
|
|
1924
|
-
}
|
|
1925
|
-
expr = this.identifyingExpression(TokenKind_1.AllowedTypeIdentifiers);
|
|
1926
|
-
if (expr) {
|
|
1927
|
-
this._references.expressions.add(expr);
|
|
1928
|
-
}
|
|
1929
|
-
}
|
|
1930
|
-
//Check if it has square brackets, thus making it an array
|
|
1931
|
-
if (expr && this.check(TokenKind_1.TokenKind.LeftSquareBracket)) {
|
|
1932
|
-
if (this.options.mode === ParseMode.BrightScript) {
|
|
1933
|
-
// typed arrays not allowed in Brightscript
|
|
1934
|
-
this.warnIfNotBrighterScriptMode('typed arrays');
|
|
1935
|
-
return expr;
|
|
1936
|
-
}
|
|
1937
|
-
// Check if it is an array - that is, if it has `[]` after the type
|
|
1938
|
-
// eg. `string[]` or `SomeKlass[]`
|
|
1939
|
-
// This is while loop, so it supports multidimensional arrays (eg. integer[][])
|
|
1940
|
-
while (this.check(TokenKind_1.TokenKind.LeftSquareBracket)) {
|
|
1941
|
-
const leftBracket = this.advance();
|
|
1942
|
-
if (this.check(TokenKind_1.TokenKind.RightSquareBracket)) {
|
|
1941
|
+
else {
|
|
1942
|
+
// just get whatever's next
|
|
1943
|
+
typeToken = this.advance();
|
|
1944
|
+
}
|
|
1945
|
+
resultToken = resultToken !== null && resultToken !== void 0 ? resultToken : typeToken;
|
|
1946
|
+
if (resultToken && this.options.mode === ParseMode.BrighterScript) {
|
|
1947
|
+
// check for brackets
|
|
1948
|
+
while (this.check(TokenKind_1.TokenKind.LeftSquareBracket) && this.peekNext().kind === TokenKind_1.TokenKind.RightSquareBracket) {
|
|
1949
|
+
const leftBracket = this.advance();
|
|
1943
1950
|
const rightBracket = this.advance();
|
|
1944
|
-
|
|
1945
|
-
|
|
1951
|
+
typeToken = (0, creators_1.createToken)(TokenKind_1.TokenKind.Identifier, typeToken.text + leftBracket.text + rightBracket.text, util_1.util.createBoundingRange(typeToken, leftBracket, rightBracket));
|
|
1952
|
+
resultToken = (0, creators_1.createToken)(TokenKind_1.TokenKind.Dynamic, null, typeToken.range);
|
|
1953
|
+
}
|
|
1954
|
+
if (this.check(TokenKind_1.TokenKind.Or)) {
|
|
1955
|
+
lookForUnions = true;
|
|
1956
|
+
let orToken = this.advance();
|
|
1957
|
+
resultToken = (0, creators_1.createToken)(TokenKind_1.TokenKind.Dynamic, null, util_1.util.createBoundingRange(resultToken, typeToken, orToken));
|
|
1958
|
+
isAUnion = true;
|
|
1946
1959
|
}
|
|
1947
1960
|
}
|
|
1948
1961
|
}
|
|
1949
|
-
|
|
1962
|
+
if (isAUnion) {
|
|
1963
|
+
resultToken = (0, creators_1.createToken)(TokenKind_1.TokenKind.Dynamic, null, util_1.util.createBoundingRange(resultToken, typeToken));
|
|
1964
|
+
}
|
|
1965
|
+
return resultToken;
|
|
1950
1966
|
}
|
|
1951
1967
|
primary() {
|
|
1952
1968
|
switch (true) {
|
|
@@ -2217,6 +2233,11 @@ class Parser {
|
|
|
2217
2233
|
var _a;
|
|
2218
2234
|
return ((_a = this.previous()) === null || _a === void 0 ? void 0 : _a.kind) === tokenKind;
|
|
2219
2235
|
}
|
|
2236
|
+
/**
|
|
2237
|
+
* Check that the next token kind is the expected kind
|
|
2238
|
+
* @param tokenKind the expected next kind
|
|
2239
|
+
* @returns true if the next tokenKind is the expected value
|
|
2240
|
+
*/
|
|
2220
2241
|
check(tokenKind) {
|
|
2221
2242
|
const nextKind = this.peek().kind;
|
|
2222
2243
|
if (nextKind === TokenKind_1.TokenKind.Eof) {
|
|
@@ -2362,7 +2383,7 @@ class Parser {
|
|
|
2362
2383
|
ClassStatement: s => {
|
|
2363
2384
|
this._references.classStatements.push(s);
|
|
2364
2385
|
},
|
|
2365
|
-
|
|
2386
|
+
ClassFieldStatement: s => {
|
|
2366
2387
|
if (s.initialValue) {
|
|
2367
2388
|
this._references.expressions.add(s.initialValue);
|
|
2368
2389
|
}
|