Skip to content

Commit

Permalink
Merge branch 'master' into better-languageserver-error-reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
TwitchBronBron committed Mar 10, 2021
2 parents cab49d9 + 91ff26d commit 4ca20bf
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/files/BrsFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -572,15 +572,15 @@ export class BrsFile {

//function call
} else if (isCallExpression(assignment.value)) {
let calleeName = (assignment.value.callee as any).name.text;
let calleeName = (assignment.value.callee as any)?.name?.text;
if (calleeName) {
let func = this.getCallableByName(calleeName);
if (func) {
return func.type.returnType;
}
}
} else if (isVariableExpression(assignment.value)) {
let variableName = assignment.value.name.text;
let variableName = assignment.value?.name?.text;
let variable = scope.getVariableByName(variableName);
return variable.type;
}
Expand Down Expand Up @@ -1180,12 +1180,14 @@ export class BrsFile {
public calleeIsKnownNamespaceFunction(callee: Expression, namespaceName: string) {
//if we have a variable and a namespace
if (isVariableExpression(callee) && namespaceName) {
let lowerCalleeName = callee.name.text.toLowerCase();
let scopes = this.program.getScopesForFile(this);
for (let scope of scopes) {
let namespace = scope.namespaceLookup[namespaceName.toLowerCase()];
if (namespace.functionStatements[lowerCalleeName]) {
return true;
let lowerCalleeName = callee?.name?.text?.toLowerCase();
if (lowerCalleeName) {
let scopes = this.program.getScopesForFile(this);
for (let scope of scopes) {
let namespace = scope.namespaceLookup[namespaceName.toLowerCase()];
if (namespace.functionStatements[lowerCalleeName]) {
return true;
}
}
}
}
Expand Down

0 comments on commit 4ca20bf

Please sign in to comment.