Skip to content

Commit

Permalink
Merge branch 'release-1.0.0' into remove_FunctionExpressionfunctionSt…
Browse files Browse the repository at this point in the history
…atement
  • Loading branch information
TwitchBronBron authored Aug 19, 2024
2 parents 3befae9 + f9c8b43 commit 921a07b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/DiagnosticCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ export class DiagnosticCollection {
const keys = {};
//build the full current set of diagnostics by file
for (let diagnostic of diagnostics) {
const fileUri = diagnostic.location.uri;
const fileUri = diagnostic?.location?.uri;
if (!fileUri) {
continue;
}

//ensure the file entry exists
if (!result[fileUri]) {
result[fileUri] = [];
Expand Down
2 changes: 1 addition & 1 deletion src/DiagnosticManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export class DiagnosticManager {
public clearForFile(fileSrcPath: string) {
const fileSrcPathUri = util.pathToUri(fileSrcPath).toLowerCase();
for (const [key, cachedData] of this.diagnosticsCache.entries()) {
if (cachedData.diagnostic.location.uri.toLowerCase() === fileSrcPathUri) {
if (cachedData.diagnostic.location?.uri.toLowerCase() === fileSrcPathUri) {
this.diagnosticsCache.delete(key);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export class BrsFileSemanticTokensProcessor {
public process() {
const scope = this.event.scopes[0];
this.result.clear();
scope.linkSymbolTable();
if (scope) {
scope.linkSymbolTable();
}

this.event.file.ast.walk(createVisitor({
VariableExpression: (node) => {
Expand Down Expand Up @@ -57,7 +59,9 @@ export class BrsFileSemanticTokensProcessor {
walkMode: WalkMode.visitAllRecursive
});

scope.unlinkSymbolTable();
if (scope) {
scope.unlinkSymbolTable();
}

//add all tokens to the event
this.event.semanticTokens.push(
Expand Down

0 comments on commit 921a07b

Please sign in to comment.