brighterscript 1.0.0-alpha.25 → 1.0.0-alpha.27
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 +44 -0
- package/bsconfig.schema.json +5 -0
- package/dist/AstValidationSegmenter.d.ts +1 -1
- package/dist/AstValidationSegmenter.js +6 -7
- package/dist/AstValidationSegmenter.js.map +1 -1
- package/dist/BsConfig.d.ts +1 -0
- package/dist/DiagnosticMessages.d.ts +1 -3
- package/dist/DiagnosticMessages.js +5 -8
- package/dist/DiagnosticMessages.js.map +1 -1
- package/dist/Program.d.ts +1 -1
- package/dist/Program.js +40 -42
- package/dist/Program.js.map +1 -1
- package/dist/Scope.d.ts +2 -13
- package/dist/Scope.js +27 -35
- package/dist/Scope.js.map +1 -1
- package/dist/SymbolTable.d.ts +1 -8
- package/dist/SymbolTable.js +1 -10
- package/dist/SymbolTable.js.map +1 -1
- package/dist/SymbolTableFlag.d.ts +8 -0
- package/dist/SymbolTableFlag.js +13 -0
- package/dist/SymbolTableFlag.js.map +1 -0
- package/dist/XmlScope.d.ts +1 -6
- package/dist/XmlScope.js +6 -25
- package/dist/XmlScope.js.map +1 -1
- package/dist/astUtils/CachedLookups.d.ts +1 -2
- package/dist/astUtils/CachedLookups.js +3 -14
- package/dist/astUtils/CachedLookups.js.map +1 -1
- package/dist/astUtils/Editor.spec.js +1 -1
- package/dist/astUtils/Editor.spec.js.map +1 -1
- package/dist/astUtils/creators.js +77 -18
- package/dist/astUtils/creators.js.map +1 -1
- package/dist/astUtils/creators.spec.js +4 -4
- package/dist/astUtils/creators.spec.js.map +1 -1
- package/dist/astUtils/reflection.d.ts +3 -1
- package/dist/astUtils/reflection.js +12 -4
- package/dist/astUtils/reflection.js.map +1 -1
- package/dist/astUtils/reflection.spec.js +59 -42
- package/dist/astUtils/reflection.spec.js.map +1 -1
- package/dist/astUtils/visitors.spec.js +30 -19
- package/dist/astUtils/visitors.spec.js.map +1 -1
- package/dist/bscPlugin/BscPlugin.d.ts +2 -1
- package/dist/bscPlugin/BscPlugin.js +7 -3
- package/dist/bscPlugin/BscPlugin.js.map +1 -1
- package/dist/bscPlugin/CallExpressionInfo.js +7 -7
- package/dist/bscPlugin/CallExpressionInfo.js.map +1 -1
- package/dist/bscPlugin/SignatureHelpUtil.js +5 -4
- package/dist/bscPlugin/SignatureHelpUtil.js.map +1 -1
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +2 -2
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
- package/dist/bscPlugin/completions/CompletionsProcessor.js +23 -23
- package/dist/bscPlugin/completions/CompletionsProcessor.js.map +1 -1
- package/dist/bscPlugin/definition/DefinitionProvider.d.ts +13 -0
- package/dist/bscPlugin/definition/DefinitionProvider.js +210 -0
- package/dist/bscPlugin/definition/DefinitionProvider.js.map +1 -0
- package/dist/bscPlugin/definition/DefinitionProvider.spec.d.ts +1 -0
- package/dist/bscPlugin/definition/DefinitionProvider.spec.js +88 -0
- package/dist/bscPlugin/definition/DefinitionProvider.spec.js.map +1 -0
- package/dist/bscPlugin/hover/HoverProcessor.d.ts +1 -0
- package/dist/bscPlugin/hover/HoverProcessor.js +28 -8
- package/dist/bscPlugin/hover/HoverProcessor.js.map +1 -1
- package/dist/bscPlugin/hover/HoverProcessor.spec.js +74 -2
- package/dist/bscPlugin/hover/HoverProcessor.spec.js.map +1 -1
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +2 -5
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -1
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js +8 -6
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js.map +1 -1
- package/dist/bscPlugin/validation/BrsFileValidator.js +46 -47
- package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -1
- package/dist/bscPlugin/validation/ScopeValidator.d.ts +10 -0
- package/dist/bscPlugin/validation/ScopeValidator.js +120 -39
- package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -1
- package/dist/bscPlugin/validation/ScopeValidator.spec.js +165 -10
- package/dist/bscPlugin/validation/ScopeValidator.spec.js.map +1 -1
- package/dist/diagnosticUtils.d.ts +1 -1
- package/dist/files/BrsFile.Class.spec.js +7 -6
- package/dist/files/BrsFile.Class.spec.js.map +1 -1
- package/dist/files/BrsFile.d.ts +7 -15
- package/dist/files/BrsFile.js +49 -309
- package/dist/files/BrsFile.js.map +1 -1
- package/dist/files/BrsFile.spec.js +111 -157
- package/dist/files/BrsFile.spec.js.map +1 -1
- package/dist/files/XmlFile.d.ts +2 -3
- package/dist/files/XmlFile.js +0 -2
- package/dist/files/XmlFile.js.map +1 -1
- package/dist/interfaces.d.ts +109 -84
- package/dist/interfaces.js +9 -9
- package/dist/interfaces.js.map +1 -1
- package/dist/parser/AstNode.spec.js +6 -6
- package/dist/parser/AstNode.spec.js.map +1 -1
- package/dist/parser/Expression.d.ts +301 -164
- package/dist/parser/Expression.js +355 -294
- package/dist/parser/Expression.js.map +1 -1
- package/dist/parser/Parser.Class.spec.js +26 -27
- package/dist/parser/Parser.Class.spec.js.map +1 -1
- package/dist/parser/Parser.d.ts +6 -2
- package/dist/parser/Parser.js +361 -160
- package/dist/parser/Parser.js.map +1 -1
- package/dist/parser/Parser.spec.js +69 -213
- package/dist/parser/Parser.spec.js.map +1 -1
- package/dist/parser/SGParser.js +49 -35
- package/dist/parser/SGParser.js.map +1 -1
- package/dist/parser/SGTypes.d.ts +36 -24
- package/dist/parser/SGTypes.js +26 -55
- package/dist/parser/SGTypes.js.map +1 -1
- package/dist/parser/Statement.d.ts +381 -238
- package/dist/parser/Statement.js +510 -386
- package/dist/parser/Statement.js.map +1 -1
- package/dist/parser/Statement.spec.js +2 -2
- package/dist/parser/Statement.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/For.spec.js +1 -1
- package/dist/parser/tests/controlFlow/For.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/ForEach.spec.js +2 -2
- package/dist/parser/tests/controlFlow/ForEach.spec.js.map +1 -1
- package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js +1 -1
- package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js.map +1 -1
- package/dist/parser/tests/expression/Call.spec.js +11 -11
- package/dist/parser/tests/expression/Call.spec.js.map +1 -1
- package/dist/parser/tests/expression/Indexing.spec.js +30 -5
- package/dist/parser/tests/expression/Indexing.spec.js.map +1 -1
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +2 -2
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TernaryExpression.spec.js +2 -2
- package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TypeExpression.spec.js +8 -9
- package/dist/parser/tests/expression/TypeExpression.spec.js.map +1 -1
- package/dist/parser/tests/statement/ConstStatement.spec.js +1 -1
- package/dist/parser/tests/statement/ConstStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/Dim.spec.js +8 -8
- package/dist/parser/tests/statement/Dim.spec.js.map +1 -1
- package/dist/parser/tests/statement/Enum.spec.js +2 -2
- package/dist/parser/tests/statement/Enum.spec.js.map +1 -1
- package/dist/parser/tests/statement/LibraryStatement.spec.js +2 -2
- package/dist/parser/tests/statement/LibraryStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/Misc.spec.js +2 -2
- package/dist/parser/tests/statement/Misc.spec.js.map +1 -1
- package/dist/parser/tests/statement/PrintStatement.spec.js +1 -1
- package/dist/parser/tests/statement/TryCatch.spec.js +10 -3
- package/dist/parser/tests/statement/TryCatch.spec.js.map +1 -1
- package/dist/roku-types/data.json +70 -52
- package/dist/roku-types/index.d.ts +43 -21
- package/dist/types/ArrayType.js +1 -2
- package/dist/types/ArrayType.js.map +1 -1
- package/dist/types/ArrayType.spec.js +7 -8
- package/dist/types/ArrayType.spec.js.map +1 -1
- package/dist/types/AssociativeArrayType.js +2 -3
- package/dist/types/AssociativeArrayType.js.map +1 -1
- package/dist/types/BscType.d.ts +1 -1
- package/dist/types/BscType.js +2 -3
- package/dist/types/BscType.js.map +1 -1
- package/dist/types/BuiltInInterfaceAdder.js +15 -9
- package/dist/types/BuiltInInterfaceAdder.js.map +1 -1
- package/dist/types/BuiltInInterfaceAdder.spec.js +31 -32
- package/dist/types/BuiltInInterfaceAdder.spec.js.map +1 -1
- package/dist/types/ClassType.spec.js +10 -11
- package/dist/types/ClassType.spec.js.map +1 -1
- package/dist/types/ComponentType.d.ts +2 -1
- package/dist/types/ComponentType.js.map +1 -1
- package/dist/types/EnumType.js +2 -3
- package/dist/types/EnumType.js.map +1 -1
- package/dist/types/InheritableType.js +3 -4
- package/dist/types/InheritableType.js.map +1 -1
- package/dist/types/InterfaceType.js +2 -3
- package/dist/types/InterfaceType.js.map +1 -1
- package/dist/types/InterfaceType.spec.js +3 -4
- package/dist/types/InterfaceType.spec.js.map +1 -1
- package/dist/types/ObjectType.js +1 -2
- package/dist/types/ObjectType.js.map +1 -1
- package/dist/types/ReferenceType.d.ts +1 -1
- package/dist/types/ReferenceType.spec.js +21 -22
- package/dist/types/ReferenceType.spec.js.map +1 -1
- package/dist/types/UnionType.js +3 -3
- package/dist/types/UnionType.js.map +1 -1
- package/dist/types/UnionType.spec.js +37 -38
- package/dist/types/UnionType.spec.js.map +1 -1
- package/dist/types/helper.spec.js +4 -5
- package/dist/types/helper.spec.js.map +1 -1
- package/dist/util.d.ts +16 -7
- package/dist/util.js +89 -43
- package/dist/util.js.map +1 -1
- package/dist/validators/ClassValidator.d.ts +0 -9
- package/dist/validators/ClassValidator.js +9 -52
- package/dist/validators/ClassValidator.js.map +1 -1
- package/package.json +1 -1
package/dist/files/BrsFile.d.ts
CHANGED
|
@@ -2,22 +2,21 @@ import type { CodeWithSourceMap } from 'source-map';
|
|
|
2
2
|
import type { CompletionItem, Position, Location, Diagnostic } from 'vscode-languageserver';
|
|
3
3
|
import { DocumentSymbol, SymbolInformation } from 'vscode-languageserver';
|
|
4
4
|
import { FunctionScope } from '../FunctionScope';
|
|
5
|
-
import type { Callable, CommentFlag,
|
|
6
|
-
import {
|
|
5
|
+
import type { Callable, CommentFlag, BsDiagnostic, FileReference, FileLink, SerializedCodeFile, NamespaceContainer } from '../interfaces';
|
|
6
|
+
import type { Token } from '../lexer/Token';
|
|
7
7
|
import { TokenKind } from '../lexer/TokenKind';
|
|
8
8
|
import { Parser, ParseMode } from '../parser/Parser';
|
|
9
9
|
import type { FunctionExpression } from '../parser/Expression';
|
|
10
10
|
import type { ClassStatement, NamespaceStatement, MethodStatement } from '../parser/Statement';
|
|
11
11
|
import type { Program } from '../Program';
|
|
12
12
|
import type { DependencyGraph } from '../DependencyGraph';
|
|
13
|
-
import type { AstNode } from '../parser/AstNode';
|
|
14
|
-
import { type Expression } from '../parser/AstNode';
|
|
15
|
-
import type { BscSymbol } from '../SymbolTable';
|
|
16
|
-
import { SymbolTypeFlag } from '../SymbolTable';
|
|
17
|
-
import type { BscFile } from './BscFile';
|
|
18
|
-
import { Editor } from '../astUtils/Editor';
|
|
13
|
+
import type { AstNode, Expression } from '../parser/AstNode';
|
|
19
14
|
import type { UnresolvedSymbol } from '../AstValidationSegmenter';
|
|
20
15
|
import { AstValidationSegmenter } from '../AstValidationSegmenter';
|
|
16
|
+
import type { BscSymbol } from '../SymbolTable';
|
|
17
|
+
import { SymbolTypeFlag } from '../SymbolTableFlag';
|
|
18
|
+
import { Editor } from '../astUtils/Editor';
|
|
19
|
+
import type { BscFile } from './BscFile';
|
|
21
20
|
export declare type ProvidedSymbolMap = Map<SymbolTypeFlag, Map<string, BscSymbol>>;
|
|
22
21
|
export declare type ChangedSymbolMap = Map<SymbolTypeFlag, Set<string>>;
|
|
23
22
|
export interface ProvidedSymbolInfo {
|
|
@@ -178,7 +177,6 @@ export declare class BrsFile implements BscFile {
|
|
|
178
177
|
private createFunctionScopes;
|
|
179
178
|
staticCallables: Callable[];
|
|
180
179
|
get callables(): Callable[];
|
|
181
|
-
get functionCalls(): FunctionCall[];
|
|
182
180
|
/**
|
|
183
181
|
* Find the function scope at the given position.
|
|
184
182
|
* @param position the position used to find the deepest scope that contains it
|
|
@@ -189,7 +187,6 @@ export declare class BrsFile implements BscFile {
|
|
|
189
187
|
* Find the NamespaceStatement enclosing the given position
|
|
190
188
|
*/
|
|
191
189
|
getNamespaceStatementForPosition(position: Position): NamespaceStatement;
|
|
192
|
-
private getNamespaceDefinitions;
|
|
193
190
|
/**
|
|
194
191
|
* Given a current token, walk
|
|
195
192
|
*/
|
|
@@ -233,11 +230,6 @@ export declare class BrsFile implements BscFile {
|
|
|
233
230
|
* Builds a single SymbolInformation object for use by LanguageServer's onWorkspaceSymbol functionality
|
|
234
231
|
*/
|
|
235
232
|
private generateWorkspaceSymbols;
|
|
236
|
-
/**
|
|
237
|
-
* Given a position in a file, if the position is sitting on some type of identifier,
|
|
238
|
-
* go to the definition of that identifier (where this thing was first defined)
|
|
239
|
-
*/
|
|
240
|
-
getDefinition(position: Position): Location[];
|
|
241
233
|
getClassMemberDefinitions(textToSearchFor: string, file: BrsFile): Location[];
|
|
242
234
|
getClassMethod(classStatement: ClassStatement, name: string, walkParents?: boolean): MethodStatement | undefined;
|
|
243
235
|
getReferences(position: Position): Location[];
|
package/dist/files/BrsFile.js
CHANGED
|
@@ -20,11 +20,10 @@ const serialize_error_1 = require("serialize-error");
|
|
|
20
20
|
const reflection_1 = require("../astUtils/reflection");
|
|
21
21
|
const visitors_1 = require("../astUtils/visitors");
|
|
22
22
|
const CommentFlagProcessor_1 = require("../CommentFlagProcessor");
|
|
23
|
-
const vscode_uri_1 = require("vscode-uri");
|
|
24
|
-
const SymbolTable_1 = require("../SymbolTable");
|
|
25
|
-
const Editor_1 = require("../astUtils/Editor");
|
|
26
23
|
const AstValidationSegmenter_1 = require("../AstValidationSegmenter");
|
|
24
|
+
const SymbolTable_1 = require("../SymbolTable");
|
|
27
25
|
const CachedLookups_1 = require("../astUtils/CachedLookups");
|
|
26
|
+
const Editor_1 = require("../astUtils/Editor");
|
|
28
27
|
/**
|
|
29
28
|
* Holds all details about this file within the scope of the whole program
|
|
30
29
|
*/
|
|
@@ -128,16 +127,16 @@ class BrsFile {
|
|
|
128
127
|
get ownScriptImports() {
|
|
129
128
|
var _a, _b;
|
|
130
129
|
const result = (_b = (_a = this.cache) === null || _a === void 0 ? void 0 : _a.getOrAdd('BrsFile_ownScriptImports', () => {
|
|
131
|
-
var _a, _b
|
|
130
|
+
var _a, _b;
|
|
132
131
|
const result = [];
|
|
133
132
|
for (const statement of (_b = (_a = this._cachedLookups) === null || _a === void 0 ? void 0 : _a.importStatements) !== null && _b !== void 0 ? _b : []) {
|
|
134
133
|
//register import statements
|
|
135
|
-
if ((0, reflection_1.isImportStatement)(statement) && statement.
|
|
134
|
+
if ((0, reflection_1.isImportStatement)(statement) && statement.tokens.path) {
|
|
136
135
|
result.push({
|
|
137
|
-
filePathRange: statement.
|
|
136
|
+
filePathRange: statement.tokens.path.range,
|
|
138
137
|
destPath: util_1.util.getPkgPathFromTarget(this.destPath, statement.filePath),
|
|
139
138
|
sourceFile: this,
|
|
140
|
-
text:
|
|
139
|
+
text: statement.tokens.path.text
|
|
141
140
|
});
|
|
142
141
|
}
|
|
143
142
|
}
|
|
@@ -370,11 +369,11 @@ class BrsFile {
|
|
|
370
369
|
//add every parameter
|
|
371
370
|
for (let param of func.parameters) {
|
|
372
371
|
scope.variableDeclarations.push({
|
|
373
|
-
nameRange: param.name.range,
|
|
374
|
-
lineIndex: param.name.range.start.line,
|
|
375
|
-
name: param.name.text,
|
|
372
|
+
nameRange: param.tokens.name.range,
|
|
373
|
+
lineIndex: param.tokens.name.range.start.line,
|
|
374
|
+
name: param.tokens.name.text,
|
|
376
375
|
getType: () => {
|
|
377
|
-
return param.getType({ flags:
|
|
376
|
+
return param.getType({ flags: 2 /* SymbolTypeFlag.typetime */ });
|
|
378
377
|
}
|
|
379
378
|
});
|
|
380
379
|
}
|
|
@@ -382,14 +381,14 @@ class BrsFile {
|
|
|
382
381
|
(_a = func.body) === null || _a === void 0 ? void 0 : _a.walk((0, visitors_1.createVisitor)({
|
|
383
382
|
ForEachStatement: (stmt) => {
|
|
384
383
|
scope.variableDeclarations.push({
|
|
385
|
-
nameRange: stmt.item.range,
|
|
386
|
-
lineIndex: stmt.item.range.start.line,
|
|
387
|
-
name: stmt.item.text,
|
|
384
|
+
nameRange: stmt.tokens.item.range,
|
|
385
|
+
lineIndex: stmt.tokens.item.range.start.line,
|
|
386
|
+
name: stmt.tokens.item.text,
|
|
388
387
|
getType: () => DynamicType_1.DynamicType.instance //TODO: Infer types from array
|
|
389
388
|
});
|
|
390
389
|
},
|
|
391
390
|
LabelStatement: (stmt) => {
|
|
392
|
-
const { identifier } = stmt.tokens;
|
|
391
|
+
const { name: identifier } = stmt.tokens;
|
|
393
392
|
scope.labelStatements.push({
|
|
394
393
|
nameRange: identifier.range,
|
|
395
394
|
lineIndex: identifier.range.start.line,
|
|
@@ -410,12 +409,13 @@ class BrsFile {
|
|
|
410
409
|
let scope = this.scopesByFunc.get(statement.findAncestor(reflection_1.isFunctionExpression));
|
|
411
410
|
//skip variable declarations that are outside of any scope
|
|
412
411
|
if (scope) {
|
|
412
|
+
const variableName = statement.tokens.name;
|
|
413
413
|
scope.variableDeclarations.push({
|
|
414
|
-
nameRange:
|
|
415
|
-
lineIndex:
|
|
416
|
-
name:
|
|
414
|
+
nameRange: variableName.range,
|
|
415
|
+
lineIndex: variableName.range.start.line,
|
|
416
|
+
name: variableName.text,
|
|
417
417
|
getType: () => {
|
|
418
|
-
return statement.getType({ flags:
|
|
418
|
+
return statement.getType({ flags: 1 /* SymbolTypeFlag.runtime */ });
|
|
419
419
|
}
|
|
420
420
|
});
|
|
421
421
|
}
|
|
@@ -427,26 +427,26 @@ class BrsFile {
|
|
|
427
427
|
return this.staticCallables;
|
|
428
428
|
}
|
|
429
429
|
return this.cache.getOrAdd(`BrsFile_callables`, () => {
|
|
430
|
-
var _a, _b, _c, _d;
|
|
430
|
+
var _a, _b, _c, _d, _e;
|
|
431
431
|
const callables = [];
|
|
432
432
|
for (let statement of (_a = this._cachedLookups.functionStatements) !== null && _a !== void 0 ? _a : []) {
|
|
433
433
|
//extract the parameters
|
|
434
434
|
let params = [];
|
|
435
435
|
for (let param of statement.func.parameters) {
|
|
436
|
-
const paramType = param.getType({ flags:
|
|
436
|
+
const paramType = param.getType({ flags: 2 /* SymbolTypeFlag.typetime */ });
|
|
437
437
|
let callableParam = {
|
|
438
|
-
name: (_b = param.name) === null || _b === void 0 ? void 0 : _b.text,
|
|
438
|
+
name: (_b = param.tokens.name) === null || _b === void 0 ? void 0 : _b.text,
|
|
439
439
|
type: paramType,
|
|
440
440
|
isOptional: !!param.defaultValue,
|
|
441
441
|
isRestArgument: false
|
|
442
442
|
};
|
|
443
443
|
params.push(callableParam);
|
|
444
444
|
}
|
|
445
|
-
const funcType = statement.getType({ flags:
|
|
445
|
+
const funcType = statement.getType({ flags: 2 /* SymbolTypeFlag.typetime */ });
|
|
446
446
|
callables.push({
|
|
447
|
-
isSub: statement.func.functionType.text.toLowerCase() === 'sub',
|
|
448
|
-
name: (
|
|
449
|
-
nameRange: (
|
|
447
|
+
isSub: ((_c = statement.func.tokens.functionType) === null || _c === void 0 ? void 0 : _c.text.toLowerCase()) === 'sub',
|
|
448
|
+
name: (_d = statement.tokens.name) === null || _d === void 0 ? void 0 : _d.text,
|
|
449
|
+
nameRange: (_e = statement.tokens.name) === null || _e === void 0 ? void 0 : _e.range,
|
|
450
450
|
file: this,
|
|
451
451
|
params: params,
|
|
452
452
|
range: statement.func.range,
|
|
@@ -459,98 +459,6 @@ class BrsFile {
|
|
|
459
459
|
return callables;
|
|
460
460
|
});
|
|
461
461
|
}
|
|
462
|
-
get functionCalls() {
|
|
463
|
-
return this.cache.getOrAdd(`BrsFile_functionCalls`, () => {
|
|
464
|
-
const functionCalls = [];
|
|
465
|
-
//for every function in the file
|
|
466
|
-
for (let func of this._cachedLookups.functionExpressions) {
|
|
467
|
-
//for all function calls in this function
|
|
468
|
-
for (let expression of func.callExpressions) {
|
|
469
|
-
if (
|
|
470
|
-
//filter out dotted function invocations (i.e. object.doSomething()) (not currently supported. TODO support it)
|
|
471
|
-
expression.callee.obj ||
|
|
472
|
-
//filter out method calls on method calls for now (i.e. getSomething().getSomethingElse())
|
|
473
|
-
expression.callee.callee ||
|
|
474
|
-
//filter out callees without a name (immediately-invoked function expressions)
|
|
475
|
-
!expression.callee.name) {
|
|
476
|
-
continue;
|
|
477
|
-
}
|
|
478
|
-
let functionName = expression.callee.name.text;
|
|
479
|
-
//callee is the name of the function being called
|
|
480
|
-
let callee = expression.callee;
|
|
481
|
-
let columnIndexBegin = callee.range.start.character;
|
|
482
|
-
let columnIndexEnd = callee.range.end.character;
|
|
483
|
-
let args = [];
|
|
484
|
-
//TODO convert if stmts to use instanceof instead
|
|
485
|
-
for (let arg of expression.args) {
|
|
486
|
-
//is a literal parameter value
|
|
487
|
-
if ((0, reflection_1.isLiteralExpression)(arg)) {
|
|
488
|
-
args.push({
|
|
489
|
-
range: arg.range,
|
|
490
|
-
type: arg.getType(),
|
|
491
|
-
text: arg.token.text,
|
|
492
|
-
expression: arg,
|
|
493
|
-
typeToken: undefined
|
|
494
|
-
});
|
|
495
|
-
//is variable being passed into argument
|
|
496
|
-
}
|
|
497
|
-
else if (arg.name) {
|
|
498
|
-
args.push({
|
|
499
|
-
range: arg.range,
|
|
500
|
-
//TODO - look up the data type of the actual variable
|
|
501
|
-
type: new DynamicType_1.DynamicType(),
|
|
502
|
-
text: arg.name.text,
|
|
503
|
-
expression: arg,
|
|
504
|
-
typeToken: undefined
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
else if (arg.value) {
|
|
508
|
-
let text = '';
|
|
509
|
-
/* istanbul ignore next: TODO figure out why value is undefined sometimes */
|
|
510
|
-
if (arg.value.value) {
|
|
511
|
-
text = arg.value.value.toString();
|
|
512
|
-
}
|
|
513
|
-
let callableArg = {
|
|
514
|
-
range: arg.range,
|
|
515
|
-
//TODO not sure what to do here
|
|
516
|
-
type: new DynamicType_1.DynamicType(),
|
|
517
|
-
text: text,
|
|
518
|
-
expression: arg,
|
|
519
|
-
typeToken: undefined
|
|
520
|
-
};
|
|
521
|
-
//wrap the value in quotes because that's how it appears in the code
|
|
522
|
-
if ((0, reflection_1.isStringType)(callableArg.type)) {
|
|
523
|
-
callableArg.text = '"' + callableArg.text + '"';
|
|
524
|
-
}
|
|
525
|
-
args.push(callableArg);
|
|
526
|
-
}
|
|
527
|
-
else {
|
|
528
|
-
args.push({
|
|
529
|
-
range: arg.range,
|
|
530
|
-
type: new DynamicType_1.DynamicType(),
|
|
531
|
-
//TODO get text from other types of args
|
|
532
|
-
text: '',
|
|
533
|
-
expression: arg,
|
|
534
|
-
typeToken: undefined
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
let functionCall = {
|
|
539
|
-
range: expression.range,
|
|
540
|
-
functionScope: this.getFunctionScopeAtPosition(callee.range.start),
|
|
541
|
-
file: this,
|
|
542
|
-
name: functionName,
|
|
543
|
-
nameRange: util_1.util.createRange(callee.range.start.line, columnIndexBegin, callee.range.start.line, columnIndexEnd),
|
|
544
|
-
//TODO keep track of parameters
|
|
545
|
-
args: args,
|
|
546
|
-
expression: expression
|
|
547
|
-
};
|
|
548
|
-
functionCalls.push(functionCall);
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
return functionCalls;
|
|
552
|
-
});
|
|
553
|
-
}
|
|
554
462
|
/**
|
|
555
463
|
* Find the function scope at the given position.
|
|
556
464
|
* @param position the position used to find the deepest scope that contains it
|
|
@@ -591,38 +499,6 @@ class BrsFile {
|
|
|
591
499
|
});
|
|
592
500
|
}
|
|
593
501
|
}
|
|
594
|
-
getNamespaceDefinitions(token, file) {
|
|
595
|
-
//BrightScript does not support namespaces, so return an empty list in that case
|
|
596
|
-
if (!token) {
|
|
597
|
-
return undefined;
|
|
598
|
-
}
|
|
599
|
-
let location;
|
|
600
|
-
const nameParts = this.getPartialVariableName(token, [TokenKind_1.TokenKind.New]).split('.');
|
|
601
|
-
const endName = nameParts[nameParts.length - 1].toLowerCase();
|
|
602
|
-
const namespaceName = nameParts.slice(0, -1).join('.').toLowerCase();
|
|
603
|
-
const statementHandler = (statement) => {
|
|
604
|
-
if (!location && statement.getName(Parser_1.ParseMode.BrighterScript).toLowerCase() === namespaceName) {
|
|
605
|
-
const namespaceItemStatementHandler = (statement) => {
|
|
606
|
-
if (!location && statement.name.text.toLowerCase() === endName) {
|
|
607
|
-
const uri = util_1.util.pathToUri(file.srcPath);
|
|
608
|
-
location = util_1.util.createLocation(uri, statement.range);
|
|
609
|
-
}
|
|
610
|
-
};
|
|
611
|
-
file.parser.ast.walk((0, visitors_1.createVisitor)({
|
|
612
|
-
ClassStatement: namespaceItemStatementHandler,
|
|
613
|
-
FunctionStatement: namespaceItemStatementHandler
|
|
614
|
-
}), {
|
|
615
|
-
walkMode: visitors_1.WalkMode.visitStatements
|
|
616
|
-
});
|
|
617
|
-
}
|
|
618
|
-
};
|
|
619
|
-
file.parser.ast.walk((0, visitors_1.createVisitor)({
|
|
620
|
-
NamespaceStatement: statementHandler
|
|
621
|
-
}), {
|
|
622
|
-
walkMode: visitors_1.WalkMode.visitStatements
|
|
623
|
-
});
|
|
624
|
-
return location;
|
|
625
|
-
}
|
|
626
502
|
/**
|
|
627
503
|
* Given a current token, walk
|
|
628
504
|
*/
|
|
@@ -722,7 +598,7 @@ class BrsFile {
|
|
|
722
598
|
left = left.obj;
|
|
723
599
|
}
|
|
724
600
|
if ((0, reflection_1.isVariableExpression)(left)) {
|
|
725
|
-
let lowerName = left.name.text.toLowerCase();
|
|
601
|
+
let lowerName = left.tokens.name.text.toLowerCase();
|
|
726
602
|
//find the first scope that contains this namespace
|
|
727
603
|
let scopes = this.program.getScopesForFile(this);
|
|
728
604
|
for (let scope of scopes) {
|
|
@@ -740,7 +616,7 @@ class BrsFile {
|
|
|
740
616
|
var _a, _b;
|
|
741
617
|
//if we have a variable and a namespace
|
|
742
618
|
if ((0, reflection_1.isVariableExpression)(callee) && namespaceName) {
|
|
743
|
-
let lowerCalleeName = (_b = (_a = callee === null || callee === void 0 ? void 0 : callee.name) === null || _a === void 0 ? void 0 : _a.text) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
619
|
+
let lowerCalleeName = (_b = (_a = callee === null || callee === void 0 ? void 0 : callee.tokens.name) === null || _a === void 0 ? void 0 : _a.text) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
744
620
|
if (lowerCalleeName) {
|
|
745
621
|
let scopes = this.program.getScopesForFile(this);
|
|
746
622
|
for (let scope of scopes) {
|
|
@@ -767,7 +643,7 @@ class BrsFile {
|
|
|
767
643
|
return this.calleeIsKnownNamespaceFunction(callee, namespaceName);
|
|
768
644
|
}
|
|
769
645
|
let scopes = this.program.getScopesForFile(this);
|
|
770
|
-
let lowerCalleeName = (_b = (_a = callee === null || callee === void 0 ? void 0 : callee.name) === null || _a === void 0 ? void 0 : _a.text) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
646
|
+
let lowerCalleeName = (_b = (_a = callee === null || callee === void 0 ? void 0 : callee.tokens.name) === null || _a === void 0 ? void 0 : _a.text) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
771
647
|
for (let scope of scopes) {
|
|
772
648
|
if (scope.getCallableByName(lowerCalleeName)) {
|
|
773
649
|
return true;
|
|
@@ -868,7 +744,7 @@ class BrsFile {
|
|
|
868
744
|
else {
|
|
869
745
|
return;
|
|
870
746
|
}
|
|
871
|
-
const name = (0, reflection_1.isFieldStatement)(statement) ? statement.name.text : statement.getName(Parser_1.ParseMode.BrighterScript);
|
|
747
|
+
const name = (0, reflection_1.isFieldStatement)(statement) ? statement.tokens.name.text : statement.getName(Parser_1.ParseMode.BrighterScript);
|
|
872
748
|
return vscode_languageserver_2.DocumentSymbol.create(name, '', symbolKind, statement.range, statement.range, children);
|
|
873
749
|
}
|
|
874
750
|
/**
|
|
@@ -908,142 +784,6 @@ class BrsFile {
|
|
|
908
784
|
symbols.push(symbol);
|
|
909
785
|
return symbols;
|
|
910
786
|
}
|
|
911
|
-
/**
|
|
912
|
-
* Given a position in a file, if the position is sitting on some type of identifier,
|
|
913
|
-
* go to the definition of that identifier (where this thing was first defined)
|
|
914
|
-
*/
|
|
915
|
-
getDefinition(position) {
|
|
916
|
-
var _a, _b;
|
|
917
|
-
let results = [];
|
|
918
|
-
//get the token at the position
|
|
919
|
-
const token = this.getTokenAt(position);
|
|
920
|
-
// While certain other tokens are allowed as local variables (AllowedLocalIdentifiers: https://github.com/rokucommunity/brighterscript/blob/master/src/lexer/TokenKind.ts#L418), these are converted by the parser to TokenKind.Identifier by the time we retrieve the token using getTokenAt
|
|
921
|
-
let definitionTokenTypes = [
|
|
922
|
-
TokenKind_1.TokenKind.Identifier,
|
|
923
|
-
TokenKind_1.TokenKind.StringLiteral
|
|
924
|
-
];
|
|
925
|
-
//throw out invalid tokens and the wrong kind of tokens
|
|
926
|
-
if (!token || !definitionTokenTypes.includes(token.kind)) {
|
|
927
|
-
return results;
|
|
928
|
-
}
|
|
929
|
-
const scopesForFile = this.program.getScopesForFile(this);
|
|
930
|
-
const [scope] = scopesForFile;
|
|
931
|
-
const expression = this.getClosestExpression(position);
|
|
932
|
-
if (scope && expression) {
|
|
933
|
-
scope.linkSymbolTable();
|
|
934
|
-
let containingNamespace = (_a = expression.findAncestor(reflection_1.isNamespaceStatement)) === null || _a === void 0 ? void 0 : _a.getName(Parser_1.ParseMode.BrighterScript);
|
|
935
|
-
const fullName = (_b = util_1.util.getAllDottedGetParts(expression)) === null || _b === void 0 ? void 0 : _b.map(x => x.text).join('.');
|
|
936
|
-
//find a constant with this name
|
|
937
|
-
const constant = scope === null || scope === void 0 ? void 0 : scope.getConstFileLink(fullName, containingNamespace);
|
|
938
|
-
if (constant) {
|
|
939
|
-
results.push(util_1.util.createLocation(vscode_uri_1.URI.file(constant.file.srcPath).toString(), constant.item.tokens.name.range));
|
|
940
|
-
return results;
|
|
941
|
-
}
|
|
942
|
-
if ((0, reflection_1.isDottedGetExpression)(expression) || (0, reflection_1.isVariableExpression)(expression)) {
|
|
943
|
-
const enumLink = scope.getEnumFileLink(fullName, containingNamespace);
|
|
944
|
-
if (enumLink) {
|
|
945
|
-
results.push(util_1.util.createLocation(vscode_uri_1.URI.file(enumLink.file.srcPath).toString(), enumLink.item.tokens.name.range));
|
|
946
|
-
return results;
|
|
947
|
-
}
|
|
948
|
-
const enumMemberLink = scope.getEnumMemberFileLink(fullName, containingNamespace);
|
|
949
|
-
if (enumMemberLink) {
|
|
950
|
-
results.push(util_1.util.createLocation(vscode_uri_1.URI.file(enumMemberLink.file.srcPath).toString(), enumMemberLink.item.tokens.name.range));
|
|
951
|
-
return results;
|
|
952
|
-
}
|
|
953
|
-
const interfaceFileLink = scope.getInterfaceFileLink(fullName, containingNamespace);
|
|
954
|
-
if (interfaceFileLink) {
|
|
955
|
-
results.push(util_1.util.createLocation(vscode_uri_1.URI.file(interfaceFileLink.file.srcPath).toString(), interfaceFileLink.item.tokens.name.range));
|
|
956
|
-
return results;
|
|
957
|
-
}
|
|
958
|
-
const classFileLink = scope.getClassFileLink(fullName, containingNamespace);
|
|
959
|
-
if (classFileLink) {
|
|
960
|
-
results.push(util_1.util.createLocation(vscode_uri_1.URI.file(classFileLink.file.srcPath).toString(), classFileLink.item.name.range));
|
|
961
|
-
return results;
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
let textToSearchFor = token.text.toLowerCase();
|
|
966
|
-
const previousToken = this.getTokenAt({ line: token.range.start.line, character: token.range.start.character });
|
|
967
|
-
if ((previousToken === null || previousToken === void 0 ? void 0 : previousToken.kind) === TokenKind_1.TokenKind.Callfunc) {
|
|
968
|
-
for (const scope of scopesForFile) {
|
|
969
|
-
//to only get functions defined in interface methods
|
|
970
|
-
const callable = scope.getAllCallables().find((c) => c.callable.name.toLowerCase() === textToSearchFor); // eslint-disable-line @typescript-eslint/no-loop-func
|
|
971
|
-
if (callable) {
|
|
972
|
-
results.push(util_1.util.createLocation(util_1.util.pathToUri(callable.callable.file.srcPath), callable.callable.functionStatement.range));
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
return results;
|
|
976
|
-
}
|
|
977
|
-
let classToken = this.getTokenBefore(token, TokenKind_1.TokenKind.Class);
|
|
978
|
-
if (classToken) {
|
|
979
|
-
let cs = this._cachedLookups.classStatements.find((cs) => cs.classKeyword.range === classToken.range);
|
|
980
|
-
if (cs === null || cs === void 0 ? void 0 : cs.parentClassName) {
|
|
981
|
-
const nameParts = cs.parentClassName.getNameParts();
|
|
982
|
-
let extendedClass = this.getClassFileLink(nameParts[nameParts.length - 1], nameParts.slice(0, -1).join('.'));
|
|
983
|
-
if (extendedClass) {
|
|
984
|
-
results.push(util_1.util.createLocation(util_1.util.pathToUri(extendedClass.file.srcPath), extendedClass.item.range));
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
return results;
|
|
988
|
-
}
|
|
989
|
-
if (token.kind === TokenKind_1.TokenKind.StringLiteral) {
|
|
990
|
-
// We need to strip off the quotes but only if present
|
|
991
|
-
const startIndex = textToSearchFor.startsWith('"') ? 1 : 0;
|
|
992
|
-
let endIndex = textToSearchFor.length;
|
|
993
|
-
if (textToSearchFor.endsWith('"')) {
|
|
994
|
-
endIndex--;
|
|
995
|
-
}
|
|
996
|
-
textToSearchFor = textToSearchFor.substring(startIndex, endIndex);
|
|
997
|
-
}
|
|
998
|
-
//look through local variables first, get the function scope for this position (if it exists)
|
|
999
|
-
const functionScope = this.getFunctionScopeAtPosition(position);
|
|
1000
|
-
if (functionScope) {
|
|
1001
|
-
//find any variable or label with this name
|
|
1002
|
-
for (const varDeclaration of functionScope.variableDeclarations) {
|
|
1003
|
-
//we found a variable declaration with this token text!
|
|
1004
|
-
if (varDeclaration.name.toLowerCase() === textToSearchFor) {
|
|
1005
|
-
const uri = util_1.util.pathToUri(this.srcPath);
|
|
1006
|
-
results.push(util_1.util.createLocation(uri, varDeclaration.nameRange));
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
if (this.tokenFollows(token, TokenKind_1.TokenKind.Goto)) {
|
|
1010
|
-
for (const label of functionScope.labelStatements) {
|
|
1011
|
-
if (label.name.toLocaleLowerCase() === textToSearchFor) {
|
|
1012
|
-
const uri = util_1.util.pathToUri(this.srcPath);
|
|
1013
|
-
results.push(util_1.util.createLocation(uri, label.nameRange));
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
const filesSearched = new Set();
|
|
1019
|
-
//look through all files in scope for matches
|
|
1020
|
-
for (const scope of scopesForFile) {
|
|
1021
|
-
for (const file of scope.getAllFiles()) {
|
|
1022
|
-
if ((0, reflection_1.isBrsFile)(file) && !filesSearched.has(file)) {
|
|
1023
|
-
filesSearched.add(file);
|
|
1024
|
-
if ((previousToken === null || previousToken === void 0 ? void 0 : previousToken.kind) === TokenKind_1.TokenKind.Dot && file.parseMode === Parser_1.ParseMode.BrighterScript) {
|
|
1025
|
-
results.push(...this.getClassMemberDefinitions(textToSearchFor, file));
|
|
1026
|
-
const namespaceDefinition = this.getNamespaceDefinitions(token, file);
|
|
1027
|
-
if (namespaceDefinition) {
|
|
1028
|
-
results.push(namespaceDefinition);
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
const statementHandler = (statement) => {
|
|
1032
|
-
if (statement.getName(this.parseMode).toLowerCase() === textToSearchFor) {
|
|
1033
|
-
const uri = util_1.util.pathToUri(file.srcPath);
|
|
1034
|
-
results.push(util_1.util.createLocation(uri, statement.range));
|
|
1035
|
-
}
|
|
1036
|
-
};
|
|
1037
|
-
file.parser.ast.walk((0, visitors_1.createVisitor)({
|
|
1038
|
-
FunctionStatement: statementHandler
|
|
1039
|
-
}), {
|
|
1040
|
-
walkMode: visitors_1.WalkMode.visitStatements
|
|
1041
|
-
});
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
return results;
|
|
1046
|
-
}
|
|
1047
787
|
getClassMemberDefinitions(textToSearchFor, file) {
|
|
1048
788
|
let results = [];
|
|
1049
789
|
//get class fields and members
|
|
@@ -1053,7 +793,7 @@ class BrsFile {
|
|
|
1053
793
|
}
|
|
1054
794
|
};
|
|
1055
795
|
const fieldStatementHandler = (statement) => {
|
|
1056
|
-
if (statement.name.text.toLowerCase() === textToSearchFor) {
|
|
796
|
+
if (statement.tokens.name.text.toLowerCase() === textToSearchFor) {
|
|
1057
797
|
results.push(util_1.util.createLocation(util_1.util.pathToUri(file.srcPath), statement.range));
|
|
1058
798
|
}
|
|
1059
799
|
};
|
|
@@ -1070,7 +810,7 @@ class BrsFile {
|
|
|
1070
810
|
//TODO - would like to write this with getClassHieararchy; but got stuck on working out the scopes to use... :(
|
|
1071
811
|
let statement;
|
|
1072
812
|
const statementHandler = (e) => {
|
|
1073
|
-
if (!statement && e.name.text.toLowerCase() === name.toLowerCase()) {
|
|
813
|
+
if (!statement && e.tokens.name.text.toLowerCase() === name.toLowerCase()) {
|
|
1074
814
|
statement = e;
|
|
1075
815
|
}
|
|
1076
816
|
};
|
|
@@ -1105,7 +845,7 @@ class BrsFile {
|
|
|
1105
845
|
processedFiles.add(file);
|
|
1106
846
|
file.ast.walk((0, visitors_1.createVisitor)({
|
|
1107
847
|
VariableExpression: (e) => {
|
|
1108
|
-
if (e.name.text.toLowerCase() === searchFor) {
|
|
848
|
+
if (e.tokens.name.text.toLowerCase() === searchFor) {
|
|
1109
849
|
locations.push(util_1.util.createLocation(util_1.util.pathToUri(file.srcPath), e.range));
|
|
1110
850
|
}
|
|
1111
851
|
}
|
|
@@ -1187,12 +927,12 @@ class BrsFile {
|
|
|
1187
927
|
const allNeededSymbolSets = this.validationSegmenter.unresolvedSegmentsSymbols.values();
|
|
1188
928
|
const requiredSymbols = [];
|
|
1189
929
|
const addedSymbols = new Map();
|
|
1190
|
-
addedSymbols.set(
|
|
1191
|
-
addedSymbols.set(
|
|
930
|
+
addedSymbols.set(1 /* SymbolTypeFlag.runtime */, new Set());
|
|
931
|
+
addedSymbols.set(2 /* SymbolTypeFlag.typetime */, new Set());
|
|
1192
932
|
for (const setOfSymbols of allNeededSymbolSets) {
|
|
1193
933
|
for (const symbol of setOfSymbols) {
|
|
1194
934
|
const fullSymbolKey = symbol.typeChain.map(tce => tce.name).join('.').toLowerCase();
|
|
1195
|
-
for (const flag of [
|
|
935
|
+
for (const flag of [1 /* SymbolTypeFlag.runtime */, 2 /* SymbolTypeFlag.typetime */]) {
|
|
1196
936
|
// eslint-disable-next-line no-bitwise
|
|
1197
937
|
if (symbol.flags & flag) {
|
|
1198
938
|
if ((_a = this.providedSymbols.symbolMap.get(flag)) === null || _a === void 0 ? void 0 : _a.has(fullSymbolKey)) {
|
|
@@ -1231,8 +971,8 @@ class BrsFile {
|
|
|
1231
971
|
});
|
|
1232
972
|
}
|
|
1233
973
|
for (const symbolTable of tablesToGetSymbolsFrom) {
|
|
1234
|
-
const runTimeSymbols = symbolTable.table.getOwnSymbols(
|
|
1235
|
-
const typeTimeSymbols = symbolTable.table.getOwnSymbols(
|
|
974
|
+
const runTimeSymbols = symbolTable.table.getOwnSymbols(1 /* SymbolTypeFlag.runtime */);
|
|
975
|
+
const typeTimeSymbols = symbolTable.table.getOwnSymbols(2 /* SymbolTypeFlag.typetime */);
|
|
1236
976
|
for (const symbol of runTimeSymbols) {
|
|
1237
977
|
if (!(0, reflection_1.isAnyReferenceType)(symbol.type)) {
|
|
1238
978
|
const symbolNameLower = symbolTable.namePrefixLower
|
|
@@ -1250,16 +990,16 @@ class BrsFile {
|
|
|
1250
990
|
}
|
|
1251
991
|
}
|
|
1252
992
|
}
|
|
1253
|
-
symbolMap.set(
|
|
1254
|
-
symbolMap.set(
|
|
993
|
+
symbolMap.set(1 /* SymbolTypeFlag.runtime */, runTimeSymbolMap);
|
|
994
|
+
symbolMap.set(2 /* SymbolTypeFlag.typetime */, typeTimeSymbolMap);
|
|
1255
995
|
const changes = new Map();
|
|
1256
|
-
changes.set(
|
|
1257
|
-
changes.set(
|
|
996
|
+
changes.set(1 /* SymbolTypeFlag.runtime */, new Set());
|
|
997
|
+
changes.set(2 /* SymbolTypeFlag.typetime */, new Set());
|
|
1258
998
|
const previouslyProvidedSymbols = (_a = this.program.getFileSymbolInfo(this)) === null || _a === void 0 ? void 0 : _a.provides.symbolMap;
|
|
1259
999
|
const previousSymbolsChecked = new Map();
|
|
1260
|
-
previousSymbolsChecked.set(
|
|
1261
|
-
previousSymbolsChecked.set(
|
|
1262
|
-
for (const flag of [
|
|
1000
|
+
previousSymbolsChecked.set(1 /* SymbolTypeFlag.runtime */, new Set());
|
|
1001
|
+
previousSymbolsChecked.set(2 /* SymbolTypeFlag.typetime */, new Set());
|
|
1002
|
+
for (const flag of [1 /* SymbolTypeFlag.runtime */, 2 /* SymbolTypeFlag.typetime */]) {
|
|
1263
1003
|
const newSymbolMapForFlag = symbolMap.get(flag);
|
|
1264
1004
|
const oldSymbolMapForFlag = previouslyProvidedSymbols === null || previouslyProvidedSymbols === void 0 ? void 0 : previouslyProvidedSymbols.get(flag);
|
|
1265
1005
|
const previousSymbolsCheckedForFlag = previousSymbolsChecked.get(flag);
|
|
@@ -1354,11 +1094,11 @@ class BrsFile {
|
|
|
1354
1094
|
ns.namespaceStatements.push(namespaceStatement);
|
|
1355
1095
|
ns.statements.push(...namespaceStatement.body.statements);
|
|
1356
1096
|
for (let statement of namespaceStatement.body.statements) {
|
|
1357
|
-
if ((0, reflection_1.isClassStatement)(statement) && statement.name) {
|
|
1358
|
-
ns.classStatements.set(statement.name.text.toLowerCase(), statement);
|
|
1097
|
+
if ((0, reflection_1.isClassStatement)(statement) && statement.tokens.name) {
|
|
1098
|
+
ns.classStatements.set(statement.tokens.name.text.toLowerCase(), statement);
|
|
1359
1099
|
}
|
|
1360
|
-
else if ((0, reflection_1.isFunctionStatement)(statement) && statement.name) {
|
|
1361
|
-
ns.functionStatements.set(statement.name.text.toLowerCase(), statement);
|
|
1100
|
+
else if ((0, reflection_1.isFunctionStatement)(statement) && statement.tokens.name) {
|
|
1101
|
+
ns.functionStatements.set(statement.tokens.name.text.toLowerCase(), statement);
|
|
1362
1102
|
}
|
|
1363
1103
|
else if ((0, reflection_1.isEnumStatement)(statement) && statement.fullName) {
|
|
1364
1104
|
ns.enumStatements.set(statement.fullName.toLowerCase(), statement);
|