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 CHANGED
@@ -338,9 +338,7 @@ class Tokenizer {
338
338
  return this.token;
339
339
  } catch (error) {
340
340
  throw error;
341
- } finally {
342
- this.handledTokens.push(this.token);
343
- }
341
+ } finally {}
344
342
  }
345
343
  locStart() {
346
344
  }
@@ -376,7 +374,6 @@ class Tokenizer {
376
374
  }
377
375
  const trimmed = value.replace(/\/\/[\s\S]+/, '').trim();
378
376
  this.setToken(TokenType.Identifier, trimmed ? trimmed : true, 0);
379
- this.handledTokens.push(this.token);
380
377
  this.locEnd();
381
378
  return this.token;
382
379
  }
@@ -397,7 +394,6 @@ class Tokenizer {
397
394
  char = this.code[this.i];
398
395
  }
399
396
  this.setToken(TokenType.Identifier, value, 0);
400
- this.handledTokens.push(this.token);
401
397
  this.locEnd();
402
398
  return this.token;
403
399
  }
@@ -2338,10 +2334,19 @@ class Interpreter {
2338
2334
  }
2339
2335
  removeForItem(children, i) {
2340
2336
  const child = children[i];
2337
+ const after = child.realAfter;
2341
2338
  this.removeLogicNode(child);
2342
2339
  this.remove(child.realBefore);
2343
2340
  this.remove(child.realAfter);
2344
2341
  child.effect.dispose();
2342
+ child.effect = undefined;
2343
+ child.data = undefined;
2344
+ child.context = undefined;
2345
+ after[FakeNode] = undefined;
2346
+ child.forNode = undefined;
2347
+ child.realParent = undefined;
2348
+ child.realAfter = undefined;
2349
+ child.realBefore = undefined;
2345
2350
  }
2346
2351
  reuseForItem(child, data, itemExp, i, indexName, indexValue) {
2347
2352
  if (typeof itemExp === 'string') {
@@ -2500,6 +2505,11 @@ class Interpreter {
2500
2505
  getFn(data, expression) {
2501
2506
  return new Function('data', `with(data){return (${expression})}`).bind(undefined, safe(data));
2502
2507
  }
2508
+ getBoolFn(data, expression) {
2509
+ return new Function('data', `with(data){return Boolean(${expression})}`).bind(undefined, safeExclude(data, {
2510
+ 'Boolean': true
2511
+ }));
2512
+ }
2503
2513
  getAssignFn(data, expression) {
2504
2514
  const valueId = `value_bobe_${bobeShared.date32()}`;
2505
2515
  return new Function('data', valueId, `with(data){${expression}=${valueId}};`).bind(undefined, safeExclude(data, {
@@ -2537,11 +2547,9 @@ class Interpreter {
2537
2547
  switch (keyWord.value) {
2538
2548
  case 'if':
2539
2549
  if (valueIsMapKey) {
2540
- aoye.runWithPulling(() => data[value], null);
2541
- const cells = data[aoye.Keys.Meta].cells;
2542
- signal = cells.get(value);
2550
+ signal = new aoye.Computed(() => Boolean(data[value]));
2543
2551
  } else {
2544
- const fn = this.getFn(data, value);
2552
+ const fn = this.getBoolFn(data, value);
2545
2553
  signal = new aoye.Computed(fn);
2546
2554
  }
2547
2555
  break;
@@ -2561,7 +2569,7 @@ class Interpreter {
2561
2569
  return true;
2562
2570
  });
2563
2571
  } else {
2564
- const fn = valueIsMapKey ? null : this.getFn(data, value);
2572
+ const fn = valueIsMapKey ? null : this.getBoolFn(data, value);
2565
2573
  signal = new aoye.Computed(() => {
2566
2574
  let point = ifNode.preCond;
2567
2575
  while (point) {
@@ -2573,7 +2581,7 @@ class Interpreter {
2573
2581
  }
2574
2582
  point = point.preCond;
2575
2583
  }
2576
- return valueIsMapKey ? data[value] : fn();
2584
+ return valueIsMapKey ? Boolean(data[value]) : fn();
2577
2585
  });
2578
2586
  }
2579
2587
  break;