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

Remove function scope and improve type tracking #401

Merged
merged 28 commits into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a24b93f
Add `for each` variable to completions
TwitchBronBron Dec 18, 2020
e4d01fa
ForEachStatement's `item` is now VaribleExpression
TwitchBronBron Dec 18, 2020
fc2100f
Fix ts build issue.
TwitchBronBron Dec 18, 2020
04d7b72
fix broken tests
TwitchBronBron Dec 18, 2020
91a7d21
Merge branch 'master' into for-each-var-completions
TwitchBronBron Dec 19, 2020
0e4589e
fix broken test.
TwitchBronBron Dec 19, 2020
948400c
Collection function variables in _references
TwitchBronBron Dec 19, 2020
4aa2f0d
Removed FunctionScope in favor of func expressions
TwitchBronBron Dec 21, 2020
2ab29ef
Merge branch 'master' into for-each-var-completions
TwitchBronBron Jan 13, 2021
62a6103
Merge branch 'master' of https://github.com/rokucommunity/brighterscr…
TwitchBronBron Jan 13, 2021
ea4f72e
lint and interface fixes
TwitchBronBron Jan 13, 2021
5613304
Repopulate `references.localVars` during `findReferences`
TwitchBronBron Jan 13, 2021
b1a93ce
Merge branch 'master' into for-each-var-completions
TwitchBronBron Jan 15, 2021
f916694
Handle sub with explicit return type
TwitchBronBron Jan 15, 2021
73c432c
Fix `findReferences` for local vars
TwitchBronBron Jan 15, 2021
03c99a8
Merge branch 'master' into for-each-var-completions
TwitchBronBron Jan 30, 2021
f2dc8f0
Merge branch 'master' into for-each-var-completions
TwitchBronBron Jan 30, 2021
b47b3a5
Normalize line endings for Scope.ts
TwitchBronBron Jan 30, 2021
eb6dad6
Merge branch 'master' into for-each-var-completions
TwitchBronBron Mar 16, 2021
c2a825b
Merge branch 'master' of https://github.com/rokucommunity/brighterscr…
TwitchBronBron Mar 16, 2021
54c356f
Merge branch 'master' into for-each-var-completions
TwitchBronBron Mar 16, 2021
60284a4
Merge branch 'master' of https://github.com/rokucommunity/brighterscr…
TwitchBronBron Mar 30, 2021
8fe2bf7
Feature/symbol table (#380)
markwpearce Apr 1, 2021
65c0d92
Feature/scope tracked symbol tables (#395)
markwpearce Apr 23, 2021
db329b0
Merge branch 'master' of https://github.com/rokucommunity/brighterscr…
TwitchBronBron Apr 23, 2021
3de6f45
Merge branch 'v1' of https://github.com/rokucommunity/brighterscript …
TwitchBronBron Apr 23, 2021
ac0a277
del `references.localVars` in favor of SymbolTable
TwitchBronBron May 3, 2021
3fd0559
Move private _symbolTable below the getter
TwitchBronBron May 3, 2021
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
5 changes: 5 additions & 0 deletions src/DiagnosticMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,11 @@ export let DiagnosticMessages = {
message: `Missing expression(s) in 'dim' statement`,
code: 1121,
severity: DiagnosticSeverity.Error
}),
argumentTypeMismatch: (actualTypeString: string, expectedTypeString: string) => ({
message: `Argument of type '${actualTypeString}' is not assignable to parameter of type '${expectedTypeString}'`,
code: 1122,
severity: DiagnosticSeverity.Error
})
};

Expand Down
40 changes: 0 additions & 40 deletions src/FunctionScope.spec.ts

This file was deleted.

54 changes: 0 additions & 54 deletions src/FunctionScope.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/Program.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1582,9 +1582,9 @@ describe('Program', () => {
end sub
`);
let completions = program.getCompletions(`${rootDir}/source/main.brs`, Position.create(2, 10));
let labels = completions.map(x => pick(x, 'label'));
let labels = completions.map(x => x.label);

expect(labels).to.deep.include({ label: 'count' });
expect(labels).to.include('count');
});
});

Expand Down
6 changes: 3 additions & 3 deletions src/Program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ export class Program {

const results = new Map<string, SignatureInfoObj>();

let functionScope = file.getFunctionScopeAtPosition(position);
let functionExpression = file.getFunctionExpressionAtPosition(position);
let identifierInfo = this.getPartialStatementInfo(file, position);
if (identifierInfo.statementType === '') {
// just general function calls
Expand All @@ -908,8 +908,8 @@ export class Program {
} else if (identifierInfo.statementType === '.') {
//if m class reference.. then
//only get statements from the class I am in..
if (functionScope) {
let myClass = file.getClassFromMReference(position, file.getTokenAt(position), functionScope);
if (functionExpression) {
let myClass = file.getClassFromMReference(position, file.getTokenAt(position), functionExpression);
if (myClass) {
for (let scope of this.getScopesForFile(myClass.file)) {
let classes = scope.getClassHierarchy(myClass.item.getName(ParseMode.BrighterScript).toLowerCase());
Expand Down
Loading