brighterscript 1.0.0-alpha.52 → 1.0.0-alpha.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/bsconfig.schema.json +151 -0
- package/dist/BsConfig.d.ts +158 -44
- package/dist/BsConfig.js +24 -0
- package/dist/BsConfig.js.map +1 -1
- package/dist/BusyStatusTracker.js +3 -0
- package/dist/BusyStatusTracker.js.map +1 -1
- package/dist/CrossScopeValidator.js +5 -0
- package/dist/CrossScopeValidator.js.map +1 -1
- package/dist/DiagnosticFilterer.d.ts +17 -1
- package/dist/DiagnosticFilterer.js +69 -6
- package/dist/DiagnosticFilterer.js.map +1 -1
- package/dist/DiagnosticManager.d.ts +11 -1
- package/dist/DiagnosticManager.js +22 -3
- package/dist/DiagnosticManager.js.map +1 -1
- package/dist/DiagnosticMessages.d.ts +93 -4
- package/dist/DiagnosticMessages.js +91 -5
- package/dist/DiagnosticMessages.js.map +1 -1
- package/dist/LanguageServer.d.ts +15 -3
- package/dist/LanguageServer.js +53 -6
- package/dist/LanguageServer.js.map +1 -1
- package/dist/Logger.d.ts +7 -7
- package/dist/Logger.js +2 -2
- package/dist/Logger.js.map +1 -1
- package/dist/PluginInterface.js +2 -1
- package/dist/PluginInterface.js.map +1 -1
- package/dist/Program.d.ts +106 -9
- package/dist/Program.js +273 -23
- package/dist/Program.js.map +1 -1
- package/dist/ProgramBuilder.js +6 -0
- package/dist/ProgramBuilder.js.map +1 -1
- package/dist/RokuConstants.d.ts +123 -0
- package/dist/RokuConstants.js +87 -0
- package/dist/RokuConstants.js.map +1 -0
- package/dist/ScopeNamespaceLookup.js.map +1 -1
- package/dist/Stopwatch.js +2 -2
- package/dist/Stopwatch.js.map +1 -1
- package/dist/SymbolTable.d.ts +1 -0
- package/dist/SymbolTable.js +20 -12
- package/dist/SymbolTable.js.map +1 -1
- package/dist/Throttler.d.ts +1 -1
- package/dist/Throttler.js.map +1 -1
- package/dist/astUtils/reflection.d.ts +6 -1
- package/dist/astUtils/reflection.js +15 -4
- package/dist/astUtils/reflection.js.map +1 -1
- package/dist/astUtils/visitors.d.ts +1 -1
- package/dist/astUtils/visitors.js +2 -0
- package/dist/astUtils/visitors.js.map +1 -1
- package/dist/bscPlugin/BscPlugin.d.ts +2 -2
- package/dist/bscPlugin/BscPlugin.js +1 -1
- package/dist/bscPlugin/BscPlugin.js.map +1 -1
- package/dist/bscPlugin/CallExpressionInfo.js.map +1 -1
- package/dist/bscPlugin/SignatureHelpUtil.js.map +1 -1
- package/dist/bscPlugin/codeActions/FixAllCodeActionsProcessor.d.ts +3 -3
- package/dist/bscPlugin/codeActions/FixAllCodeActionsProcessor.js.map +1 -1
- package/dist/bscPlugin/completions/CompletionsProcessor.js +2 -3
- package/dist/bscPlugin/completions/CompletionsProcessor.js.map +1 -1
- package/dist/bscPlugin/definition/DefinitionProvider.d.ts +67 -2
- package/dist/bscPlugin/definition/DefinitionProvider.js +244 -5
- package/dist/bscPlugin/definition/DefinitionProvider.js.map +1 -1
- package/dist/bscPlugin/references/ReferencesProvider.js +7 -1
- package/dist/bscPlugin/references/ReferencesProvider.js.map +1 -1
- package/dist/bscPlugin/validation/BrsFileValidator.d.ts +40 -6
- package/dist/bscPlugin/validation/BrsFileValidator.js +109 -18
- package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -1
- package/dist/bscPlugin/validation/ProgramValidator.d.ts +10 -0
- package/dist/bscPlugin/validation/ProgramValidator.js +54 -0
- package/dist/bscPlugin/validation/ProgramValidator.js.map +1 -1
- package/dist/bscPlugin/validation/ScopeValidator.js +55 -30
- package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -1
- package/dist/bscPlugin/validation/XmlFileValidator.d.ts +18 -0
- package/dist/bscPlugin/validation/XmlFileValidator.js +51 -0
- package/dist/bscPlugin/validation/XmlFileValidator.js.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/diagnosticUtils.d.ts +1 -1
- package/dist/diagnosticUtils.js.map +1 -1
- package/dist/files/BrsFile.d.ts +2 -2
- package/dist/files/BrsFile.js +2 -2
- package/dist/files/BrsFile.js.map +1 -1
- package/dist/files/XmlFile.d.ts +51 -1
- package/dist/files/XmlFile.js +264 -0
- package/dist/files/XmlFile.js.map +1 -1
- package/dist/formatUtils.d.ts +20 -0
- package/dist/formatUtils.js +38 -0
- package/dist/formatUtils.js.map +1 -0
- package/dist/globalCallables.d.ts +1 -1
- package/dist/globalCallables.js +4 -1
- package/dist/globalCallables.js.map +1 -1
- package/dist/interfaces.d.ts +60 -5
- package/dist/interfaces.js.map +1 -1
- package/dist/lexer/Lexer.d.ts +26 -0
- package/dist/lexer/Lexer.js +140 -15
- package/dist/lexer/Lexer.js.map +1 -1
- package/dist/lexer/TokenKind.d.ts +27 -0
- package/dist/lexer/TokenKind.js +77 -3
- package/dist/lexer/TokenKind.js.map +1 -1
- package/dist/lsp/ActionQueue.js +1 -2
- package/dist/lsp/ActionQueue.js.map +1 -1
- package/dist/lsp/DocumentManager.js +4 -0
- package/dist/lsp/DocumentManager.js.map +1 -1
- package/dist/lsp/LspProject.d.ts +2 -2
- package/dist/lsp/Project.d.ts +2 -2
- package/dist/lsp/Project.js +2 -0
- package/dist/lsp/Project.js.map +1 -1
- package/dist/lsp/ProjectManager.d.ts +7 -2
- package/dist/lsp/ProjectManager.js +3 -1
- package/dist/lsp/ProjectManager.js.map +1 -1
- package/dist/lsp/worker/MessageHandler.d.ts +1 -0
- package/dist/lsp/worker/MessageHandler.js +9 -0
- package/dist/lsp/worker/MessageHandler.js.map +1 -1
- package/dist/lsp/worker/WorkerPool.d.ts +51 -17
- package/dist/lsp/worker/WorkerPool.js +118 -40
- package/dist/lsp/worker/WorkerPool.js.map +1 -1
- package/dist/lsp/worker/WorkerThreadProject.d.ts +16 -3
- package/dist/lsp/worker/WorkerThreadProject.js +50 -10
- package/dist/lsp/worker/WorkerThreadProject.js.map +1 -1
- package/dist/lsp/worker/WorkerThreadProjectRunner.js +6 -0
- package/dist/lsp/worker/WorkerThreadProjectRunner.js.map +1 -1
- package/dist/lsp/worker/run.js +20 -3
- package/dist/lsp/worker/run.js.map +1 -1
- package/dist/parser/AstNode.d.ts +59 -2
- package/dist/parser/AstNode.js +63 -5
- package/dist/parser/AstNode.js.map +1 -1
- package/dist/parser/BrsTranspileState.d.ts +44 -0
- package/dist/parser/BrsTranspileState.js +49 -0
- package/dist/parser/BrsTranspileState.js.map +1 -1
- package/dist/parser/Expression.d.ts +56 -8
- package/dist/parser/Expression.js +91 -8
- package/dist/parser/Expression.js.map +1 -1
- package/dist/parser/Parser.d.ts +0 -5
- package/dist/parser/Parser.js +5 -9
- package/dist/parser/Parser.js.map +1 -1
- package/dist/parser/SGParser.d.ts +7 -1
- package/dist/parser/SGParser.js +20 -10
- package/dist/parser/SGParser.js.map +1 -1
- package/dist/parser/SGTypes.js +8 -2
- package/dist/parser/SGTypes.js.map +1 -1
- package/dist/parser/Statement.d.ts +21 -10
- package/dist/parser/Statement.js +61 -1
- package/dist/parser/Statement.js.map +1 -1
- package/dist/preprocessor/Manifest.d.ts +16 -0
- package/dist/preprocessor/Manifest.js +21 -5
- package/dist/preprocessor/Manifest.js.map +1 -1
- package/dist/roku-types/index.d.ts +3 -0
- package/dist/types/BuiltInInterfaceAdder.js +1 -1
- package/dist/types/BuiltInInterfaceAdder.js.map +1 -1
- package/dist/types/InheritableType.d.ts +0 -1
- package/dist/types/InheritableType.js +12 -11
- package/dist/types/InheritableType.js.map +1 -1
- package/dist/types/InterfaceType.js +6 -0
- package/dist/types/InterfaceType.js.map +1 -1
- package/dist/types/IntersectionType.d.ts +1 -1
- package/dist/types/IntersectionType.js +7 -7
- package/dist/types/IntersectionType.js.map +1 -1
- package/dist/types/ReferenceType.js +1 -1
- package/dist/types/ReferenceType.js.map +1 -1
- package/dist/types/helpers.d.ts +2 -2
- package/dist/types/helpers.js +8 -5
- package/dist/types/helpers.js.map +1 -1
- package/dist/util.d.ts +38 -4
- package/dist/util.js +296 -29
- package/dist/util.js.map +1 -1
- package/package.json +12 -18
package/dist/parser/AstNode.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { WalkVisitor, WalkOptions } from '../astUtils/visitors';
|
|
2
|
-
import type { Location, Position } from 'vscode-languageserver';
|
|
2
|
+
import type { Location, Position, Range } from 'vscode-languageserver';
|
|
3
3
|
import { CancellationTokenSource } from 'vscode-languageserver';
|
|
4
4
|
import { InternalWalkMode } from '../astUtils/visitors';
|
|
5
5
|
import type { SymbolTable } from '../SymbolTable';
|
|
@@ -17,6 +17,10 @@ export declare abstract class AstNode {
|
|
|
17
17
|
* The starting and ending location of the node.
|
|
18
18
|
*/
|
|
19
19
|
abstract location?: Location | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated use `location.range` instead
|
|
22
|
+
*/
|
|
23
|
+
get range(): Range | undefined;
|
|
20
24
|
abstract transpile(state: BrsTranspileState): TranspileResult;
|
|
21
25
|
/**
|
|
22
26
|
* Optional property, set at the top level with a map of conditional compile consts and their values
|
|
@@ -49,6 +53,7 @@ export declare abstract class AstNode {
|
|
|
49
53
|
* @param matcher a function called for each node. If you return true, this function returns the specified node. If you return a node, that node is returned. all other return values continue the loop
|
|
50
54
|
* The function's second parameter is a cancellation token. If you'd like to short-circuit the walk, call `cancellationToken.cancel()`, then this function will return `undefined`
|
|
51
55
|
*/
|
|
56
|
+
findAncestor<TNode extends AstNode = AstNode>(matcher: (node: AstNode) => node is TNode): TNode | undefined;
|
|
52
57
|
findAncestor<TNode extends AstNode = AstNode>(matcher: (node: AstNode, cancellationToken: CancellationTokenSource) => boolean | AstNode | undefined | void): TNode | undefined;
|
|
53
58
|
/**
|
|
54
59
|
* Find the first child where the matcher evaluates to true.
|
|
@@ -88,11 +93,62 @@ export declare abstract class AstNode {
|
|
|
88
93
|
*/
|
|
89
94
|
get endTrivia(): Token[];
|
|
90
95
|
getBsConsts(): any;
|
|
96
|
+
/**
|
|
97
|
+
* The previous step in this expression, or undefined if this node doesn't build on another
|
|
98
|
+
* expression. Overridden by dotted/indexed gets, calls, and other chaining nodes.
|
|
99
|
+
*
|
|
100
|
+
* Each node in a chain spans a whole prefix of the source, so this walks to the next-shorter
|
|
101
|
+
* prefix. Given `a.b.c`, there are only three nodes:
|
|
102
|
+
* ```
|
|
103
|
+
* a.b.c .previousInChain -> a.b
|
|
104
|
+
* a.b .previousInChain -> a
|
|
105
|
+
* a .previousInChain -> undefined
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* This walks toward the AST *child*, since chains are stored inverted: the full expression is
|
|
109
|
+
* the top node and its base is the deepest descendant. It is not `parent` reversed though -
|
|
110
|
+
* arguments and index values have a `parent`, but are never anything's `previousInChain`,
|
|
111
|
+
* because they're separate expressions that merely sit inside this one:
|
|
112
|
+
* ```
|
|
113
|
+
* a.b(arg) //CallExpression.previousInChain is `a.b`, NOT `arg`
|
|
114
|
+
* a[i] //IndexedGetExpression.previousInChain is `a`, NOT `i`
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
get previousInChain(): AstNode | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* Is this node a complete expression, rather than one step inside a longer one?
|
|
120
|
+
*
|
|
121
|
+
* True when nothing chains onto this node. Statements are always terminal. Use this to find
|
|
122
|
+
* whole expressions while walking, instead of also matching every prefix inside them.
|
|
123
|
+
*
|
|
124
|
+
* ```
|
|
125
|
+
* print a.b.c(arg)
|
|
126
|
+
*
|
|
127
|
+
* //a.b.c(arg) yes - the whole expression
|
|
128
|
+
* //a.b.c no - a.b.c(arg) chains onto it
|
|
129
|
+
* //a.b no - a.b.c chains onto it
|
|
130
|
+
* //a no - a.b chains onto it
|
|
131
|
+
* //arg yes - an argument, so an expression of its own
|
|
132
|
+
* ```
|
|
133
|
+
*
|
|
134
|
+
* An argument is terminal no matter how long it is, because nothing chains onto it. Both of
|
|
135
|
+
* these are terminal, even though they sit inside the call:
|
|
136
|
+
* ```
|
|
137
|
+
* print doSomething(x.y, 1 + 2)
|
|
138
|
+
*
|
|
139
|
+
* //x.y yes
|
|
140
|
+
* //1 + 2 yes
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* Requires `parent` to be set, so the node must already be linked (see `link()`). An
|
|
144
|
+
* unlinked node has no parent, so it reports `true`.
|
|
145
|
+
*/
|
|
146
|
+
isTerminal(): boolean;
|
|
91
147
|
/**
|
|
92
148
|
* Clone this node and all of its children. This creates a completely detached and identical copy of the AST.
|
|
93
149
|
* All tokens, statements, expressions, range, and location are cloned.
|
|
94
150
|
*/
|
|
95
|
-
abstract clone():
|
|
151
|
+
abstract clone(): AstNode;
|
|
96
152
|
/**
|
|
97
153
|
* Helper function for creating a clone. This will clone any attached annotations, as well as reparent the cloned node's children to the clone
|
|
98
154
|
*/
|
|
@@ -120,6 +176,7 @@ export declare abstract class Expression extends AstNode {
|
|
|
120
176
|
* When being considered by the walk visitor, this describes what type of element the current class is.
|
|
121
177
|
*/
|
|
122
178
|
visitMode: InternalWalkMode;
|
|
179
|
+
abstract clone(): Expression;
|
|
123
180
|
}
|
|
124
181
|
export declare enum AstNodeKind {
|
|
125
182
|
Body = "Body",
|
package/dist/parser/AstNode.js
CHANGED
|
@@ -17,6 +17,13 @@ class AstNode {
|
|
|
17
17
|
*/
|
|
18
18
|
this.visitMode = visitors_2.InternalWalkMode.visitStatements;
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated use `location.range` instead
|
|
22
|
+
*/
|
|
23
|
+
get range() {
|
|
24
|
+
var _a;
|
|
25
|
+
return (_a = this.location) === null || _a === void 0 ? void 0 : _a.range;
|
|
26
|
+
}
|
|
20
27
|
/**
|
|
21
28
|
* Get the typedef for this node. (defaults to transpiling the node, should be overridden by subclasses if there's a more specific typedef requirement)
|
|
22
29
|
*/
|
|
@@ -39,11 +46,6 @@ class AstNode {
|
|
|
39
46
|
//but it is not so easy to convince the typechecker of this.
|
|
40
47
|
return undefined;
|
|
41
48
|
}
|
|
42
|
-
/**
|
|
43
|
-
* Walk upward and return the first node that results in `true` from the matcher.
|
|
44
|
-
* @param matcher a function called for each node. If you return true, this function returns the specified node. If you return a node, that node is returned. all other return values continue the loop
|
|
45
|
-
* The function's second parameter is a cancellation token. If you'd like to short-circuit the walk, call `cancellationToken.cancel()`, then this function will return `undefined`
|
|
46
|
-
*/
|
|
47
49
|
findAncestor(matcher) {
|
|
48
50
|
let node = this.parent;
|
|
49
51
|
const cancel = new vscode_languageserver_1.CancellationTokenSource();
|
|
@@ -149,6 +151,62 @@ class AstNode {
|
|
|
149
151
|
var _a, _b, _c;
|
|
150
152
|
return (_a = this.bsConsts) !== null && _a !== void 0 ? _a : (_c = (_b = this.parent) === null || _b === void 0 ? void 0 : _b.getBsConsts) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
151
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* The previous step in this expression, or undefined if this node doesn't build on another
|
|
156
|
+
* expression. Overridden by dotted/indexed gets, calls, and other chaining nodes.
|
|
157
|
+
*
|
|
158
|
+
* Each node in a chain spans a whole prefix of the source, so this walks to the next-shorter
|
|
159
|
+
* prefix. Given `a.b.c`, there are only three nodes:
|
|
160
|
+
* ```
|
|
161
|
+
* a.b.c .previousInChain -> a.b
|
|
162
|
+
* a.b .previousInChain -> a
|
|
163
|
+
* a .previousInChain -> undefined
|
|
164
|
+
* ```
|
|
165
|
+
*
|
|
166
|
+
* This walks toward the AST *child*, since chains are stored inverted: the full expression is
|
|
167
|
+
* the top node and its base is the deepest descendant. It is not `parent` reversed though -
|
|
168
|
+
* arguments and index values have a `parent`, but are never anything's `previousInChain`,
|
|
169
|
+
* because they're separate expressions that merely sit inside this one:
|
|
170
|
+
* ```
|
|
171
|
+
* a.b(arg) //CallExpression.previousInChain is `a.b`, NOT `arg`
|
|
172
|
+
* a[i] //IndexedGetExpression.previousInChain is `a`, NOT `i`
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
get previousInChain() {
|
|
176
|
+
return undefined;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Is this node a complete expression, rather than one step inside a longer one?
|
|
180
|
+
*
|
|
181
|
+
* True when nothing chains onto this node. Statements are always terminal. Use this to find
|
|
182
|
+
* whole expressions while walking, instead of also matching every prefix inside them.
|
|
183
|
+
*
|
|
184
|
+
* ```
|
|
185
|
+
* print a.b.c(arg)
|
|
186
|
+
*
|
|
187
|
+
* //a.b.c(arg) yes - the whole expression
|
|
188
|
+
* //a.b.c no - a.b.c(arg) chains onto it
|
|
189
|
+
* //a.b no - a.b.c chains onto it
|
|
190
|
+
* //a no - a.b chains onto it
|
|
191
|
+
* //arg yes - an argument, so an expression of its own
|
|
192
|
+
* ```
|
|
193
|
+
*
|
|
194
|
+
* An argument is terminal no matter how long it is, because nothing chains onto it. Both of
|
|
195
|
+
* these are terminal, even though they sit inside the call:
|
|
196
|
+
* ```
|
|
197
|
+
* print doSomething(x.y, 1 + 2)
|
|
198
|
+
*
|
|
199
|
+
* //x.y yes
|
|
200
|
+
* //1 + 2 yes
|
|
201
|
+
* ```
|
|
202
|
+
*
|
|
203
|
+
* Requires `parent` to be set, so the node must already be linked (see `link()`). An
|
|
204
|
+
* unlinked node has no parent, so it reports `true`.
|
|
205
|
+
*/
|
|
206
|
+
isTerminal() {
|
|
207
|
+
//walk up, then back down: if we don't land on ourselves, nothing chains onto us
|
|
208
|
+
return this.parent === undefined || this.parent.previousInChain !== this;
|
|
209
|
+
}
|
|
152
210
|
/**
|
|
153
211
|
* Helper function for creating a clone. This will clone any attached annotations, as well as reparent the cloned node's children to the clone
|
|
154
212
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AstNode.js","sourceRoot":"","sources":["../../src/parser/AstNode.ts"],"names":[],"mappings":";;;AACA,mDAAgD;AAEhD,iEAAgE;AAChE,mDAAwD;AAKxD,kCAA2B;AAC3B,sDAAmD;AAGnD,uDAAwF;AAExF;;GAEG;AACH,MAAsB,OAAO;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;IAC3C,gDAAiC,CAAA;IACjC,sDAAuC,CAAA;IACvC,8BAAe,CAAA;IACf,gDAAiC,CAAA;IACjC,wDAAyC,CAAA;IACzC,4DAA6C,CAAA;IAC7C,sDAAuC,CAAA;IACvC,gDAAiC,CAAA;IACjC,0EAA2D,CAAA;IAC3D,oFAAqE,CAAA;IACrE,oFAAqE,CAAA;IACrE,4EAA6D,CAAA;IAC7D,oEAAqD,CAAA;IACrD,sEAAuD,CAAA;IACvD,kFAAmE,CAAA;IACnE,8CAA+B,CAAA;IAC/B,0EAA2D,CAAA;AAC/D,CAAC,EAjFW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAiFtB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Location } from 'vscode-languageserver';
|
|
2
2
|
import { Editor } from '../astUtils/Editor';
|
|
3
3
|
import type { BrsFile } from '../files/BrsFile';
|
|
4
|
+
import type { FirmwareCapabilities } from '../RokuConstants';
|
|
4
5
|
import type { ClassStatement, ConditionalCompileStatement } from './Statement';
|
|
5
6
|
import { TranspileState } from './TranspileState';
|
|
6
7
|
import type { Statement } from './AstNode';
|
|
@@ -39,4 +40,47 @@ export declare class BrsTranspileState extends TranspileState {
|
|
|
39
40
|
* Transpile all leading trivia for a given statement, including comments mixed between annotations
|
|
40
41
|
*/
|
|
41
42
|
transpileAnnotations(node: Statement): (string | import("source-map").SourceNode)[][];
|
|
43
|
+
/**
|
|
44
|
+
* What the target firmware natively understands. Captured once when the state is created —
|
|
45
|
+
* capabilities are derived from config and cannot change partway through a transpile.
|
|
46
|
+
*/
|
|
47
|
+
readonly firmwareCapabilities: FirmwareCapabilities;
|
|
48
|
+
/**
|
|
49
|
+
* Stack of loop-label trackers, one per enclosing loop currently being transpiled. Only used
|
|
50
|
+
* when `continue` must be rewritten as a `goto` for firmware older than
|
|
51
|
+
* CONTINUE_MIN_FIRMWARE_VERSION.
|
|
52
|
+
*/
|
|
53
|
+
private loopLabels;
|
|
54
|
+
private loopLabelSequence;
|
|
55
|
+
/**
|
|
56
|
+
* Begin tracking a loop label for the loop about to be transpiled. The label is allocated
|
|
57
|
+
* eagerly but only emitted if a nested `continue` actually asks for it via `getLoopLabel()`.
|
|
58
|
+
* `blockDepth` records the depth the loop's own body block will occupy, so the block that
|
|
59
|
+
* emits the label can tell whether the label belongs to it or to a nested loop.
|
|
60
|
+
*/
|
|
61
|
+
pushLoopLabel(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Look at the innermost loop label without removing it. Used by Block.transpile to decide
|
|
64
|
+
* whether it owns the pending label.
|
|
65
|
+
*/
|
|
66
|
+
peekLoopLabel(): {
|
|
67
|
+
label: string;
|
|
68
|
+
wasAccessed: boolean;
|
|
69
|
+
blockDepth: number;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Stop tracking the innermost loop label. Returns the tracker so the loop can decide whether
|
|
73
|
+
* it needs to emit the end-of-body label (i.e. when `wasAccessed` is true).
|
|
74
|
+
*/
|
|
75
|
+
popLoopLabel(): {
|
|
76
|
+
label: string;
|
|
77
|
+
wasAccessed: boolean;
|
|
78
|
+
blockDepth: number;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Get the label marking the end of the innermost loop body, flagging it as needed so the
|
|
82
|
+
* enclosing loop knows to emit the label itself. Returns undefined when there is no enclosing
|
|
83
|
+
* loop (a `continue` outside a loop, which validation already flags as an error).
|
|
84
|
+
*/
|
|
85
|
+
getLoopLabel(): string;
|
|
42
86
|
}
|
|
@@ -21,7 +21,15 @@ class BrsTranspileState extends TranspileState_1.TranspileState {
|
|
|
21
21
|
* Do not transpile leading comments
|
|
22
22
|
*/
|
|
23
23
|
this.skipLeadingComments = false;
|
|
24
|
+
/**
|
|
25
|
+
* Stack of loop-label trackers, one per enclosing loop currently being transpiled. Only used
|
|
26
|
+
* when `continue` must be rewritten as a `goto` for firmware older than
|
|
27
|
+
* CONTINUE_MIN_FIRMWARE_VERSION.
|
|
28
|
+
*/
|
|
29
|
+
this.loopLabels = [];
|
|
30
|
+
this.loopLabelSequence = 0;
|
|
24
31
|
this.bslibPrefix = this.file.program.bslibPrefix;
|
|
32
|
+
this.firmwareCapabilities = this.file.program.firmwareCapabilities;
|
|
25
33
|
}
|
|
26
34
|
/**
|
|
27
35
|
* Transpile all leading trivia for a given statement, including comments mixed between annotations
|
|
@@ -32,6 +40,47 @@ class BrsTranspileState extends TranspileState_1.TranspileState {
|
|
|
32
40
|
return x.transpile(this);
|
|
33
41
|
});
|
|
34
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Begin tracking a loop label for the loop about to be transpiled. The label is allocated
|
|
45
|
+
* eagerly but only emitted if a nested `continue` actually asks for it via `getLoopLabel()`.
|
|
46
|
+
* `blockDepth` records the depth the loop's own body block will occupy, so the block that
|
|
47
|
+
* emits the label can tell whether the label belongs to it or to a nested loop.
|
|
48
|
+
*/
|
|
49
|
+
pushLoopLabel() {
|
|
50
|
+
this.loopLabels.push({
|
|
51
|
+
label: `BRIGHTERSCRIPT_CONTINUE_${this.loopLabelSequence++}`,
|
|
52
|
+
wasAccessed: false,
|
|
53
|
+
//the loop body block increments blockDepth before emitting its statements
|
|
54
|
+
blockDepth: this.blockDepth + 1
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Look at the innermost loop label without removing it. Used by Block.transpile to decide
|
|
59
|
+
* whether it owns the pending label.
|
|
60
|
+
*/
|
|
61
|
+
peekLoopLabel() {
|
|
62
|
+
return this.loopLabels[this.loopLabels.length - 1];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Stop tracking the innermost loop label. Returns the tracker so the loop can decide whether
|
|
66
|
+
* it needs to emit the end-of-body label (i.e. when `wasAccessed` is true).
|
|
67
|
+
*/
|
|
68
|
+
popLoopLabel() {
|
|
69
|
+
return this.loopLabels.pop();
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Get the label marking the end of the innermost loop body, flagging it as needed so the
|
|
73
|
+
* enclosing loop knows to emit the label itself. Returns undefined when there is no enclosing
|
|
74
|
+
* loop (a `continue` outside a loop, which validation already flags as an error).
|
|
75
|
+
*/
|
|
76
|
+
getLoopLabel() {
|
|
77
|
+
const loopLabel = this.loopLabels[this.loopLabels.length - 1];
|
|
78
|
+
if (!loopLabel) {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
loopLabel.wasAccessed = true;
|
|
82
|
+
return loopLabel.label;
|
|
83
|
+
}
|
|
35
84
|
}
|
|
36
85
|
exports.BrsTranspileState = BrsTranspileState;
|
|
37
86
|
//# sourceMappingURL=BrsTranspileState.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrsTranspileState.js","sourceRoot":"","sources":["../../src/parser/BrsTranspileState.ts"],"names":[],"mappings":";;;AACA,+CAA4C;
|
|
1
|
+
{"version":3,"file":"BrsTranspileState.js","sourceRoot":"","sources":["../../src/parser/BrsTranspileState.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAI5C,qDAAkD;AAGlD,MAAa,iBAAkB,SAAQ,+BAAc;IACjD,YACW,IAAa;QAEpB,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAFnC,SAAI,GAAJ,IAAI,CAAS;QAYxB;;;WAGG;QACH,YAAO,GAAG,EAER,CAAC;QAOH;;;WAGG;QACI,WAAM,GAAG,IAAI,eAAM,EAAE,CAAC;QAO7B;;WAEG;QACI,wBAAmB,GAAG,KAAK,CAAC;QAgBnC;;;;WAIG;QACK,eAAU,GAAG,EAAwE,CAAC;QAEtF,sBAAiB,GAAG,CAAC,CAAC;QA3D1B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;QACjD,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;IACvE,CAAC;IAoCD;;OAEG;IACI,oBAAoB,CAAC,IAAe;;QACvC,OAAO,CAAC,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,mCAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;YACrC,OAAO,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;IACP,CAAC;IAgBD;;;;;OAKG;IACI,aAAa;QAChB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YACjB,KAAK,EAAE,2BAA2B,IAAI,CAAC,iBAAiB,EAAE,EAAE;YAC5D,WAAW,EAAE,KAAK;YAClB,0EAA0E;YAC1E,UAAU,EAAE,IAAI,CAAC,UAAU,GAAG,CAAC;SAClC,CAAC,CAAC;IACP,CAAC;IAED;;;OAGG;IACI,aAAa;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACvD,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACI,YAAY;QACf,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC9D,IAAI,CAAC,SAAS,EAAE;YACZ,OAAO,SAAS,CAAC;SACpB;QACD,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC;QAC7B,OAAO,SAAS,CAAC,KAAK,CAAC;IAC3B,CAAC;CACJ;AA9GD,8CA8GC"}
|
|
@@ -61,6 +61,8 @@ export declare class CallExpression extends Expression {
|
|
|
61
61
|
};
|
|
62
62
|
readonly kind = AstNodeKind.CallExpression;
|
|
63
63
|
readonly location: Location | undefined;
|
|
64
|
+
/** `a.b()` -> `a.b` (not the args) */
|
|
65
|
+
get previousInChain(): Expression;
|
|
64
66
|
transpile(state: BrsTranspileState, nameOverride?: string): TranspileResult;
|
|
65
67
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
66
68
|
getType(options: GetTypeOptions): BscType;
|
|
@@ -97,11 +99,11 @@ export declare class FunctionExpression extends Expression implements TypedefPro
|
|
|
97
99
|
*/
|
|
98
100
|
get location(): Location;
|
|
99
101
|
transpile(state: BrsTranspileState, name?: Identifier, includeBody?: boolean): TranspileResult;
|
|
100
|
-
getTypedef(state: BrsTranspileState):
|
|
102
|
+
getTypedef(state: BrsTranspileState): any;
|
|
101
103
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
102
104
|
getType(options: GetTypeOptions): TypedFunctionType;
|
|
103
105
|
private get requiresReturnType();
|
|
104
|
-
clone():
|
|
106
|
+
clone(): any;
|
|
105
107
|
}
|
|
106
108
|
export declare class FunctionParameterExpression extends Expression {
|
|
107
109
|
constructor(options: {
|
|
@@ -141,10 +143,20 @@ export declare class DottedGetExpression extends Expression {
|
|
|
141
143
|
readonly dot?: Token;
|
|
142
144
|
};
|
|
143
145
|
readonly obj: Expression;
|
|
146
|
+
/**
|
|
147
|
+
* @deprecated use `tokens.name` instead
|
|
148
|
+
*/
|
|
149
|
+
get name(): Identifier;
|
|
150
|
+
/**
|
|
151
|
+
* @deprecated use `tokens.dot` instead
|
|
152
|
+
*/
|
|
153
|
+
get dot(): Token | undefined;
|
|
144
154
|
readonly kind = AstNodeKind.DottedGetExpression;
|
|
145
155
|
readonly location: Location | undefined;
|
|
146
|
-
|
|
147
|
-
|
|
156
|
+
/** `a.b` -> `a` */
|
|
157
|
+
get previousInChain(): Expression;
|
|
158
|
+
transpile(state: BrsTranspileState): (string | TranspileResult | SourceNode)[];
|
|
159
|
+
getTypedef(state: BrsTranspileState): (string | TranspileResult | SourceNode)[];
|
|
148
160
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
149
161
|
getType(options: GetTypeOptions): BscType;
|
|
150
162
|
getName(parseMode: ParseMode): string;
|
|
@@ -167,7 +179,9 @@ export declare class XmlAttributeGetExpression extends Expression {
|
|
|
167
179
|
};
|
|
168
180
|
readonly obj: Expression;
|
|
169
181
|
readonly location: Location | undefined;
|
|
170
|
-
|
|
182
|
+
/** `a@b` -> `a` */
|
|
183
|
+
get previousInChain(): Expression;
|
|
184
|
+
transpile(state: BrsTranspileState): (string | TranspileResult | SourceNode)[];
|
|
171
185
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
172
186
|
get leadingTrivia(): Token[];
|
|
173
187
|
clone(): XmlAttributeGetExpression;
|
|
@@ -194,7 +208,21 @@ export declare class IndexedGetExpression extends Expression {
|
|
|
194
208
|
readonly closingSquare?: Token;
|
|
195
209
|
readonly questionDot?: Token;
|
|
196
210
|
};
|
|
211
|
+
/**
|
|
212
|
+
* @deprecated use `tokens.questionDot` instead
|
|
213
|
+
*/
|
|
214
|
+
get questionDotToken(): Token | undefined;
|
|
215
|
+
/**
|
|
216
|
+
* @deprecated use `tokens.openingSquare` instead
|
|
217
|
+
*/
|
|
218
|
+
get openingSquare(): Token | undefined;
|
|
219
|
+
/**
|
|
220
|
+
* @deprecated use `indexes[0]` instead
|
|
221
|
+
*/
|
|
222
|
+
get index(): Expression | undefined;
|
|
197
223
|
readonly location: Location | undefined;
|
|
224
|
+
/** `a[i]` -> `a` (not the index) */
|
|
225
|
+
get previousInChain(): Expression;
|
|
198
226
|
transpile(state: BrsTranspileState): any[];
|
|
199
227
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
200
228
|
getType(options: GetTypeOptions): BscType;
|
|
@@ -248,7 +276,7 @@ export declare class PrintSeparatorExpression extends Expression {
|
|
|
248
276
|
};
|
|
249
277
|
readonly kind = AstNodeKind.PrintSeparatorExpression;
|
|
250
278
|
location: Location;
|
|
251
|
-
transpile(state: BrsTranspileState): (string |
|
|
279
|
+
transpile(state: BrsTranspileState): (string | TranspileResult | SourceNode)[];
|
|
252
280
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
253
281
|
get leadingTrivia(): Token[];
|
|
254
282
|
clone(): PrintSeparatorExpression;
|
|
@@ -373,7 +401,7 @@ export declare class UnaryExpression extends Expression {
|
|
|
373
401
|
readonly operator: Token;
|
|
374
402
|
};
|
|
375
403
|
readonly right: Expression;
|
|
376
|
-
transpile(state: BrsTranspileState): (string |
|
|
404
|
+
transpile(state: BrsTranspileState): (string | TranspileResult | SourceNode)[];
|
|
377
405
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
378
406
|
getType(options: GetTypeOptions): BscType;
|
|
379
407
|
get leadingTrivia(): Token[];
|
|
@@ -388,6 +416,10 @@ export declare class VariableExpression extends Expression {
|
|
|
388
416
|
};
|
|
389
417
|
readonly kind = AstNodeKind.VariableExpression;
|
|
390
418
|
readonly location: Location;
|
|
419
|
+
/**
|
|
420
|
+
* @deprecated use `tokens.name` instead
|
|
421
|
+
*/
|
|
422
|
+
get name(): Identifier;
|
|
391
423
|
getName(parseMode?: ParseMode): string;
|
|
392
424
|
transpile(state: BrsTranspileState): TranspileResult;
|
|
393
425
|
getTypedef(state: BrsTranspileState): TranspileResult[];
|
|
@@ -439,6 +471,8 @@ export declare class NewExpression extends Expression {
|
|
|
439
471
|
* The name of the class to initialize (with optional namespace prefixed)
|
|
440
472
|
*/
|
|
441
473
|
get className(): DottedGetExpression | VariableExpression;
|
|
474
|
+
/** `new Alpha.Beta()` -> `Alpha.Beta()` */
|
|
475
|
+
get previousInChain(): CallExpression;
|
|
442
476
|
transpile(state: BrsTranspileState): TranspileResult;
|
|
443
477
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
444
478
|
getType(options: GetTypeOptions): BscType;
|
|
@@ -464,6 +498,8 @@ export declare class CallfuncExpression extends Expression {
|
|
|
464
498
|
};
|
|
465
499
|
readonly kind = AstNodeKind.CallfuncExpression;
|
|
466
500
|
readonly location: Location | undefined;
|
|
501
|
+
/** `a@.b()` -> `a` (not the args) */
|
|
502
|
+
get previousInChain(): Expression;
|
|
467
503
|
transpile(state: BrsTranspileState): TranspileResult;
|
|
468
504
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
469
505
|
getType(options: GetTypeOptions): BscType;
|
|
@@ -548,7 +584,7 @@ export declare class AnnotationExpression extends Expression {
|
|
|
548
584
|
get leadingTrivia(): Token[];
|
|
549
585
|
transpile(state: BrsTranspileState): (string | SourceNode)[];
|
|
550
586
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
551
|
-
getTypedef(state: BrsTranspileState): (string |
|
|
587
|
+
getTypedef(state: BrsTranspileState): (string | TranspileResult | SourceNode)[];
|
|
552
588
|
clone(): AnnotationExpression;
|
|
553
589
|
}
|
|
554
590
|
export declare class TernaryExpression extends Expression {
|
|
@@ -614,12 +650,23 @@ export declare class TypeExpression extends Expression implements TypedefProvide
|
|
|
614
650
|
* The standard AST expression that represents the type for this TypeExpression.
|
|
615
651
|
*/
|
|
616
652
|
expression: Expression;
|
|
653
|
+
/**
|
|
654
|
+
* An already-known type for this TypeExpression, bypassing resolution of `expression`
|
|
655
|
+
* via symbol table lookup. Useful when `expression` is not attached to (or can't resolve
|
|
656
|
+
* against) a real symbol table - e.g. a type reference synthesized for a detached AST node.
|
|
657
|
+
*/
|
|
658
|
+
resolvedType?: BscType;
|
|
617
659
|
});
|
|
618
660
|
readonly kind = AstNodeKind.TypeExpression;
|
|
619
661
|
/**
|
|
620
662
|
* The standard AST expression that represents the type for this TypeExpression.
|
|
621
663
|
*/
|
|
622
664
|
readonly expression: Expression;
|
|
665
|
+
/**
|
|
666
|
+
* An already-known type for this TypeExpression. When set, `getType()` returns this
|
|
667
|
+
* directly instead of resolving `expression` via symbol table lookup.
|
|
668
|
+
*/
|
|
669
|
+
readonly resolvedType?: BscType;
|
|
623
670
|
readonly location: Location;
|
|
624
671
|
transpile(state: BrsTranspileState): TranspileResult;
|
|
625
672
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
@@ -726,6 +773,7 @@ export declare class TypedFunctionTypeExpression extends Expression {
|
|
|
726
773
|
readonly returnType?: TypeExpression;
|
|
727
774
|
readonly location: Location;
|
|
728
775
|
transpile(state: BrsTranspileState): TranspileResult;
|
|
776
|
+
getTypedef(state: BrsTranspileState): TranspileResult;
|
|
729
777
|
walk(visitor: WalkVisitor, options: WalkOptions): void;
|
|
730
778
|
getType(options: GetTypeOptions): BscType;
|
|
731
779
|
clone(): TypedFunctionTypeExpression;
|