brighterscript 1.0.0-alpha.27 → 1.0.0-alpha.29
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 +71 -0
- package/README.md +1 -1
- package/dist/AstValidationSegmenter.d.ts +12 -2
- package/dist/AstValidationSegmenter.js +74 -16
- package/dist/AstValidationSegmenter.js.map +1 -1
- package/dist/DependencyGraph.d.ts +4 -0
- package/dist/DependencyGraph.js +19 -0
- package/dist/DependencyGraph.js.map +1 -1
- package/dist/DiagnosticFilterer.d.ts +7 -4
- package/dist/DiagnosticFilterer.js +67 -37
- package/dist/DiagnosticFilterer.js.map +1 -1
- package/dist/DiagnosticMessages.d.ts +1 -1
- package/dist/PluginInterface.js +1 -1
- package/dist/PluginInterface.js.map +1 -1
- package/dist/Program.d.ts +19 -15
- package/dist/Program.js +153 -88
- package/dist/Program.js.map +1 -1
- package/dist/Scope.d.ts +27 -28
- package/dist/Scope.js +174 -361
- package/dist/Scope.js.map +1 -1
- package/dist/Stopwatch.d.ts +4 -0
- package/dist/Stopwatch.js +7 -0
- package/dist/Stopwatch.js.map +1 -1
- package/dist/SymbolTable.d.ts +2 -1
- package/dist/SymbolTable.js +26 -0
- package/dist/SymbolTable.js.map +1 -1
- package/dist/{SymbolTableFlag.js → SymbolTypeFlag.js} +1 -1
- package/dist/SymbolTypeFlag.js.map +1 -0
- package/dist/XmlScope.d.ts +0 -8
- package/dist/XmlScope.js +0 -77
- package/dist/XmlScope.js.map +1 -1
- package/dist/astUtils/CachedLookups.js +4 -8
- package/dist/astUtils/CachedLookups.js.map +1 -1
- package/dist/astUtils/creators.d.ts +1 -0
- package/dist/astUtils/creators.js +3 -2
- 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 +4 -4
- package/dist/astUtils/reflection.js +8 -7
- package/dist/astUtils/reflection.js.map +1 -1
- package/dist/astUtils/reflection.spec.js +10 -15
- package/dist/astUtils/reflection.spec.js.map +1 -1
- package/dist/astUtils/visitors.d.ts +1 -2
- package/dist/astUtils/visitors.js.map +1 -1
- package/dist/astUtils/visitors.spec.js +1 -5
- package/dist/astUtils/visitors.spec.js.map +1 -1
- package/dist/bscPlugin/BscPlugin.d.ts +3 -1
- package/dist/bscPlugin/BscPlugin.js +10 -0
- package/dist/bscPlugin/BscPlugin.js.map +1 -1
- package/dist/bscPlugin/SignatureHelpUtil.js +4 -3
- package/dist/bscPlugin/SignatureHelpUtil.js.map +1 -1
- package/dist/bscPlugin/completions/CompletionsProcessor.d.ts +1 -0
- package/dist/bscPlugin/completions/CompletionsProcessor.js +31 -11
- package/dist/bscPlugin/completions/CompletionsProcessor.js.map +1 -1
- package/dist/bscPlugin/completions/CompletionsProcessor.spec.js +39 -0
- package/dist/bscPlugin/completions/CompletionsProcessor.spec.js.map +1 -1
- package/dist/bscPlugin/hover/HoverProcessor.js +5 -5
- package/dist/bscPlugin/hover/HoverProcessor.js.map +1 -1
- package/dist/bscPlugin/hover/HoverProcessor.spec.js +51 -5
- 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.d.ts +1 -0
- package/dist/bscPlugin/references/ReferencesProvider.spec.js +51 -0
- package/dist/bscPlugin/references/ReferencesProvider.spec.js.map +1 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js +1 -1
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js.map +1 -1
- package/dist/bscPlugin/validation/BrsFileAfterValidatior.d.ts +7 -0
- package/dist/bscPlugin/validation/BrsFileAfterValidatior.js +18 -0
- package/dist/bscPlugin/validation/BrsFileAfterValidatior.js.map +1 -0
- package/dist/bscPlugin/validation/BrsFileValidator.d.ts +1 -0
- package/dist/bscPlugin/validation/BrsFileValidator.js +17 -10
- package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -1
- package/dist/bscPlugin/validation/ScopeValidator.d.ts +37 -1
- package/dist/bscPlugin/validation/ScopeValidator.js +434 -25
- package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -1
- package/dist/bscPlugin/validation/ScopeValidator.spec.js +91 -4
- package/dist/bscPlugin/validation/ScopeValidator.spec.js.map +1 -1
- package/dist/files/BrsFile.Class.spec.js +11 -4
- package/dist/files/BrsFile.Class.spec.js.map +1 -1
- package/dist/files/BrsFile.d.ts +23 -5
- package/dist/files/BrsFile.js +189 -51
- package/dist/files/BrsFile.js.map +1 -1
- package/dist/files/BrsFile.spec.js +589 -97
- package/dist/files/BrsFile.spec.js.map +1 -1
- package/dist/files/BscFile.d.ts +2 -1
- package/dist/files/BscFile.js.map +1 -1
- package/dist/files/XmlFile.d.ts +2 -2
- package/dist/files/XmlFile.js +2 -2
- package/dist/files/XmlFile.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +43 -4
- package/dist/interfaces.js.map +1 -1
- package/dist/lexer/Lexer.d.ts +9 -3
- package/dist/lexer/Lexer.js +36 -15
- package/dist/lexer/Lexer.js.map +1 -1
- package/dist/lexer/Lexer.spec.js +76 -38
- package/dist/lexer/Lexer.spec.js.map +1 -1
- package/dist/lexer/Token.js +1 -1
- package/dist/lexer/Token.js.map +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 +1 -2
- package/dist/parser/AstNode.js +0 -1
- package/dist/parser/AstNode.js.map +1 -1
- package/dist/parser/BrsTranspileState.d.ts +1 -1
- package/dist/parser/Expression.d.ts +77 -47
- package/dist/parser/Expression.js +162 -88
- package/dist/parser/Expression.js.map +1 -1
- package/dist/parser/Parser.d.ts +7 -2
- package/dist/parser/Parser.js +40 -90
- package/dist/parser/Parser.js.map +1 -1
- package/dist/parser/Parser.spec.js +21 -44
- package/dist/parser/Parser.spec.js.map +1 -1
- package/dist/parser/SGTypes.js +5 -5
- package/dist/parser/SGTypes.js.map +1 -1
- package/dist/parser/Statement.d.ts +92 -84
- package/dist/parser/Statement.js +199 -133
- package/dist/parser/Statement.js.map +1 -1
- package/dist/parser/Statement.spec.js +0 -13
- package/dist/parser/Statement.spec.js.map +1 -1
- package/dist/parser/TranspileState.d.ts +17 -8
- package/dist/parser/TranspileState.js +67 -8
- package/dist/parser/TranspileState.js.map +1 -1
- package/dist/parser/tests/Parser.spec.d.ts +1 -1
- package/dist/parser/tests/Parser.spec.js +1 -2
- package/dist/parser/tests/Parser.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/If.spec.js +1 -1
- package/dist/parser/tests/controlFlow/If.spec.js.map +1 -1
- package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js +1 -3
- package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js.map +1 -1
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +44 -0
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js +6 -6
- package/dist/parser/tests/expression/TernaryExpression.spec.js +47 -0
- package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
- package/dist/parser/tests/statement/ConstStatement.spec.js +2 -2
- package/dist/parser/tests/statement/InterfaceStatement.spec.js +8 -1
- package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/Misc.spec.js +25 -5
- package/dist/parser/tests/statement/Misc.spec.js.map +1 -1
- package/dist/preprocessor/Chunk.js +1 -2
- package/dist/preprocessor/Chunk.js.map +1 -1
- package/dist/preprocessor/PreprocessorParser.js +2 -1
- package/dist/preprocessor/PreprocessorParser.js.map +1 -1
- package/dist/types/AssociativeArrayType.d.ts +3 -0
- package/dist/types/AssociativeArrayType.js +9 -0
- package/dist/types/AssociativeArrayType.js.map +1 -1
- package/dist/types/BscType.d.ts +1 -1
- package/dist/types/BscType.js +1 -0
- package/dist/types/BscType.js.map +1 -1
- package/dist/types/ComponentType.d.ts +1 -1
- package/dist/types/ReferenceType.d.ts +9 -1
- package/dist/types/ReferenceType.js +45 -1
- package/dist/types/ReferenceType.js.map +1 -1
- package/dist/types/ReferenceType.spec.js +15 -0
- package/dist/types/ReferenceType.spec.js.map +1 -1
- package/dist/util.d.ts +23 -9
- package/dist/util.js +115 -21
- package/dist/util.js.map +1 -1
- package/package.json +6 -3
- package/dist/SymbolTableFlag.js.map +0 -1
- /package/dist/{SymbolTableFlag.d.ts → SymbolTypeFlag.d.ts} +0 -0
package/dist/Scope.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import type { CallableContainer, BsDiagnosticWithOrigin,
|
|
1
|
+
import type { CallableContainer, BsDiagnosticWithOrigin, FileReference, FileLink, Callable, NamespaceContainer, ScopeValidationOptions, BsDiagnostic } from './interfaces';
|
|
2
2
|
import type { Program } from './Program';
|
|
3
|
-
import type
|
|
3
|
+
import { type NamespaceStatement, type ClassStatement, type EnumStatement, type InterfaceStatement, type EnumMemberStatement, type ConstStatement } from './parser/Statement';
|
|
4
4
|
import { Cache } from './Cache';
|
|
5
5
|
import type { BrsFile } from './files/BrsFile';
|
|
6
6
|
import type { DependencyGraph, DependencyChangedEvent } from './DependencyGraph';
|
|
7
7
|
import { SymbolTable } from './SymbolTable';
|
|
8
8
|
import type { BscFile } from './files/BscFile';
|
|
9
9
|
import type { AstNode, Statement } from './parser/AstNode';
|
|
10
|
-
import type { Token } from './lexer/Token';
|
|
11
10
|
/**
|
|
12
11
|
* A class to keep track of all declarations within a given scope (like source scope, component scope)
|
|
13
12
|
*/
|
|
@@ -37,6 +36,10 @@ export declare class Scope {
|
|
|
37
36
|
* Get a NamespaceContainer by its name, looking for a fully qualified version first, then global version next if not found
|
|
38
37
|
*/
|
|
39
38
|
getNamespacesWithRoot(rootName: string, containingNamespace?: string): NamespaceContainer[];
|
|
39
|
+
/**
|
|
40
|
+
* Get a NamespaceContainer by its name, looking for a fully qualified version first, then global version next if not found
|
|
41
|
+
*/
|
|
42
|
+
getFirstNamespaceWithRoot(rootName: string, containingNamespace?: string): NamespaceContainer;
|
|
40
43
|
/**
|
|
41
44
|
* Get the class with the specified name.
|
|
42
45
|
* @param className - The class name, including the namespace of the class if possible
|
|
@@ -55,6 +58,8 @@ export declare class Scope {
|
|
|
55
58
|
* @param containingNamespace - The namespace used to resolve relative enum names. (i.e. the namespace around the current statement trying to find an enum)
|
|
56
59
|
*/
|
|
57
60
|
getEnum(enumName: string, containingNamespace?: string): EnumStatement;
|
|
61
|
+
private useFileCachesForFileLinkLookups;
|
|
62
|
+
private getFileLinkFromFileMap;
|
|
58
63
|
/**
|
|
59
64
|
* Get a class and its containing file by the class name
|
|
60
65
|
* @param className - The class name, including the namespace of the class if possible
|
|
@@ -85,7 +90,7 @@ export declare class Scope {
|
|
|
85
90
|
* @param containingNamespace - The namespace used to resolve relative constant names. (i.e. the namespace around the current statement trying to find a constant)
|
|
86
91
|
*/
|
|
87
92
|
getConstFileLink(constName: string, containingNamespace?: string): FileLink<ConstStatement>;
|
|
88
|
-
getAllFileLinks(name: string, containingNamespace?: string): FileLink<Statement>[];
|
|
93
|
+
getAllFileLinks(name: string, containingNamespace?: string, includeNamespaces?: boolean, includeNameShadowsOutsideNamespace?: boolean): FileLink<Statement>[];
|
|
89
94
|
/**
|
|
90
95
|
* Get a map of all enums by their member name.
|
|
91
96
|
* The keys are lower-case fully-qualified paths to the enum and its member. For example:
|
|
@@ -172,6 +177,10 @@ export declare class Scope {
|
|
|
172
177
|
* Includes files from this scope and all ancestor scopes
|
|
173
178
|
*/
|
|
174
179
|
getAllFiles(): BscFile[];
|
|
180
|
+
/**
|
|
181
|
+
* Gets a list of all files in this scope, but not imported files, and not from ancestor scopes
|
|
182
|
+
*/
|
|
183
|
+
getImmediateFiles(): BscFile[];
|
|
175
184
|
/**
|
|
176
185
|
* Get the list of errors for this scope. It's calculated on the fly, so call this sparingly.
|
|
177
186
|
*/
|
|
@@ -187,10 +196,15 @@ export declare class Scope {
|
|
|
187
196
|
*/
|
|
188
197
|
getCallableByName(name: string): Callable;
|
|
189
198
|
getCallableMap(): Map<string, Callable>;
|
|
199
|
+
getCallableContainerMap(): import("./interfaces").CallableContainerMap;
|
|
190
200
|
/**
|
|
191
201
|
* Iterate over Brs files not shadowed by typedefs
|
|
192
202
|
*/
|
|
193
203
|
enumerateBrsFiles(callback: (file: BrsFile) => void): void;
|
|
204
|
+
/**
|
|
205
|
+
* Iterate over Brs files not shadowed by typedefs
|
|
206
|
+
*/
|
|
207
|
+
enumerateBrsFilesWithBreak(callback: (file: BrsFile) => boolean): void;
|
|
194
208
|
/**
|
|
195
209
|
* Call a function for each file directly included in this scope (excluding files found only in parent scopes).
|
|
196
210
|
*/
|
|
@@ -209,8 +223,11 @@ export declare class Scope {
|
|
|
209
223
|
getAllNamespaceStatements(): NamespaceStatement[];
|
|
210
224
|
protected logDebug(...args: any[]): void;
|
|
211
225
|
private _debugLogComponentName;
|
|
212
|
-
|
|
213
|
-
|
|
226
|
+
validationMetrics: {
|
|
227
|
+
linkTime: number;
|
|
228
|
+
validationTime: number;
|
|
229
|
+
};
|
|
230
|
+
validate(validationOptions?: ScopeValidationOptions): boolean;
|
|
214
231
|
clearAstSegmentDiagnostics(astSegment: AstNode): void;
|
|
215
232
|
clearAstSegmentDiagnosticsByFile(file: BscFile): void;
|
|
216
233
|
clearScopeLevelDiagnostics(): void;
|
|
@@ -224,6 +241,8 @@ export declare class Scope {
|
|
|
224
241
|
*/
|
|
225
242
|
private linkSymbolTableDisposables;
|
|
226
243
|
private symbolsAddedDuringLinking;
|
|
244
|
+
get allNamespaceTypeTable(): SymbolTable;
|
|
245
|
+
private _allNamespaceTypeTable;
|
|
227
246
|
/**
|
|
228
247
|
* Builds the current symbol table for the scope, by merging the tables for all the files in this scope.
|
|
229
248
|
* Also links all file symbols tables to this new table
|
|
@@ -245,34 +264,14 @@ export declare class Scope {
|
|
|
245
264
|
*/
|
|
246
265
|
linkSymbolTable(): void;
|
|
247
266
|
unlinkSymbolTable(): void;
|
|
248
|
-
private detectVariableNamespaceCollisions;
|
|
249
|
-
/**
|
|
250
|
-
* Find various function collisions
|
|
251
|
-
*/
|
|
252
|
-
private diagnosticDetectFunctionCollisions;
|
|
253
|
-
private detectNameCollisions;
|
|
254
|
-
validateNameCollision(file: BrsFile, node: AstNode, nameIdentifier: Token): void;
|
|
255
|
-
private validateClasses;
|
|
256
|
-
/**
|
|
257
|
-
* Detect local variables (function scope) that have the same name as scope calls
|
|
258
|
-
*/
|
|
259
|
-
private diagnosticDetectShadowedLocalVars;
|
|
260
|
-
/**
|
|
261
|
-
* Create diagnostics for any duplicate function declarations
|
|
262
|
-
*/
|
|
263
|
-
private diagnosticFindDuplicateFunctionDeclarations;
|
|
264
267
|
/**
|
|
265
268
|
* Get the list of all script imports for this scope
|
|
266
269
|
*/
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Verify that all of the scripts imported by each file in this scope actually exist
|
|
270
|
-
*/
|
|
271
|
-
private diagnosticValidateScriptImportPaths;
|
|
270
|
+
getOwnScriptImports(): FileReference[];
|
|
272
271
|
/**
|
|
273
272
|
* Find the file with the specified relative path
|
|
274
273
|
*/
|
|
275
|
-
|
|
274
|
+
getFileByRelativePath(relativePath: string): BscFile;
|
|
276
275
|
/**
|
|
277
276
|
* Determine if this file is included in this scope (excluding parent scopes)
|
|
278
277
|
*/
|