@scriptc/compiler 0.0.1 → 0.0.3

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.
Files changed (42) hide show
  1. package/dist/backend/emission/emit-exprs.js +2 -0
  2. package/dist/backend/emission/emit-exprs.js.map +1 -1
  3. package/dist/backend/llvm/emitter.js +19 -4
  4. package/dist/backend/llvm/emitter.js.map +1 -1
  5. package/dist/coverage/report.d.ts +1 -0
  6. package/dist/coverage/report.js +12 -0
  7. package/dist/coverage/report.js.map +1 -1
  8. package/dist/coverage/surface-manifest.d.ts +22 -0
  9. package/dist/coverage/surface-manifest.js +295 -0
  10. package/dist/coverage/surface-manifest.js.map +1 -0
  11. package/dist/diagnostics/diagnostic.d.ts +16 -0
  12. package/dist/diagnostics/diagnostic.js +24 -0
  13. package/dist/diagnostics/diagnostic.js.map +1 -1
  14. package/dist/frontend/lowering/lower-calls.js +10 -5
  15. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  16. package/dist/frontend/lowering/lower-containers.d.ts +3 -0
  17. package/dist/frontend/lowering/lower-containers.js +64 -0
  18. package/dist/frontend/lowering/lower-containers.js.map +1 -1
  19. package/dist/frontend/lowering/lower-exprs.js +14 -2
  20. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  21. package/dist/frontend/lowering/lower-inspect.js +8 -3
  22. package/dist/frontend/lowering/lower-inspect.js.map +1 -1
  23. package/dist/frontend/lowering/lower-modules.js +3 -3
  24. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  25. package/dist/frontend/lowering/lower-stmts.js +2 -2
  26. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  27. package/dist/frontend/lowering/lowerer.js +4 -3
  28. package/dist/frontend/lowering/lowerer.js.map +1 -1
  29. package/dist/frontend/program.js +104 -21
  30. package/dist/frontend/program.js.map +1 -1
  31. package/dist/frontend/shared.d.ts +7 -0
  32. package/dist/frontend/shared.js +9 -0
  33. package/dist/frontend/shared.js.map +1 -1
  34. package/dist/index.d.ts +1 -0
  35. package/dist/index.js +12 -6
  36. package/dist/index.js.map +1 -1
  37. package/dist/ir/nodes.d.ts +1 -1
  38. package/dist/ir/nodes.js.map +1 -1
  39. package/dist/ir/validate.js +1 -0
  40. package/dist/ir/validate.js.map +1 -1
  41. package/package.json +6 -4
  42. package/surface-manifest.json +2052 -0
@@ -11,7 +11,7 @@ import { cjsClassExprWholeExportOf, cjsExportAssignmentOf, cjsExportDiscardReaso
11
11
  import { ARRAY_METHODS, builtinConstLit, builtinFenceHintOf, builtinModuleConstOf, builtinModuleFnOf, ISLAND_SURFACE, isChildSurfaceMember, MAP_METHODS, NARROW_FIRST, SET_METHODS, STR_METHODS, UNSUPPORTED_EXPR, sideEffectFreeOptionValue, stdlibGlobalNameOf } from "./surfaces.js";
12
12
  import { blockedBindingUseDiag, recordShapeMismatchDiag, requiresDynamicPackageDiag, unsupportedDiag } from "../../diagnostics/diagnostic.js";
13
13
  import { PoisonError, jsFuncNameOf, neverTaintedJsType, own } from "./lowerer.js";
14
- import { lowerIndexMergeHelper, lowerNpmStaticSafeIndexRead } from "./lower-containers.js";
14
+ import { lowerIndexMergeHelper, lowerNpmStaticSafeIndexRead, strCharsCall } from "./lower-containers.js";
15
15
  import { npmStaticPackageOfPath } from "../npm-static.js";
16
16
  import { fenceEnumObjectValue, lowerEnumAccess } from "./lower-enums.js";
17
17
  import { ambientNsRootOf, ambientUndefReadType, ambientUndefVarRootOf, ambientUndefinedFnSymbolOf, contextualUndefReadType, fenceEarlyAliasUse, fenceEarlyNsMemberRef, lowerNsIdentifierValue, nsMemberIdentOf, nsUndefRead, nsWritableTarget } from "./lower-namespaces.js";
@@ -2940,6 +2940,13 @@ export function lowerArrayLiteral(L, expr, expected) {
2940
2940
  if (drained)
2941
2941
  src = drained;
2942
2942
  }
2943
+ // `[...s]` on a STRING spreads its code-point characters (the
2944
+ // string iterator's walk — astral chars whole) through the same
2945
+ // interned helper as Array.from(s); the result rides the array
2946
+ // machinery below like any string[] source.
2947
+ if (src.type.kind === "string") {
2948
+ src = strCharsCall(L, src, locOf(el));
2949
+ }
2943
2950
  // A same-family array whose ELEMENT lifts (string[] into a
2944
2951
  // (string | symbol)[] literal — per-element wrap/width copy):
2945
2952
  // the interned width helper reshapes before the spread copies.
@@ -5403,10 +5410,15 @@ export function lowerPrefixUnary(L, expr) {
5403
5410
  }
5404
5411
  case ts.SyntaxKind.PlusToken: {
5405
5412
  const operand = L.lowerExpr(expr.operand);
5406
- // Unary + is ToNumber; on an already-number operand it's identity.
5413
+ // Unary + is ToNumber; on an already-number operand it's identity,
5414
+ // and a STRING operand runs the runtime's ECMA-exact StringToNumber
5415
+ // (num.fromString — Number(aString)'s lowering, scr_string.c).
5407
5416
  if (operand.type.kind === "jsval") {
5408
5417
  return { kind: "jsOp", op: "plus", args: [operand], type: JSVAL, loc };
5409
5418
  }
5419
+ if (operand.type.kind === "string") {
5420
+ return { kind: "libCall", fn: "num.fromString", args: [operand], type: F64, loc };
5421
+ }
5410
5422
  if (operand.type.kind !== "f64")
5411
5423
  L.unsupported("SC1043", expr);
5412
5424
  return operand;