@ball-lang/engine 1.41.0 → 1.43.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ball-lang/engine",
3
- "version": "1.41.0",
3
+ "version": "1.43.0",
4
4
  "description": "Ball language engine — interprets Ball programs in TypeScript/JavaScript. Runs in Node.js and browsers.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -633,11 +633,39 @@ function hasMetadata(obj: any): boolean { return _has(obj, 'metadata'); }
633
633
  function hasBody(obj: any): boolean { return _has(obj, 'body'); }
634
634
  function hasInput(obj: any): boolean { return _has(obj, 'input'); }
635
635
  function hasDescriptor(obj: any): boolean { return _has(obj, 'descriptor'); }
636
+ // ModuleImport.source oneof (issue #364 — cli_core.dart's _importSource
637
+ // reads these via hasHttp()/hasFile()/hasGit()/hasRegistry()/hasInline()
638
+ // instead of whichSource(), since the self-hosted engine represents proto
639
+ // oneof-case enums as maps and can't self-host a whichSource() ==
640
+ // ModuleImport_Source.x comparison — see cli_core.dart's _importSource doc).
641
+ function hasHttp(obj: any): boolean { return _has(obj, 'http'); }
642
+ function hasFile(obj: any): boolean { return _has(obj, 'file'); }
643
+ function hasGit(obj: any): boolean { return _has(obj, 'git'); }
644
+ function hasRegistry(obj: any): boolean { return _has(obj, 'registry'); }
645
+ function hasInline(obj: any): boolean { return _has(obj, 'inline'); }
636
646
  function hasStringValue(obj: any): boolean { return _has(obj, 'stringValue'); }
637
647
  function hasBoolValue(obj: any): boolean { return _has(obj, 'boolValue'); }
638
648
  function hasNumberValue(obj: any): boolean { return _has(obj, 'numberValue'); }
639
649
  function hasResult(obj: any): boolean { return _has(obj, 'result'); }
640
650
  function hasCall(obj: any): boolean { return _has(obj, 'call'); }
651
+ // Statement oneof presence (let, expression) + FieldAccess object presence,
652
+ // issue 362. The self-hosted ball audit analyzers and engine.dart read these
653
+ // via hasLet, hasExpression, hasObject; they route to ball_proto and compile to
654
+ // free calls, so they need top-level definitions here (mirrors hasHttp etc.).
655
+ function hasLet(obj: any): boolean { return _has(obj, 'let'); }
656
+ function hasExpression(obj: any): boolean { return _has(obj, 'expression'); }
657
+ function hasObject(obj: any): boolean { return _has(obj, 'object'); }
658
+ // Expression oneof presence (issue 362): the self-hosted ball audit
659
+ // capability/termination analyzers dispatch expression kinds via a hasX()
660
+ // presence cascade (hasCall/hasLiteral/hasBlock/hasLambda/hasMessageCreation/
661
+ // hasFieldAccess/hasReference) instead of the whichExpr() enum, so these route
662
+ // to ball_proto and compile to free calls needing top-level definitions here.
663
+ function hasLiteral(obj: any): boolean { return _has(obj, 'literal'); }
664
+ function hasBlock(obj: any): boolean { return _has(obj, 'block'); }
665
+ function hasLambda(obj: any): boolean { return _has(obj, 'lambda'); }
666
+ function hasMessageCreation(obj: any): boolean { return _has(obj, 'messageCreation'); }
667
+ function hasFieldAccess(obj: any): boolean { return _has(obj, 'fieldAccess'); }
668
+ function hasReference(obj: any): boolean { return _has(obj, 'reference'); }
641
669
  function hasListValue(obj: any): boolean { return _has(obj, 'listValue'); }
642
670
  function hasNullValue(obj: any): boolean { return _has(obj, 'nullValue'); }
643
671
  function hasStructValue(obj: any): boolean { return _has(obj, 'structValue'); }
@@ -1712,7 +1740,7 @@ export class BallEngine {
1712
1740
  }
1713
1741
  else if ((__sw === Expression_Expr.fieldAccess)) {
1714
1742
  let access = current.expr.fieldAccess;
1715
- if (access.hasObject()) {
1743
+ if (hasObject(access)) {
1716
1744
  stack = (stack.push({ expr: access.object, depth: __ball_add(depth, 1) }), stack);
1717
1745
  }
1718
1746
  }