Skip to content

Commit 1a23c64

Browse files
committed
removed debug information for 'for'
1 parent b5d9018 commit 1a23c64

File tree

3 files changed

+13
-30
lines changed

3 files changed

+13
-30
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jspython-interpreter",
3-
"version": "2.0.14",
3+
"version": "2.0.15",
44
"description": "JSPython is a javascript implementation of Python language that runs within web browser or NodeJS environment",
55
"keywords": [
66
"python",

src/evaluator/evaluator.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -209,20 +209,13 @@ export class Evaluator {
209209

210210
const array = this.evalNode(forNode.sourceArray, blockContext) as unknown[] | string;
211211

212-
try {
213-
for (let i = 0; i < array.length; i++) {
214-
const item = array[i];
215-
console.log('**DEBUG:', array.length, i);
216-
217-
blockContext.blockScope.set(forNode.itemVarName, item);
218-
this.evalBlock({ name: blockContext.moduleName, type: 'for', body: forNode.body } as AstBlock, blockContext);
219-
if (blockContext.continueCalled) { blockContext.continueCalled = false; }
220-
if (blockContext.breakCalled) { break; }
221-
}
212+
for (let i = 0; i < array.length; i++) {
213+
const item = array[i];
222214

223-
console.log('**FOR finished.');
224-
} catch (err) {
225-
console.log('**FOR FAILED:', err?.message || err);
215+
blockContext.blockScope.set(forNode.itemVarName, item);
216+
this.evalBlock({ name: blockContext.moduleName, type: 'for', body: forNode.body } as AstBlock, blockContext);
217+
if (blockContext.continueCalled) { blockContext.continueCalled = false; }
218+
if (blockContext.breakCalled) { break; }
226219
}
227220

228221
if (blockContext.breakCalled) { blockContext.breakCalled = false; }

src/evaluator/evaluatorAsync.ts

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -217,24 +217,14 @@ export class EvaluatorAsync {
217217
const forNode = node as ForNode;
218218

219219
const array = await this.evalNodeAsync(forNode.sourceArray, blockContext) as unknown[] | string;
220-
try {
221-
222-
for (let i = 0; i < array.length; i++) {
223-
const item = array[i];
224-
console.log('**DEBUG:', array.length, i);
225-
226-
blockContext.blockScope.set(forNode.itemVarName, item);
227-
await this.evalBlockAsync({ name: blockContext.moduleName, type: 'for', body: forNode.body } as AstBlock, blockContext);
228-
if (blockContext.continueCalled) { blockContext.continueCalled = false; }
229-
if (blockContext.breakCalled) { break; }
230-
}
231-
232-
console.log('**FOR finished.');
233-
} catch (err) {
234-
console.log('**FOR FAILED:', err?.message || err);
220+
for (let i = 0; i < array.length; i++) {
221+
const item = array[i];
222+
blockContext.blockScope.set(forNode.itemVarName, item);
223+
await this.evalBlockAsync({ name: blockContext.moduleName, type: 'for', body: forNode.body } as AstBlock, blockContext);
224+
if (blockContext.continueCalled) { blockContext.continueCalled = false; }
225+
if (blockContext.breakCalled) { break; }
235226
}
236227

237-
238228
if (blockContext.breakCalled) { blockContext.breakCalled = false; }
239229
return;
240230
}

0 commit comments

Comments
 (0)