Skip to content

Commit

Permalink
Eliminate FunctionExpression.functionStatement (#1287)
Browse files Browse the repository at this point in the history
Co-authored-by: Bronley Plumb <bronley@gmail.com>
  • Loading branch information
markwpearce and TwitchBronBron authored Aug 20, 2024
1 parent f9c8b43 commit 353f463
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
15 changes: 6 additions & 9 deletions src/parser/Expression.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-bitwise */
import type { Token, Identifier } from '../lexer/Token';
import { TokenKind } from '../lexer/TokenKind';
import type { Block, FunctionStatement, NamespaceStatement } from './Statement';
import type { Block, NamespaceStatement } from './Statement';
import type { Location } from 'vscode-languageserver';
import util from '../util';
import type { BrsTranspileState } from './BrsTranspileState';
Expand Down Expand Up @@ -255,11 +255,6 @@ export class FunctionExpression extends Expression implements TypedefProvider {
readonly as?: Token;
};

/**
* If this function is part of a FunctionStatement, this will be set. Otherwise this will be undefined
*/
public functionStatement?: FunctionStatement;

public get leadingTrivia(): Token[] {
return this.tokens.functionType?.leadingTrivia;
}
Expand Down Expand Up @@ -1279,9 +1274,11 @@ export class SourceLiteralExpression extends Expression {
func = parentFunction;
}
//get the index of this function in its parent
nameParts.unshift(
func.functionStatement!.getName(parseMode)
);
if (isFunctionStatement(func.parent)) {
nameParts.unshift(
func.parent.getName(parseMode)
);
}
return nameParts.join('$');
}

Expand Down
1 change: 0 additions & 1 deletion src/parser/Statement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,6 @@ export class FunctionStatement extends Statement implements TypedefProvider {
};
this.func = options.func;
this.func.symbolTable.name += `: '${this.tokens.name?.text}'`;
this.func.functionStatement = this;

this.location = this.func.location;
}
Expand Down

0 comments on commit 353f463

Please sign in to comment.