bobe 0.0.74 → 0.0.76
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/dist/bobe.cjs +19 -11
- package/dist/bobe.cjs.map +1 -1
- package/dist/bobe.compiler.cjs +19 -11
- package/dist/bobe.compiler.cjs.map +1 -1
- package/dist/bobe.compiler.esm.js +19 -11
- package/dist/bobe.compiler.esm.js.map +1 -1
- package/dist/bobe.esm.js +19 -11
- package/dist/bobe.esm.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.umd.js +19 -11
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -5
|
@@ -358,9 +358,7 @@ class Tokenizer {
|
|
|
358
358
|
return this.token;
|
|
359
359
|
} catch (error) {
|
|
360
360
|
throw error;
|
|
361
|
-
} finally {
|
|
362
|
-
this.handledTokens.push(this.token);
|
|
363
|
-
}
|
|
361
|
+
} finally {}
|
|
364
362
|
}
|
|
365
363
|
locStart() {
|
|
366
364
|
{
|
|
@@ -404,7 +402,6 @@ class Tokenizer {
|
|
|
404
402
|
}
|
|
405
403
|
const trimmed = value.replace(/\/\/[\s\S]+/, '').trim();
|
|
406
404
|
this.setToken(TokenType.Identifier, trimmed ? trimmed : true, 0);
|
|
407
|
-
this.handledTokens.push(this.token);
|
|
408
405
|
this.locEnd();
|
|
409
406
|
return this.token;
|
|
410
407
|
}
|
|
@@ -425,7 +422,6 @@ class Tokenizer {
|
|
|
425
422
|
char = this.code[this.i];
|
|
426
423
|
}
|
|
427
424
|
this.setToken(TokenType.Identifier, value, 0);
|
|
428
|
-
this.handledTokens.push(this.token);
|
|
429
425
|
this.locEnd();
|
|
430
426
|
return this.token;
|
|
431
427
|
}
|
|
@@ -2364,10 +2360,19 @@ class Interpreter {
|
|
|
2364
2360
|
}
|
|
2365
2361
|
removeForItem(children, i) {
|
|
2366
2362
|
const child = children[i];
|
|
2363
|
+
const after = child.realAfter;
|
|
2367
2364
|
this.removeLogicNode(child);
|
|
2368
2365
|
this.remove(child.realBefore);
|
|
2369
2366
|
this.remove(child.realAfter);
|
|
2370
2367
|
child.effect.dispose();
|
|
2368
|
+
child.effect = undefined;
|
|
2369
|
+
child.data = undefined;
|
|
2370
|
+
child.context = undefined;
|
|
2371
|
+
after[FakeNode] = undefined;
|
|
2372
|
+
child.forNode = undefined;
|
|
2373
|
+
child.realParent = undefined;
|
|
2374
|
+
child.realAfter = undefined;
|
|
2375
|
+
child.realBefore = undefined;
|
|
2371
2376
|
}
|
|
2372
2377
|
reuseForItem(child, data, itemExp, i, indexName, indexValue) {
|
|
2373
2378
|
if (typeof itemExp === 'string') {
|
|
@@ -2526,6 +2531,11 @@ class Interpreter {
|
|
|
2526
2531
|
getFn(data, expression) {
|
|
2527
2532
|
return new Function('data', `with(data){return (${expression})}`).bind(undefined, safe(data));
|
|
2528
2533
|
}
|
|
2534
|
+
getBoolFn(data, expression) {
|
|
2535
|
+
return new Function('data', `with(data){return Boolean(${expression})}`).bind(undefined, safeExclude(data, {
|
|
2536
|
+
'Boolean': true
|
|
2537
|
+
}));
|
|
2538
|
+
}
|
|
2529
2539
|
getAssignFn(data, expression) {
|
|
2530
2540
|
const valueId = `value_bobe_${date32()}`;
|
|
2531
2541
|
return new Function('data', valueId, `with(data){${expression}=${valueId}};`).bind(undefined, safeExclude(data, {
|
|
@@ -2563,11 +2573,9 @@ class Interpreter {
|
|
|
2563
2573
|
switch (keyWord.value) {
|
|
2564
2574
|
case 'if':
|
|
2565
2575
|
if (valueIsMapKey) {
|
|
2566
|
-
|
|
2567
|
-
const cells = data[Keys.Meta].cells;
|
|
2568
|
-
signal = cells.get(value);
|
|
2576
|
+
signal = new Computed(() => Boolean(data[value]));
|
|
2569
2577
|
} else {
|
|
2570
|
-
const fn = this.
|
|
2578
|
+
const fn = this.getBoolFn(data, value);
|
|
2571
2579
|
signal = new Computed(fn);
|
|
2572
2580
|
}
|
|
2573
2581
|
break;
|
|
@@ -2587,7 +2595,7 @@ class Interpreter {
|
|
|
2587
2595
|
return true;
|
|
2588
2596
|
});
|
|
2589
2597
|
} else {
|
|
2590
|
-
const fn = valueIsMapKey ? null : this.
|
|
2598
|
+
const fn = valueIsMapKey ? null : this.getBoolFn(data, value);
|
|
2591
2599
|
signal = new Computed(() => {
|
|
2592
2600
|
let point = ifNode.preCond;
|
|
2593
2601
|
while (point) {
|
|
@@ -2599,7 +2607,7 @@ class Interpreter {
|
|
|
2599
2607
|
}
|
|
2600
2608
|
point = point.preCond;
|
|
2601
2609
|
}
|
|
2602
|
-
return valueIsMapKey ? data[value] : fn();
|
|
2610
|
+
return valueIsMapKey ? Boolean(data[value]) : fn();
|
|
2603
2611
|
});
|
|
2604
2612
|
}
|
|
2605
2613
|
break;
|