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