Skip to content

Commit b69644c

Browse files
fix: Use case of CallExpression
in WebGL.astCallExpression
1 parent 012cfff commit b69644c

File tree

12 files changed

+11447
-11369
lines changed

12 files changed

+11447
-11369
lines changed

dist/gpu-browser-core.js

Lines changed: 5402 additions & 5382 deletions
Large diffs are not rendered by default.

dist/gpu-browser-core.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/gpu-browser.js

Lines changed: 5405 additions & 5385 deletions
Large diffs are not rendered by default.

dist/gpu-browser.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gpu.js",
3-
"version": "2.6.6",
3+
"version": "2.6.7",
44
"description": "GPU Accelerated JavaScript",
55
"engines": {
66
"node": ">=8.0.0"

src/backend/function-node.js

Lines changed: 253 additions & 250 deletions
Large diffs are not rendered by default.

src/backend/function-tracer.js

Lines changed: 56 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -158,30 +158,31 @@ class FunctionTracer {
158158
this.scan(ast.declarations);
159159
}
160160
break;
161-
case 'VariableDeclarator': {
162-
const { currentContext } = this;
163-
const inForLoopInit = this.hasState(states.inForLoopInit);
164-
const declaration = {
165-
ast: ast,
166-
context: currentContext,
167-
name: ast.id.name,
168-
origin: 'declaration',
169-
inForLoopInit,
170-
inForLoopTest: null,
171-
assignable: currentContext === this.currentFunctionContext || (!inForLoopInit && !currentContext.hasOwnProperty(ast.id.name)),
172-
suggestedType: null,
173-
valueType: null,
174-
dependencies: null,
175-
isSafe: null,
176-
};
177-
if (!currentContext[ast.id.name]) {
178-
currentContext[ast.id.name] = declaration;
161+
case 'VariableDeclarator':
162+
{
163+
const { currentContext } = this;
164+
const inForLoopInit = this.hasState(states.inForLoopInit);
165+
const declaration = {
166+
ast: ast,
167+
context: currentContext,
168+
name: ast.id.name,
169+
origin: 'declaration',
170+
inForLoopInit,
171+
inForLoopTest: null,
172+
assignable: currentContext === this.currentFunctionContext || (!inForLoopInit && !currentContext.hasOwnProperty(ast.id.name)),
173+
suggestedType: null,
174+
valueType: null,
175+
dependencies: null,
176+
isSafe: null,
177+
};
178+
if (!currentContext[ast.id.name]) {
179+
currentContext[ast.id.name] = declaration;
180+
}
181+
this.declarations.push(declaration);
182+
this.scan(ast.id);
183+
this.scan(ast.init);
184+
break;
179185
}
180-
this.declarations.push(declaration);
181-
this.scan(ast.id);
182-
this.scan(ast.init);
183-
break;
184-
}
185186
case 'FunctionExpression':
186187
case 'FunctionDeclaration':
187188
if (this.runningContexts.length === 0) {
@@ -195,51 +196,53 @@ class FunctionTracer {
195196
this.scan(ast.consequent);
196197
if (ast.alternate) this.scan(ast.alternate);
197198
break;
198-
case 'ForStatement': {
199-
let testIdentifiers;
200-
const context = this.newContext(() => {
201-
this.pushState(states.inForLoopInit);
202-
this.scan(ast.init);
203-
this.popState(states.inForLoopInit);
199+
case 'ForStatement':
200+
{
201+
let testIdentifiers;
202+
const context = this.newContext(() => {
203+
this.pushState(states.inForLoopInit);
204+
this.scan(ast.init);
205+
this.popState(states.inForLoopInit);
204206

205-
testIdentifiers = this.getIdentifiers(() => {
206-
this.scan(ast.test);
207-
});
207+
testIdentifiers = this.getIdentifiers(() => {
208+
this.scan(ast.test);
209+
});
208210

209-
this.scan(ast.update);
210-
this.newContext(() => {
211-
this.scan(ast.body);
211+
this.scan(ast.update);
212+
this.newContext(() => {
213+
this.scan(ast.body);
214+
});
212215
});
213-
});
214216

215-
if (testIdentifiers) {
216-
for (const p in context) {
217-
if (p === '@contextType') continue;
218-
if (testIdentifiers.indexOf(p) > -1) {
219-
context[p].inForLoopTest = true;
217+
if (testIdentifiers) {
218+
for (const p in context) {
219+
if (p === '@contextType') continue;
220+
if (testIdentifiers.indexOf(p) > -1) {
221+
context[p].inForLoopTest = true;
222+
}
220223
}
221224
}
225+
break;
222226
}
223-
break;
224-
}
225227
case 'DoWhileStatement':
226228
case 'WhileStatement':
227229
this.newContext(() => {
228230
this.scan(ast.body);
229231
this.scan(ast.test);
230232
});
231233
break;
232-
case 'Identifier': {
233-
if (this.isState(states.trackIdentifiers)) {
234-
this.trackedIdentifiers.push(ast.name);
234+
case 'Identifier':
235+
{
236+
if (this.isState(states.trackIdentifiers)) {
237+
this.trackedIdentifiers.push(ast.name);
238+
}
239+
this.identifiers.push({
240+
context: this.currentContext,
241+
declaration: this.getDeclaration(ast.name),
242+
ast,
243+
});
244+
break;
235245
}
236-
this.identifiers.push({
237-
context: this.currentContext,
238-
declaration: this.getDeclaration(ast.name),
239-
ast,
240-
});
241-
break;
242-
}
243246
case 'ReturnStatement':
244247
this.returnStatements.push(ast);
245248
this.scan(ast.argument);

0 commit comments

Comments
 (0)