brighterscript 0.66.0-alpha.6 → 0.66.0-alpha.8
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 +88 -10
- package/README.md +16 -0
- package/bsconfig.schema.json +15 -0
- package/dist/ActionPipeline.d.ts +10 -0
- package/dist/ActionPipeline.js +40 -0
- package/dist/ActionPipeline.js.map +1 -0
- package/dist/AstValidationSegmenter.d.ts +25 -0
- package/dist/AstValidationSegmenter.js +150 -0
- package/dist/AstValidationSegmenter.js.map +1 -0
- package/dist/BsConfig.d.ts +15 -1
- package/dist/CommentFlagProcessor.d.ts +4 -3
- package/dist/CommentFlagProcessor.js.map +1 -1
- package/dist/DiagnosticMessages.d.ts +8 -1
- package/dist/DiagnosticMessages.js +30 -13
- package/dist/DiagnosticMessages.js.map +1 -1
- package/dist/LanguageServer.js +7 -1
- package/dist/LanguageServer.js.map +1 -1
- package/dist/PluginInterface.d.ts +11 -2
- package/dist/PluginInterface.js +69 -10
- package/dist/PluginInterface.js.map +1 -1
- package/dist/Program.d.ts +107 -38
- package/dist/Program.js +502 -270
- package/dist/Program.js.map +1 -1
- package/dist/ProgramBuilder.d.ts +10 -4
- package/dist/ProgramBuilder.js +44 -54
- package/dist/ProgramBuilder.js.map +1 -1
- package/dist/Scope.d.ts +26 -38
- package/dist/Scope.js +153 -174
- package/dist/Scope.js.map +1 -1
- package/dist/SymbolTable.d.ts +4 -1
- package/dist/SymbolTable.js +19 -7
- package/dist/SymbolTable.js.map +1 -1
- package/dist/XmlScope.d.ts +5 -4
- package/dist/XmlScope.js +16 -14
- package/dist/XmlScope.js.map +1 -1
- package/dist/astUtils/{AstEditor.d.ts → Editor.d.ts} +6 -1
- package/dist/astUtils/{AstEditor.js → Editor.js} +9 -3
- package/dist/astUtils/Editor.js.map +1 -0
- package/dist/astUtils/{AstEditor.spec.js → Editor.spec.js} +10 -6
- package/dist/astUtils/Editor.spec.js.map +1 -0
- package/dist/astUtils/reflection.d.ts +9 -4
- package/dist/astUtils/reflection.js +23 -7
- package/dist/astUtils/reflection.js.map +1 -1
- package/dist/astUtils/reflection.spec.js +2 -2
- package/dist/astUtils/reflection.spec.js.map +1 -1
- package/dist/astUtils/visitors.d.ts +14 -3
- package/dist/astUtils/visitors.js +22 -2
- package/dist/astUtils/visitors.js.map +1 -1
- package/dist/astUtils/visitors.spec.js +58 -7
- package/dist/astUtils/visitors.spec.js.map +1 -1
- package/dist/bscPlugin/BscPlugin.d.ts +10 -2
- package/dist/bscPlugin/BscPlugin.js +24 -4
- package/dist/bscPlugin/BscPlugin.js.map +1 -1
- package/dist/bscPlugin/FileWriter.d.ts +6 -0
- package/dist/bscPlugin/FileWriter.js +24 -0
- package/dist/bscPlugin/FileWriter.js.map +1 -0
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +8 -8
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js.map +1 -1
- package/dist/bscPlugin/completions/CompletionsProcessor.d.ts +7 -2
- package/dist/bscPlugin/completions/CompletionsProcessor.js +112 -44
- package/dist/bscPlugin/completions/CompletionsProcessor.js.map +1 -1
- package/dist/bscPlugin/completions/CompletionsProcessor.spec.js +212 -6
- package/dist/bscPlugin/completions/CompletionsProcessor.spec.js.map +1 -1
- package/dist/bscPlugin/fileProviders/FileProvider.d.ts +9 -0
- package/dist/bscPlugin/fileProviders/FileProvider.js +51 -0
- package/dist/bscPlugin/fileProviders/FileProvider.js.map +1 -0
- package/dist/bscPlugin/hover/HoverProcessor.d.ts +1 -7
- package/dist/bscPlugin/hover/HoverProcessor.js +10 -8
- package/dist/bscPlugin/hover/HoverProcessor.js.map +1 -1
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.d.ts +1 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +43 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -1
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js +22 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js.map +1 -1
- package/dist/bscPlugin/serialize/BslibInjector.spec.js +19 -0
- package/dist/bscPlugin/serialize/BslibInjector.spec.js.map +1 -0
- package/dist/bscPlugin/serialize/BslibManager.d.ts +9 -0
- package/dist/bscPlugin/serialize/BslibManager.js +40 -0
- package/dist/bscPlugin/serialize/BslibManager.js.map +1 -0
- package/dist/bscPlugin/serialize/FileSerializer.d.ts +9 -0
- package/dist/bscPlugin/serialize/FileSerializer.js +72 -0
- package/dist/bscPlugin/serialize/FileSerializer.js.map +1 -0
- package/dist/bscPlugin/transpile/{BrsFilePreTranspileProcessor.d.ts → BrsFileTranspileProcessor.d.ts} +4 -2
- package/dist/bscPlugin/transpile/{BrsFilePreTranspileProcessor.js → BrsFileTranspileProcessor.js} +29 -5
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js.map +1 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.d.ts +1 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js +41 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.d.ts +2 -2
- package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.js.map +1 -1
- package/dist/bscPlugin/validation/BrsFileValidator.js +8 -3
- package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -1
- package/dist/bscPlugin/validation/BrsFileValidator.spec.js +1 -1
- package/dist/bscPlugin/validation/BrsFileValidator.spec.js.map +1 -1
- package/dist/bscPlugin/validation/ScopeValidator.d.ts +5 -9
- package/dist/bscPlugin/validation/ScopeValidator.js +214 -222
- package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -1
- package/dist/bscPlugin/validation/ScopeValidator.spec.js +669 -0
- package/dist/bscPlugin/validation/ScopeValidator.spec.js.map +1 -1
- package/dist/bscPlugin/validation/XmlFileValidator.js +2 -2
- package/dist/bscPlugin/validation/XmlFileValidator.js.map +1 -1
- package/dist/cli.js +1 -0
- package/dist/cli.js.map +1 -1
- package/dist/deferred.d.ts +2 -2
- package/dist/deferred.js.map +1 -1
- package/dist/diagnosticUtils.d.ts +1 -0
- package/dist/diagnosticUtils.js +4 -3
- package/dist/diagnosticUtils.js.map +1 -1
- package/dist/examples/plugins/removePrint.js +1 -1
- package/dist/examples/plugins/removePrint.js.map +1 -1
- package/dist/files/AssetFile.d.ts +26 -0
- package/dist/files/AssetFile.js +26 -0
- package/dist/files/AssetFile.js.map +1 -0
- package/dist/files/BrsFile.Class.spec.js +241 -40
- package/dist/files/BrsFile.Class.spec.js.map +1 -1
- package/dist/files/BrsFile.d.ts +66 -16
- package/dist/files/BrsFile.js +330 -80
- package/dist/files/BrsFile.js.map +1 -1
- package/dist/files/BrsFile.spec.js +1134 -167
- package/dist/files/BrsFile.spec.js.map +1 -1
- package/dist/files/Factory.d.ts +25 -0
- package/dist/files/Factory.js +22 -0
- package/dist/files/Factory.js.map +1 -0
- package/dist/files/File.d.ts +106 -0
- package/dist/files/File.js +16 -0
- package/dist/files/File.js.map +1 -0
- package/dist/files/LazyFileData.d.ts +20 -0
- package/dist/files/LazyFileData.js +54 -0
- package/dist/files/LazyFileData.js.map +1 -0
- package/dist/files/LazyFileData.spec.d.ts +1 -0
- package/dist/files/LazyFileData.spec.js +27 -0
- package/dist/files/LazyFileData.spec.js.map +1 -0
- package/dist/files/XmlFile.d.ts +55 -17
- package/dist/files/XmlFile.js +88 -47
- package/dist/files/XmlFile.js.map +1 -1
- package/dist/files/XmlFile.spec.js +64 -57
- package/dist/files/XmlFile.spec.js.map +1 -1
- package/dist/files/tests/imports.spec.js +21 -8
- package/dist/files/tests/imports.spec.js.map +1 -1
- package/dist/files/tests/optionalChaning.spec.js +14 -14
- package/dist/files/tests/optionalChaning.spec.js.map +1 -1
- package/dist/globalCallables.js +1 -1
- package/dist/globalCallables.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +357 -89
- package/dist/interfaces.js +10 -2
- package/dist/interfaces.js.map +1 -1
- package/dist/lexer/Lexer.js +1 -1
- package/dist/lexer/TokenKind.d.ts +1 -0
- package/dist/lexer/TokenKind.js +4 -1
- package/dist/lexer/TokenKind.js.map +1 -1
- package/dist/parser/AstNode.d.ts +2 -2
- package/dist/parser/AstNode.js +1 -1
- package/dist/parser/AstNode.js.map +1 -1
- package/dist/parser/BrsTranspileState.d.ts +3 -2
- package/dist/parser/BrsTranspileState.js +3 -2
- package/dist/parser/BrsTranspileState.js.map +1 -1
- package/dist/parser/Expression.d.ts +2 -2
- package/dist/parser/Expression.js +23 -19
- package/dist/parser/Expression.js.map +1 -1
- package/dist/parser/Parser.Class.spec.js +103 -0
- package/dist/parser/Parser.Class.spec.js.map +1 -1
- package/dist/parser/Parser.js +61 -13
- package/dist/parser/Parser.js.map +1 -1
- package/dist/parser/Parser.spec.js +227 -1
- package/dist/parser/Parser.spec.js.map +1 -1
- package/dist/parser/SGParser.d.ts +2 -2
- package/dist/parser/SGParser.js +3 -3
- package/dist/parser/SGParser.js.map +1 -1
- package/dist/parser/SGParser.spec.js +2 -2
- package/dist/parser/SGParser.spec.js.map +1 -1
- package/dist/parser/SGTypes.d.ts +1 -1
- package/dist/parser/Statement.d.ts +12 -5
- package/dist/parser/Statement.js +56 -26
- package/dist/parser/Statement.js.map +1 -1
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +16 -16
- 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 +64 -36
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TernaryExpression.spec.js +34 -34
- package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/UnaryExpression.spec.d.ts +1 -0
- package/dist/parser/tests/expression/UnaryExpression.spec.js +52 -0
- package/dist/parser/tests/expression/UnaryExpression.spec.js.map +1 -0
- package/dist/parser/tests/statement/ConstStatement.spec.js +90 -16
- package/dist/parser/tests/statement/ConstStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/Continue.spec.js +2 -2
- package/dist/parser/tests/statement/Continue.spec.js.map +1 -1
- package/dist/parser/tests/statement/Enum.spec.js +35 -26
- package/dist/parser/tests/statement/Enum.spec.js.map +1 -1
- package/dist/parser/tests/statement/For.spec.js +6 -6
- package/dist/parser/tests/statement/For.spec.js.map +1 -1
- package/dist/parser/tests/statement/ForEach.spec.js +4 -4
- package/dist/parser/tests/statement/ForEach.spec.js.map +1 -1
- package/dist/parser/tests/statement/InterfaceStatement.spec.js +20 -12
- package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/PrintStatement.spec.js +10 -10
- package/dist/parser/tests/statement/PrintStatement.spec.js.map +1 -1
- package/dist/preprocessor/Manifest.d.ts +1 -1
- package/dist/preprocessor/Manifest.js +2 -2
- package/dist/preprocessor/Manifest.js.map +1 -1
- package/dist/roku-types/data.json +98 -193
- package/dist/roku-types/index.d.ts +15 -11
- package/dist/types/ArrayType.d.ts +1 -1
- package/dist/types/ArrayType.js +4 -0
- package/dist/types/ArrayType.js.map +1 -1
- package/dist/types/ArrayType.spec.js +1 -1
- package/dist/types/ArrayType.spec.js.map +1 -1
- package/dist/types/AssociativeArrayType.d.ts +1 -1
- package/dist/types/AssociativeArrayType.js +1 -1
- package/dist/types/AssociativeArrayType.js.map +1 -1
- package/dist/types/BooleanType.d.ts +1 -1
- package/dist/types/BooleanType.js +2 -1
- package/dist/types/BooleanType.js.map +1 -1
- package/dist/types/BscType.d.ts +2 -2
- package/dist/types/BscType.js +30 -9
- package/dist/types/BscType.js.map +1 -1
- package/dist/types/BuiltInInterfaceAdder.d.ts +3 -0
- package/dist/types/BuiltInInterfaceAdder.js +37 -16
- package/dist/types/BuiltInInterfaceAdder.js.map +1 -1
- package/dist/types/BuiltInInterfaceAdder.spec.js +7 -0
- package/dist/types/BuiltInInterfaceAdder.spec.js.map +1 -1
- package/dist/types/ClassType.d.ts +4 -3
- package/dist/types/ClassType.js +6 -3
- package/dist/types/ClassType.js.map +1 -1
- package/dist/types/ClassType.spec.js +5 -3
- package/dist/types/ClassType.spec.js.map +1 -1
- package/dist/types/ComponentType.d.ts +1 -1
- package/dist/types/ComponentType.js +3 -0
- package/dist/types/ComponentType.js.map +1 -1
- package/dist/types/DoubleType.js +3 -1
- package/dist/types/DoubleType.js.map +1 -1
- package/dist/types/EnumType.d.ts +1 -1
- package/dist/types/EnumType.js +7 -2
- package/dist/types/EnumType.js.map +1 -1
- package/dist/types/FloatType.js +3 -1
- package/dist/types/FloatType.js.map +1 -1
- package/dist/types/InheritableType.d.ts +7 -4
- package/dist/types/InheritableType.js +67 -3
- package/dist/types/InheritableType.js.map +1 -1
- package/dist/types/IntegerType.js +3 -1
- package/dist/types/IntegerType.js.map +1 -1
- package/dist/types/InterfaceType.d.ts +5 -4
- package/dist/types/InterfaceType.js +5 -12
- package/dist/types/InterfaceType.js.map +1 -1
- package/dist/types/InterfaceType.spec.js +23 -0
- package/dist/types/InterfaceType.spec.js.map +1 -1
- package/dist/types/LongIntegerType.js +3 -1
- package/dist/types/LongIntegerType.js.map +1 -1
- package/dist/types/NamespaceType.d.ts +2 -1
- package/dist/types/NamespaceType.js +3 -0
- package/dist/types/NamespaceType.js.map +1 -1
- package/dist/types/ObjectType.d.ts +1 -1
- package/dist/types/ReferenceType.js +40 -6
- package/dist/types/ReferenceType.js.map +1 -1
- package/dist/types/StringType.js +2 -2
- package/dist/types/StringType.js.map +1 -1
- package/dist/types/TypedFunctionType.d.ts +6 -1
- package/dist/types/TypedFunctionType.js +46 -16
- package/dist/types/TypedFunctionType.js.map +1 -1
- package/dist/types/TypedFunctionType.spec.js +99 -0
- package/dist/types/TypedFunctionType.spec.js.map +1 -1
- package/dist/types/UnionType.js +8 -0
- package/dist/types/UnionType.js.map +1 -1
- package/dist/types/helper.spec.js +15 -0
- package/dist/types/helper.spec.js.map +1 -1
- package/dist/types/helpers.d.ts +3 -0
- package/dist/types/helpers.js +33 -1
- package/dist/types/helpers.js.map +1 -1
- package/dist/util.d.ts +25 -9
- package/dist/util.js +165 -72
- package/dist/util.js.map +1 -1
- package/dist/validators/ClassValidator.js.map +1 -1
- package/package.json +2 -2
- package/dist/astUtils/AstEditor.js.map +0 -1
- package/dist/astUtils/AstEditor.spec.js.map +0 -1
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js.map +0 -1
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js +0 -31
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js.map +0 -1
- /package/dist/astUtils/{AstEditor.spec.d.ts → Editor.spec.d.ts} +0 -0
- /package/dist/bscPlugin/{transpile/BrsFilePreTranspileProcessor.spec.d.ts → serialize/BslibInjector.spec.d.ts} +0 -0
package/dist/files/BrsFile.js
CHANGED
|
@@ -22,19 +22,15 @@ const visitors_1 = require("../astUtils/visitors");
|
|
|
22
22
|
const CommentFlagProcessor_1 = require("../CommentFlagProcessor");
|
|
23
23
|
const vscode_uri_1 = require("vscode-uri");
|
|
24
24
|
const SymbolTable_1 = require("../SymbolTable");
|
|
25
|
+
const Editor_1 = require("../astUtils/Editor");
|
|
26
|
+
const AstValidationSegmenter_1 = require("../AstValidationSegmenter");
|
|
25
27
|
/**
|
|
26
28
|
* Holds all details about this file within the scope of the whole program
|
|
27
29
|
*/
|
|
28
30
|
class BrsFile {
|
|
29
|
-
constructor(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
*/
|
|
33
|
-
pkgPath, program) {
|
|
34
|
-
var _a, _b;
|
|
35
|
-
this.srcPath = srcPath;
|
|
36
|
-
this.pkgPath = pkgPath;
|
|
37
|
-
this.program = program;
|
|
31
|
+
constructor(options) {
|
|
32
|
+
var _a, _b, _c;
|
|
33
|
+
this.type = 'BrsFile';
|
|
38
34
|
/**
|
|
39
35
|
* The parseMode used for the parser for this file
|
|
40
36
|
*/
|
|
@@ -51,31 +47,44 @@ class BrsFile {
|
|
|
51
47
|
this.commentFlags = [];
|
|
52
48
|
this.callables = [];
|
|
53
49
|
this.functionCalls = [];
|
|
54
|
-
/**
|
|
55
|
-
* Does this file need to be transpiled?
|
|
56
|
-
*/
|
|
57
|
-
this.needsTranspiled = false;
|
|
58
50
|
this.scopesByFunc = new Map();
|
|
59
|
-
this.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
51
|
+
this.validationSegmenter = new AstValidationSegmenter_1.AstValidationSegmenter();
|
|
52
|
+
if (options) {
|
|
53
|
+
this.srcPath = (0, util_1.standardizePath) `${options.srcPath}`;
|
|
54
|
+
this.destPath = (0, util_1.standardizePath) `${options.destPath}`;
|
|
55
|
+
this.program = options.program;
|
|
56
|
+
this.extension = util_1.util.getExtension(this.srcPath);
|
|
57
|
+
if (options.pkgPath) {
|
|
58
|
+
this.pkgPath = options.pkgPath;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
//don't rename .d.bs files to .d.brs
|
|
62
|
+
if (this.extension === '.d.bs') {
|
|
63
|
+
this.pkgPath = this.destPath;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
this.pkgPath = this.destPath.replace(/\.bs$/i, '.brs');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//all BrighterScript files need to be transpiled
|
|
70
|
+
if (((_a = this.extension) === null || _a === void 0 ? void 0 : _a.endsWith('.bs')) || ((_c = (_b = this.program) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.allowBrighterScriptInBrightScript)) {
|
|
71
|
+
this.parseMode = Parser_1.ParseMode.BrighterScript;
|
|
72
|
+
}
|
|
73
|
+
this.isTypedef = this.extension === '.d.bs';
|
|
74
|
+
if (!this.isTypedef) {
|
|
75
|
+
this.typedefKey = util_1.util.getTypedefPath(this.srcPath);
|
|
76
|
+
}
|
|
77
|
+
//global file doesn't have a program, so only resolve typedef info if we have a program
|
|
78
|
+
if (this.program) {
|
|
79
|
+
this.resolveTypedef();
|
|
80
|
+
}
|
|
75
81
|
}
|
|
76
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* @deprecated use `.diagnostics` instead
|
|
85
|
+
*/
|
|
77
86
|
getDiagnostics() {
|
|
78
|
-
return
|
|
87
|
+
return this.diagnostics;
|
|
79
88
|
}
|
|
80
89
|
addDiagnostic(diagnostic) {
|
|
81
90
|
if (!diagnostic.file) {
|
|
@@ -110,7 +119,7 @@ class BrsFile {
|
|
|
110
119
|
if ((0, reflection_1.isImportStatement)(statement) && statement.filePathToken) {
|
|
111
120
|
result.push({
|
|
112
121
|
filePathRange: statement.filePathToken.range,
|
|
113
|
-
|
|
122
|
+
destPath: util_1.util.getPkgPathFromTarget(this.destPath, statement.filePath),
|
|
114
123
|
sourceFile: this,
|
|
115
124
|
text: (_d = statement.filePathToken) === null || _d === void 0 ? void 0 : _d.text
|
|
116
125
|
});
|
|
@@ -120,11 +129,26 @@ class BrsFile {
|
|
|
120
129
|
})) !== null && _b !== void 0 ? _b : [];
|
|
121
130
|
return result;
|
|
122
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Does this file need to be transpiled?
|
|
134
|
+
* @deprecated use the `.editor` property to push changes to the file, which will force transpilation
|
|
135
|
+
*/
|
|
136
|
+
get needsTranspiled() {
|
|
137
|
+
var _a, _b, _c, _d;
|
|
138
|
+
if (this._needsTranspiled !== undefined) {
|
|
139
|
+
return this._needsTranspiled;
|
|
140
|
+
}
|
|
141
|
+
return !!(((_a = this.extension) === null || _a === void 0 ? void 0 : _a.endsWith('.bs')) || ((_c = (_b = this.program) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.allowBrighterScriptInBrightScript) || ((_d = this.editor) === null || _d === void 0 ? void 0 : _d.hasChanges));
|
|
142
|
+
}
|
|
143
|
+
set needsTranspiled(value) {
|
|
144
|
+
this._needsTranspiled = value;
|
|
145
|
+
}
|
|
123
146
|
/**
|
|
124
147
|
* The AST for this file
|
|
125
148
|
*/
|
|
126
149
|
get ast() {
|
|
127
|
-
|
|
150
|
+
var _a;
|
|
151
|
+
return (_a = this.parser) === null || _a === void 0 ? void 0 : _a.ast;
|
|
128
152
|
}
|
|
129
153
|
/**
|
|
130
154
|
* Get the token at the specified position
|
|
@@ -178,23 +202,25 @@ class BrsFile {
|
|
|
178
202
|
this.typedefFile = this.program.getFile(this.typedefKey);
|
|
179
203
|
this.hasTypedef = !!this.typedefFile;
|
|
180
204
|
}
|
|
205
|
+
onDependenciesChanged() {
|
|
206
|
+
this.resolveTypedef();
|
|
207
|
+
}
|
|
181
208
|
/**
|
|
182
209
|
* Attach the file to the dependency graph so it can monitor changes.
|
|
183
210
|
* Also notify the dependency graph of our current dependencies so other dependents can be notified.
|
|
211
|
+
* @deprecated this does nothing. This functionality is now handled by the file api and will be deleted in v1
|
|
184
212
|
*/
|
|
185
|
-
attachDependencyGraph(dependencyGraph) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
});
|
|
192
|
-
const dependencies = this.ownScriptImports.filter(x => !!x.pkgPath).map(x => x.pkgPath.toLowerCase());
|
|
213
|
+
attachDependencyGraph(dependencyGraph) { }
|
|
214
|
+
/**
|
|
215
|
+
* The list of files that this file depends on
|
|
216
|
+
*/
|
|
217
|
+
get dependencies() {
|
|
218
|
+
const result = this.ownScriptImports.filter(x => !!x.destPath).map(x => x.destPath.toLowerCase());
|
|
193
219
|
//if this is a .brs file, watch for typedef changes
|
|
194
220
|
if (this.extension === '.brs') {
|
|
195
|
-
|
|
221
|
+
result.push(util_1.util.getTypedefPath(this.destPath));
|
|
196
222
|
}
|
|
197
|
-
|
|
223
|
+
return result;
|
|
198
224
|
}
|
|
199
225
|
/**
|
|
200
226
|
* Calculate the AST for this file
|
|
@@ -864,7 +890,7 @@ class BrsFile {
|
|
|
864
890
|
results.push(util_1.util.createLocation(vscode_uri_1.URI.file(constant.file.srcPath).toString(), constant.item.tokens.name.range));
|
|
865
891
|
return results;
|
|
866
892
|
}
|
|
867
|
-
if ((0, reflection_1.isDottedGetExpression)(expression)) {
|
|
893
|
+
if ((0, reflection_1.isDottedGetExpression)(expression) || (0, reflection_1.isVariableExpression)(expression)) {
|
|
868
894
|
const enumLink = scope.getEnumFileLink(fullName, containingNamespace);
|
|
869
895
|
if (enumLink) {
|
|
870
896
|
results.push(util_1.util.createLocation(vscode_uri_1.URI.file(enumLink.file.srcPath).toString(), enumLink.item.tokens.name.range));
|
|
@@ -875,6 +901,16 @@ class BrsFile {
|
|
|
875
901
|
results.push(util_1.util.createLocation(vscode_uri_1.URI.file(enumMemberLink.file.srcPath).toString(), enumMemberLink.item.tokens.name.range));
|
|
876
902
|
return results;
|
|
877
903
|
}
|
|
904
|
+
const interfaceFileLink = scope.getInterfaceFileLink(fullName, containingNamespace);
|
|
905
|
+
if (interfaceFileLink) {
|
|
906
|
+
results.push(util_1.util.createLocation(vscode_uri_1.URI.file(interfaceFileLink.file.srcPath).toString(), interfaceFileLink.item.tokens.name.range));
|
|
907
|
+
return results;
|
|
908
|
+
}
|
|
909
|
+
const classFileLink = scope.getClassFileLink(fullName, containingNamespace);
|
|
910
|
+
if (classFileLink) {
|
|
911
|
+
results.push(util_1.util.createLocation(vscode_uri_1.URI.file(classFileLink.file.srcPath).toString(), classFileLink.item.name.range));
|
|
912
|
+
return results;
|
|
913
|
+
}
|
|
878
914
|
}
|
|
879
915
|
}
|
|
880
916
|
let textToSearchFor = token.text.toLowerCase();
|
|
@@ -934,28 +970,27 @@ class BrsFile {
|
|
|
934
970
|
//look through all files in scope for matches
|
|
935
971
|
for (const scope of scopesForFile) {
|
|
936
972
|
for (const file of scope.getAllFiles()) {
|
|
937
|
-
if ((0, reflection_1.
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
results.push(namespaceDefinition);
|
|
973
|
+
if ((0, reflection_1.isBrsFile)(file) && !filesSearched.has(file)) {
|
|
974
|
+
filesSearched.add(file);
|
|
975
|
+
if ((previousToken === null || previousToken === void 0 ? void 0 : previousToken.kind) === TokenKind_1.TokenKind.Dot && file.parseMode === Parser_1.ParseMode.BrighterScript) {
|
|
976
|
+
results.push(...this.getClassMemberDefinitions(textToSearchFor, file));
|
|
977
|
+
const namespaceDefinition = this.getNamespaceDefinitions(token, file);
|
|
978
|
+
if (namespaceDefinition) {
|
|
979
|
+
results.push(namespaceDefinition);
|
|
980
|
+
}
|
|
946
981
|
}
|
|
982
|
+
const statementHandler = (statement) => {
|
|
983
|
+
if (statement.getName(this.parseMode).toLowerCase() === textToSearchFor) {
|
|
984
|
+
const uri = util_1.util.pathToUri(file.srcPath);
|
|
985
|
+
results.push(util_1.util.createLocation(uri, statement.range));
|
|
986
|
+
}
|
|
987
|
+
};
|
|
988
|
+
file.parser.ast.walk((0, visitors_1.createVisitor)({
|
|
989
|
+
FunctionStatement: statementHandler
|
|
990
|
+
}), {
|
|
991
|
+
walkMode: visitors_1.WalkMode.visitStatements
|
|
992
|
+
});
|
|
947
993
|
}
|
|
948
|
-
const statementHandler = (statement) => {
|
|
949
|
-
if (statement.getName(this.parseMode).toLowerCase() === textToSearchFor) {
|
|
950
|
-
const uri = util_1.util.pathToUri(file.srcPath);
|
|
951
|
-
results.push(util_1.util.createLocation(uri, statement.range));
|
|
952
|
-
}
|
|
953
|
-
};
|
|
954
|
-
file.parser.ast.walk((0, visitors_1.createVisitor)({
|
|
955
|
-
FunctionStatement: statementHandler
|
|
956
|
-
}), {
|
|
957
|
-
walkMode: visitors_1.WalkMode.visitStatements
|
|
958
|
-
});
|
|
959
994
|
}
|
|
960
995
|
}
|
|
961
996
|
return results;
|
|
@@ -1017,28 +1052,47 @@ class BrsFile {
|
|
|
1017
1052
|
for (const scope of scopes) {
|
|
1018
1053
|
const processedFiles = new Set();
|
|
1019
1054
|
for (const file of scope.getAllFiles()) {
|
|
1020
|
-
if ((0, reflection_1.
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
locations.push(util_1.util.createLocation(util_1.util.pathToUri(file.srcPath), e.range));
|
|
1055
|
+
if ((0, reflection_1.isBrsFile)(file) && !processedFiles.has(file)) {
|
|
1056
|
+
processedFiles.add(file);
|
|
1057
|
+
file.ast.walk((0, visitors_1.createVisitor)({
|
|
1058
|
+
VariableExpression: (e) => {
|
|
1059
|
+
if (e.name.text.toLowerCase() === searchFor) {
|
|
1060
|
+
locations.push(util_1.util.createLocation(util_1.util.pathToUri(file.srcPath), e.range));
|
|
1061
|
+
}
|
|
1028
1062
|
}
|
|
1029
|
-
}
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
}
|
|
1063
|
+
}), {
|
|
1064
|
+
walkMode: visitors_1.WalkMode.visitExpressionsRecursive
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1033
1067
|
}
|
|
1034
1068
|
}
|
|
1035
1069
|
return locations;
|
|
1036
1070
|
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Generate the code, map, and typedef for this file
|
|
1073
|
+
*/
|
|
1074
|
+
serialize() {
|
|
1075
|
+
const result = {};
|
|
1076
|
+
const transpiled = this.transpile();
|
|
1077
|
+
if (typeof transpiled.code === 'string') {
|
|
1078
|
+
result.code = transpiled.code;
|
|
1079
|
+
}
|
|
1080
|
+
if (transpiled.map) {
|
|
1081
|
+
result.map = transpiled.map.toString();
|
|
1082
|
+
}
|
|
1083
|
+
//generate the typedef (if this is not a typedef itself, and if enabled)
|
|
1084
|
+
if (!this.isTypedef && this.program.options.emitDefinitions) {
|
|
1085
|
+
result.typedef = this.getTypedef();
|
|
1086
|
+
}
|
|
1087
|
+
return result;
|
|
1088
|
+
}
|
|
1037
1089
|
/**
|
|
1038
1090
|
* Convert the brightscript/brighterscript source code into valid brightscript
|
|
1039
1091
|
*/
|
|
1040
1092
|
transpile() {
|
|
1093
|
+
var _a;
|
|
1041
1094
|
const state = new BrsTranspileState_1.BrsTranspileState(this);
|
|
1095
|
+
state.editor = (_a = this.editor) !== null && _a !== void 0 ? _a : new Editor_1.Editor();
|
|
1042
1096
|
let transpileResult;
|
|
1043
1097
|
if (this.needsTranspiled) {
|
|
1044
1098
|
transpileResult = new source_map_1.SourceNode(null, null, state.srcPath, this.ast.transpile(state));
|
|
@@ -1051,8 +1105,11 @@ class BrsFile {
|
|
|
1051
1105
|
//simple SourceNode wrapping the entire file to simplify the logic below
|
|
1052
1106
|
transpileResult = new source_map_1.SourceNode(null, null, state.srcPath, this.fileContents);
|
|
1053
1107
|
}
|
|
1054
|
-
//
|
|
1055
|
-
|
|
1108
|
+
//if we created an editor for this flow, undo the edits now
|
|
1109
|
+
if (!this.editor) {
|
|
1110
|
+
//undo any AST edits that the transpile cycle has made
|
|
1111
|
+
state.editor.undoAll();
|
|
1112
|
+
}
|
|
1056
1113
|
if (this.program.options.sourceMap) {
|
|
1057
1114
|
return new source_map_1.SourceNode(null, null, null, [
|
|
1058
1115
|
transpileResult,
|
|
@@ -1067,6 +1124,201 @@ class BrsFile {
|
|
|
1067
1124
|
};
|
|
1068
1125
|
}
|
|
1069
1126
|
}
|
|
1127
|
+
processSymbolInformation() {
|
|
1128
|
+
this.validationSegmenter.processTree(this.ast);
|
|
1129
|
+
this.program.addFileSymbolInfo(this);
|
|
1130
|
+
}
|
|
1131
|
+
getValidationSegments(changedSymbols) {
|
|
1132
|
+
const segments = this.validationSegmenter.getSegments(changedSymbols);
|
|
1133
|
+
return segments;
|
|
1134
|
+
}
|
|
1135
|
+
get requiredSymbols() {
|
|
1136
|
+
return this.cache.getOrAdd(`requiredSymbols`, () => {
|
|
1137
|
+
var _a;
|
|
1138
|
+
const allNeededSymbolSets = this.validationSegmenter.unresolvedSegmentsSymbols.values();
|
|
1139
|
+
const requiredSymbols = [];
|
|
1140
|
+
const addedSymbols = new Map();
|
|
1141
|
+
addedSymbols.set(SymbolTable_1.SymbolTypeFlag.runtime, new Set());
|
|
1142
|
+
addedSymbols.set(SymbolTable_1.SymbolTypeFlag.typetime, new Set());
|
|
1143
|
+
for (const setOfSymbols of allNeededSymbolSets) {
|
|
1144
|
+
for (const symbol of setOfSymbols) {
|
|
1145
|
+
const fullSymbolKey = symbol.typeChain.map(tce => tce.name).join('.').toLowerCase();
|
|
1146
|
+
if ((_a = this.providedSymbols.symbolMap.get(symbol.flags)) === null || _a === void 0 ? void 0 : _a.has(fullSymbolKey)) {
|
|
1147
|
+
// this catches namespaced things
|
|
1148
|
+
continue;
|
|
1149
|
+
}
|
|
1150
|
+
if (!addedSymbols.get(symbol.flags).has(fullSymbolKey)) {
|
|
1151
|
+
requiredSymbols.push(symbol);
|
|
1152
|
+
addedSymbols.get(symbol.flags).add(fullSymbolKey);
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
return requiredSymbols;
|
|
1157
|
+
});
|
|
1158
|
+
}
|
|
1159
|
+
get providedSymbols() {
|
|
1160
|
+
var _a;
|
|
1161
|
+
return (_a = this.cache) === null || _a === void 0 ? void 0 : _a.getOrAdd(`providedSymbols`, () => {
|
|
1162
|
+
return this.getProvidedSymbols();
|
|
1163
|
+
});
|
|
1164
|
+
}
|
|
1165
|
+
getProvidedSymbols() {
|
|
1166
|
+
var _a, _b;
|
|
1167
|
+
const symbolMap = new Map();
|
|
1168
|
+
const runTimeSymbolMap = new Map();
|
|
1169
|
+
const typeTimeSymbolMap = new Map();
|
|
1170
|
+
const tablesToGetSymbolsFrom = [{
|
|
1171
|
+
table: this.parser.symbolTable
|
|
1172
|
+
}];
|
|
1173
|
+
for (const namespaceStatement of this.parser.references.namespaceStatements) {
|
|
1174
|
+
tablesToGetSymbolsFrom.push({
|
|
1175
|
+
table: namespaceStatement.body.getSymbolTable(),
|
|
1176
|
+
namePrefixLower: namespaceStatement.getName(Parser_1.ParseMode.BrighterScript).toLowerCase()
|
|
1177
|
+
});
|
|
1178
|
+
}
|
|
1179
|
+
for (const symbolTable of tablesToGetSymbolsFrom) {
|
|
1180
|
+
const runTimeSymbols = symbolTable.table.getOwnSymbols(SymbolTable_1.SymbolTypeFlag.runtime);
|
|
1181
|
+
const typeTimeSymbols = symbolTable.table.getOwnSymbols(SymbolTable_1.SymbolTypeFlag.typetime);
|
|
1182
|
+
for (const symbol of runTimeSymbols) {
|
|
1183
|
+
if (!(0, reflection_1.isAnyReferenceType)(symbol.type)) {
|
|
1184
|
+
const symbolNameLower = symbolTable.namePrefixLower
|
|
1185
|
+
? `${symbolTable.namePrefixLower}.${symbol.name.toLowerCase()}`
|
|
1186
|
+
: symbol.name.toLowerCase();
|
|
1187
|
+
runTimeSymbolMap.set(symbolNameLower, symbol);
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
for (const symbol of typeTimeSymbols) {
|
|
1191
|
+
if (!(0, reflection_1.isAnyReferenceType)(symbol.type)) {
|
|
1192
|
+
const symbolNameLower = symbolTable.namePrefixLower
|
|
1193
|
+
? `${symbolTable.namePrefixLower}.${symbol.name.toLowerCase()}`
|
|
1194
|
+
: symbol.name.toLowerCase();
|
|
1195
|
+
typeTimeSymbolMap.set(symbolNameLower, symbol);
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
symbolMap.set(SymbolTable_1.SymbolTypeFlag.runtime, runTimeSymbolMap);
|
|
1200
|
+
symbolMap.set(SymbolTable_1.SymbolTypeFlag.typetime, typeTimeSymbolMap);
|
|
1201
|
+
const changes = new Map();
|
|
1202
|
+
changes.set(SymbolTable_1.SymbolTypeFlag.runtime, new Set());
|
|
1203
|
+
changes.set(SymbolTable_1.SymbolTypeFlag.typetime, new Set());
|
|
1204
|
+
const previouslyProvidedSymbols = (_a = this.program.getFileSymbolInfo(this)) === null || _a === void 0 ? void 0 : _a.provides.symbolMap;
|
|
1205
|
+
const previousSymbolsChecked = new Map();
|
|
1206
|
+
previousSymbolsChecked.set(SymbolTable_1.SymbolTypeFlag.runtime, new Set());
|
|
1207
|
+
previousSymbolsChecked.set(SymbolTable_1.SymbolTypeFlag.typetime, new Set());
|
|
1208
|
+
for (const flag of [SymbolTable_1.SymbolTypeFlag.runtime, SymbolTable_1.SymbolTypeFlag.typetime]) {
|
|
1209
|
+
const newSymbolMapForFlag = symbolMap.get(flag);
|
|
1210
|
+
const oldSymbolMapForFlag = previouslyProvidedSymbols === null || previouslyProvidedSymbols === void 0 ? void 0 : previouslyProvidedSymbols.get(flag);
|
|
1211
|
+
const previousSymbolsCheckedForFlag = previousSymbolsChecked.get(flag);
|
|
1212
|
+
const changesForFlag = changes.get(flag);
|
|
1213
|
+
if (!oldSymbolMapForFlag) {
|
|
1214
|
+
for (const key of newSymbolMapForFlag.keys()) {
|
|
1215
|
+
changesForFlag.add(key);
|
|
1216
|
+
}
|
|
1217
|
+
continue;
|
|
1218
|
+
}
|
|
1219
|
+
for (const [symbolKey, symbol] of newSymbolMapForFlag) {
|
|
1220
|
+
const symbolType = symbol.type;
|
|
1221
|
+
const previousType = (_b = oldSymbolMapForFlag === null || oldSymbolMapForFlag === void 0 ? void 0 : oldSymbolMapForFlag.get(symbolKey)) === null || _b === void 0 ? void 0 : _b.type;
|
|
1222
|
+
previousSymbolsCheckedForFlag.add(symbolKey);
|
|
1223
|
+
if (!previousType) {
|
|
1224
|
+
changesForFlag.add(symbolKey);
|
|
1225
|
+
continue;
|
|
1226
|
+
}
|
|
1227
|
+
const data = {};
|
|
1228
|
+
if (!symbolType.isEqual(previousType, data)) {
|
|
1229
|
+
changesForFlag.add(symbolKey);
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
for (const [symbolKey] of previouslyProvidedSymbols.get(flag)) {
|
|
1233
|
+
if (!previousSymbolsCheckedForFlag.has(symbolKey)) {
|
|
1234
|
+
changesForFlag.add(symbolKey);
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
return {
|
|
1239
|
+
symbolMap: symbolMap,
|
|
1240
|
+
changes: changes
|
|
1241
|
+
};
|
|
1242
|
+
}
|
|
1243
|
+
markSegmentAsValidated(node) {
|
|
1244
|
+
this.validationSegmenter.markSegmentAsValidated(node);
|
|
1245
|
+
}
|
|
1246
|
+
getNamespaceLookupObject() {
|
|
1247
|
+
if (!this.isValidated) {
|
|
1248
|
+
return this.buildNamespaceLookup();
|
|
1249
|
+
}
|
|
1250
|
+
return this.cache.getOrAdd(`namespaceLookup`, () => {
|
|
1251
|
+
const nsLookup = this.buildNamespaceLookup();
|
|
1252
|
+
return nsLookup;
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
buildNamespaceLookup() {
|
|
1256
|
+
const namespaceLookup = new Map();
|
|
1257
|
+
for (let namespaceStatement of this.parser.references.namespaceStatements) {
|
|
1258
|
+
let nameParts = namespaceStatement.getNameParts();
|
|
1259
|
+
let loopName = null;
|
|
1260
|
+
let lowerLoopName = null;
|
|
1261
|
+
let parentNameLower = null;
|
|
1262
|
+
//ensure each namespace section is represented in the results
|
|
1263
|
+
//(so if the namespace name is A.B.C, this will make an entry for "A", an entry for "A.B", and an entry for "A.B.C"
|
|
1264
|
+
for (let i = 0; i < nameParts.length; i++) {
|
|
1265
|
+
let part = nameParts[i];
|
|
1266
|
+
let lowerPartName = part.text.toLowerCase();
|
|
1267
|
+
if (i === 0) {
|
|
1268
|
+
loopName = part.text;
|
|
1269
|
+
lowerLoopName = lowerPartName;
|
|
1270
|
+
}
|
|
1271
|
+
else {
|
|
1272
|
+
parentNameLower = lowerLoopName;
|
|
1273
|
+
loopName += '.' + part.text;
|
|
1274
|
+
lowerLoopName += '.' + lowerPartName;
|
|
1275
|
+
}
|
|
1276
|
+
if (!namespaceLookup.has(lowerLoopName)) {
|
|
1277
|
+
namespaceLookup.set(lowerLoopName, {
|
|
1278
|
+
isTopLevel: i === 0,
|
|
1279
|
+
file: this,
|
|
1280
|
+
fullName: loopName,
|
|
1281
|
+
fullNameLower: lowerLoopName,
|
|
1282
|
+
parentNameLower: parentNameLower,
|
|
1283
|
+
nameParts: nameParts.slice(0, i),
|
|
1284
|
+
nameRange: namespaceStatement.nameExpression.range,
|
|
1285
|
+
lastPartName: part.text,
|
|
1286
|
+
lastPartNameLower: lowerPartName,
|
|
1287
|
+
functionStatements: new Map(),
|
|
1288
|
+
namespaceStatements: [],
|
|
1289
|
+
namespaces: new Map(),
|
|
1290
|
+
classStatements: new Map(),
|
|
1291
|
+
enumStatements: new Map(),
|
|
1292
|
+
constStatements: new Map(),
|
|
1293
|
+
statements: [],
|
|
1294
|
+
// the aggregate symbol table should have no parent. It should include just the symbols of the namespace.
|
|
1295
|
+
symbolTable: new SymbolTable_1.SymbolTable(`Namespace Aggregate: '${loopName}'`)
|
|
1296
|
+
});
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
let ns = namespaceLookup.get(lowerLoopName);
|
|
1300
|
+
ns.namespaceStatements.push(namespaceStatement);
|
|
1301
|
+
ns.statements.push(...namespaceStatement.body.statements);
|
|
1302
|
+
for (let statement of namespaceStatement.body.statements) {
|
|
1303
|
+
if ((0, reflection_1.isClassStatement)(statement) && statement.name) {
|
|
1304
|
+
ns.classStatements.set(statement.name.text.toLowerCase(), statement);
|
|
1305
|
+
}
|
|
1306
|
+
else if ((0, reflection_1.isFunctionStatement)(statement) && statement.name) {
|
|
1307
|
+
ns.functionStatements.set(statement.name.text.toLowerCase(), statement);
|
|
1308
|
+
}
|
|
1309
|
+
else if ((0, reflection_1.isEnumStatement)(statement) && statement.fullName) {
|
|
1310
|
+
ns.enumStatements.set(statement.fullName.toLowerCase(), statement);
|
|
1311
|
+
}
|
|
1312
|
+
else if ((0, reflection_1.isConstStatement)(statement) && statement.fullName) {
|
|
1313
|
+
ns.constStatements.set(statement.fullName.toLowerCase(), statement);
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
// Merges all the symbol tables of the namespace statements into the new symbol table created above.
|
|
1317
|
+
// Set those symbol tables to have this new merged table as a parent
|
|
1318
|
+
ns.symbolTable.mergeSymbolTable(namespaceStatement.body.getSymbolTable());
|
|
1319
|
+
}
|
|
1320
|
+
return namespaceLookup;
|
|
1321
|
+
}
|
|
1070
1322
|
getTypedef() {
|
|
1071
1323
|
const state = new BrsTranspileState_1.BrsTranspileState(this);
|
|
1072
1324
|
const typedef = this.ast.getTypedef(state);
|
|
@@ -1074,10 +1326,8 @@ class BrsFile {
|
|
|
1074
1326
|
return programNode.toString();
|
|
1075
1327
|
}
|
|
1076
1328
|
dispose() {
|
|
1077
|
-
var _a
|
|
1329
|
+
var _a;
|
|
1078
1330
|
(_a = this._parser) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
1079
|
-
//unsubscribe from any DependencyGraph subscriptions
|
|
1080
|
-
(_b = this.unsubscribeFromDependencyGraph) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
1081
1331
|
//deleting these properties result in lower memory usage (garbage collection is magic!)
|
|
1082
1332
|
delete this.fileContents;
|
|
1083
1333
|
delete this._parser;
|