Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create common ancestor for Expression and Statement #693

Merged
merged 2 commits into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions src/Program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ import { globalFile } from './globalCallables';
import { parseManifest } from './preprocessor/Manifest';
import { URI } from 'vscode-uri';
import PluginInterface from './PluginInterface';
import { isBrsFile, isXmlFile, isClassMethodStatement, isXmlScope } from './astUtils/reflection';
import type { FunctionStatement, Statement } from './parser/Statement';
import { isBrsFile, isXmlFile, isMethodStatement, isXmlScope } from './astUtils/reflection';
import type { FunctionStatement } from './parser/Statement';
import { ParseMode } from './parser/Parser';
import { TokenKind } from './lexer/TokenKind';
import { BscPlugin } from './bscPlugin/BscPlugin';
import { AstEditor } from './astUtils/AstEditor';
import type { SourceMapGenerator } from 'source-map';
import { rokuDeploy } from 'roku-deploy';
import type { Statement } from './parser/AstNode';

const startOfSourcePkgPath = `source${path.sep}`;
const bslibNonAliasedRokuModulesPkgPath = s`source/roku_modules/rokucommunity_bslib/bslib.brs`;
Expand Down Expand Up @@ -1040,7 +1041,7 @@ export class Program {
for (let scope of this.getScopesForFile(myClass.file)) {
let classes = scope.getClassHierarchy(myClass.item.getName(ParseMode.BrighterScript).toLowerCase());
//and anything from any class in scope to a non m class
for (let statement of [...classes].filter((i) => isClassMethodStatement(i.item))) {
for (let statement of [...classes].filter((i) => isMethodStatement(i.item))) {
let sigHelp = statement.file.getSignatureHelpForStatement(statement.item);
if (sigHelp && !results.has[sigHelp.key]) {

Expand Down
3 changes: 2 additions & 1 deletion src/Scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { DiagnosticMessages } from './DiagnosticMessages';
import type { CallableContainer, BsDiagnostic, FileReference, BscFile, CallableContainerMap, FileLink } from './interfaces';
import type { Program } from './Program';
import { BsClassValidator } from './validators/ClassValidator';
import type { NamespaceStatement, Statement, FunctionStatement, ClassStatement, EnumStatement, InterfaceStatement, EnumMemberStatement, ConstStatement } from './parser/Statement';
import type { NamespaceStatement, FunctionStatement, ClassStatement, EnumStatement, InterfaceStatement, EnumMemberStatement, ConstStatement } from './parser/Statement';
import type { NewExpression } from './parser/Expression';
import { ParseMode } from './parser/Parser';
import { standardizePath as s, util } from './util';
Expand All @@ -19,6 +19,7 @@ import type { BrsFile } from './files/BrsFile';
import type { DependencyGraph, DependencyChangedEvent } from './DependencyGraph';
import { isBrsFile, isClassMethodStatement, isClassStatement, isConstStatement, isCustomType, isEnumStatement, isFunctionStatement, isFunctionType, isXmlFile } from './astUtils/reflection';
import { SymbolTable } from './SymbolTable';
import type { Statement } from './parser/AstNode';

/**
* A class to keep track of all declarations within a given scope (like source scope, component scope)
Expand Down
5 changes: 2 additions & 3 deletions src/astUtils/AstEditor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Expression } from '../parser/Expression';
import type { Statement } from '../parser/Statement';
import type { AstNode } from '../parser/AstNode';

export class AstEditor {
private changes: Change[] = [];
Expand Down Expand Up @@ -32,7 +31,7 @@ export class AstEditor {
/**
* Set custom text that will be emitted during transpile instead of the original text.
*/
public overrideTranspileResult(node: Expression | Statement, value: string) {
public overrideTranspileResult(node: AstNode, value: string) {
this.setProperty(node, 'transpile', (state) => {
return [
state.sourceNode(node, value)
Expand Down
3 changes: 2 additions & 1 deletion src/astUtils/creators.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { Range } from 'vscode-languageserver';
import type { Identifier, Token } from '../lexer/Token';
import { TokenKind } from '../lexer/TokenKind';
import type { Expression, NamespacedVariableNameExpression } from '../parser/Expression';
import type { Expression } from '../parser/AstNode';
import type { NamespacedVariableNameExpression } from '../parser/Expression';
import { LiteralExpression, CallExpression, DottedGetExpression, VariableExpression, FunctionExpression } from '../parser/Expression';
import type { SGAttribute } from '../parser/SGTypes';
import { Block, MethodStatement } from '../parser/Statement';
Expand Down
Loading