@scriptc/compiler 0.0.22 → 0.0.23

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 (68) hide show
  1. package/ambient/scriptc-node-fallback.d.ts +39 -3
  2. package/dist/backend/emission/emit-async.js +3 -1
  3. package/dist/backend/emission/emit-async.js.map +1 -1
  4. package/dist/backend/emission/emit-exprs.d.ts +10 -0
  5. package/dist/backend/emission/emit-exprs.js +127 -10
  6. package/dist/backend/emission/emit-exprs.js.map +1 -1
  7. package/dist/backend/emission/emit-stmts.js +13 -5
  8. package/dist/backend/emission/emit-stmts.js.map +1 -1
  9. package/dist/backend/emission/emit-types.js +4 -1
  10. package/dist/backend/emission/emit-types.js.map +1 -1
  11. package/dist/backend/emission/emitter.d.ts +11 -1
  12. package/dist/backend/emission/emitter.js +61 -1
  13. package/dist/backend/emission/emitter.js.map +1 -1
  14. package/dist/backend/llvm/emitter.js +304 -21
  15. package/dist/backend/llvm/emitter.js.map +1 -1
  16. package/dist/backend/llvm/shapes.js +3 -2
  17. package/dist/backend/llvm/shapes.js.map +1 -1
  18. package/dist/compat/fetch-profile.d.ts +10 -0
  19. package/dist/compat/fetch-profile.js +55 -6
  20. package/dist/compat/fetch-profile.js.map +1 -1
  21. package/dist/coverage/surface-manifest.js +16 -1
  22. package/dist/coverage/surface-manifest.js.map +1 -1
  23. package/dist/diagnostics/diagnostic.d.ts +10 -0
  24. package/dist/diagnostics/diagnostic.js +27 -1
  25. package/dist/diagnostics/diagnostic.js.map +1 -1
  26. package/dist/frontend/lowering/lower-builtins.d.ts +3 -7
  27. package/dist/frontend/lowering/lower-builtins.js +80 -55
  28. package/dist/frontend/lowering/lower-builtins.js.map +1 -1
  29. package/dist/frontend/lowering/lower-calls.js +1 -0
  30. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  31. package/dist/frontend/lowering/lower-classes.js +28 -8
  32. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  33. package/dist/frontend/lowering/lower-exprs.d.ts +1 -1
  34. package/dist/frontend/lowering/lower-exprs.js +25 -4
  35. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  36. package/dist/frontend/lowering/lower-generators.js +7 -1
  37. package/dist/frontend/lowering/lower-generators.js.map +1 -1
  38. package/dist/frontend/lowering/lower-island.d.ts +21 -0
  39. package/dist/frontend/lowering/lower-island.js +284 -10
  40. package/dist/frontend/lowering/lower-island.js.map +1 -1
  41. package/dist/frontend/lowering/lower-stmts.js +8 -4
  42. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  43. package/dist/frontend/lowering/lowerer.d.ts +1 -0
  44. package/dist/frontend/lowering/lowerer.js +6 -2
  45. package/dist/frontend/lowering/lowerer.js.map +1 -1
  46. package/dist/frontend/lowering/surfaces.js +43 -12
  47. package/dist/frontend/lowering/surfaces.js.map +1 -1
  48. package/dist/frontend/program.d.ts +4 -4
  49. package/dist/frontend/program.js +264 -46
  50. package/dist/frontend/program.js.map +1 -1
  51. package/dist/frontend/resolve.d.ts +10 -0
  52. package/dist/frontend/resolve.js +37 -0
  53. package/dist/frontend/resolve.js.map +1 -1
  54. package/dist/frontend/ts7/enums.d.ts +9 -0
  55. package/dist/frontend/ts7/enums.js +8 -6
  56. package/dist/frontend/ts7/enums.js.map +1 -1
  57. package/dist/frontend/ts7/program.js +4 -1
  58. package/dist/frontend/ts7/program.js.map +1 -1
  59. package/dist/frontend/types.d.ts +4 -4
  60. package/dist/frontend/types.js +25 -8
  61. package/dist/frontend/types.js.map +1 -1
  62. package/dist/ir/nodes.d.ts +24 -11
  63. package/dist/ir/nodes.js +6 -1
  64. package/dist/ir/nodes.js.map +1 -1
  65. package/dist/ir/validate.js +45 -8
  66. package/dist/ir/validate.js.map +1 -1
  67. package/package.json +2 -2
  68. package/surface-manifest.json +137 -28
@@ -234,7 +234,7 @@ export declare function foldedStringKeyOf(L: Lowerer, expr: ts.Expression): stri
234
234
  * (dynFrom's domain, functions box); a value with no dyn representation
235
235
  * fences per property. Spreads copy through dyn.assign in source order;
236
236
  * accessors stay fenced. */
237
- export declare function lowerDynObjectLiteral(L: Lowerer, expr: ts.ObjectLiteralExpression): IrExpr;
237
+ export declare function lowerDynObjectLiteral(L: Lowerer, expr: ts.ObjectLiteralExpression, boxValue?: (node: ts.Expression, value: IrExpr) => IrExpr): IrExpr;
238
238
  export declare function lowerObjectLiteral(L: Lowerer, expr: ts.ObjectLiteralExpression): IrExpr;
239
239
  /** A conditional spread's carrier property: `name: value` or shorthand,
240
240
  * with an identifier/string-literal name. */
@@ -1614,6 +1614,7 @@ function lowerExprInner(L, expr) {
1614
1614
  // The lib fence's PROPERTY chokepoint: a stdlib-declared member that
1615
1615
  // no lowering above claimed ([1,2].entries, Math.SQRT2, Promise.all,
1616
1616
  // re.exec as a value, ...) reports SC2020 here.
1617
+ L.fenceStaticAbortControllerMemberRead(expr);
1617
1618
  L.fenceStaticResponseMember(expr, "read");
1618
1619
  L.fenceStaticHeadersMember(expr, "read");
1619
1620
  L.fenceStaticReadableStreamMember(expr, "read");
@@ -2911,7 +2912,7 @@ export function lowerIntrinsicProperty(L, expr) {
2911
2912
  if (probe.type.kind === "array")
2912
2913
  kind = "array";
2913
2914
  }
2914
- if (kind !== "string" && kind !== "array" && kind !== "map" && kind !== "set" && kind !== "f64" && kind !== "regex" && kind !== "url" && kind !== "searchParams" && kind !== "stats" && kind !== "spawnRes" && kind !== "child" && kind !== "bytes" && kind !== "symbol") {
2915
+ if (kind !== "string" && kind !== "array" && kind !== "map" && kind !== "set" && kind !== "f64" && kind !== "date" && kind !== "regex" && kind !== "url" && kind !== "searchParams" && kind !== "stats" && kind !== "spawnRes" && kind !== "child" && kind !== "bytes" && kind !== "symbol") {
2915
2916
  return null;
2916
2917
  }
2917
2918
  // child receivers also admit the user's own child-shaped interface
@@ -3006,6 +3007,20 @@ export function lowerIntrinsicProperty(L, expr) {
3006
3007
  }
3007
3008
  L.noLowering(`Stats.${name}`, expr, "isFile(), isDirectory(), and size are the supported Stats members", L.checker.getSymbolAtLocation(expr.name));
3008
3009
  }
3010
+ if (kind === "date") {
3011
+ const methods = new Set([
3012
+ "getTime", "valueOf", "toISOString",
3013
+ "getFullYear", "getUTCFullYear", "getMonth", "getUTCMonth",
3014
+ "getDate", "getUTCDate", "getDay", "getUTCDay", "getHours",
3015
+ "getUTCHours", "getMinutes", "getUTCMinutes", "getSeconds",
3016
+ "getUTCSeconds", "getMilliseconds", "getUTCMilliseconds",
3017
+ "getTimezoneOffset",
3018
+ ]);
3019
+ if (methods.has(name)) {
3020
+ L.unsupported("SC1090", expr, `Date methods as values (call '${name}' directly)`);
3021
+ }
3022
+ L.noLowering(`Date.prototype.${name}`, expr, "getTime(), valueOf(), toISOString(), the local/UTC calendar getters, and getTimezoneOffset() are supported; Date setters and locale/string formatters have no lowering", L.checker.getSymbolAtLocation(expr.name));
3023
+ }
3009
3024
  if (kind === "symbol") {
3010
3025
  const loc = locOf(expr);
3011
3026
  // `.description`: the checker's `string | undefined` — undefined
@@ -3655,7 +3670,7 @@ function propNameText(L, name) {
3655
3670
  * (dynFrom's domain, functions box); a value with no dyn representation
3656
3671
  * fences per property. Spreads copy through dyn.assign in source order;
3657
3672
  * accessors stay fenced. */
3658
- export function lowerDynObjectLiteral(L, expr) {
3673
+ export function lowerDynObjectLiteral(L, expr, boxValue) {
3659
3674
  const loc = locOf(expr);
3660
3675
  let fields = [];
3661
3676
  let acc = null;
@@ -3671,7 +3686,10 @@ export function lowerDynObjectLiteral(L, expr) {
3671
3686
  for (const prop of expr.properties) {
3672
3687
  if (ts.isSpreadAssignment(prop)) {
3673
3688
  flushFields();
3674
- const source = L.coerceToExpected(L.lowerExpr(prop.expression), DYN);
3689
+ const raw = L.lowerExpr(prop.expression);
3690
+ const source = boxValue
3691
+ ? boxValue(prop.expression, raw)
3692
+ : L.coerceToExpected(raw, DYN);
3675
3693
  if (source.type.kind !== "dyn") {
3676
3694
  L.unsupported("SC1101", prop.expression, `spreading '${L.fmt(source.type)}' into a checked-dynamic object literal`);
3677
3695
  }
@@ -3765,7 +3783,9 @@ export function lowerDynObjectLiteral(L, expr) {
3765
3783
  });
3766
3784
  raw = { kind: "closure", fnName, captures: [], type: funcOf([], VOID), loc: locOf(prop) };
3767
3785
  }
3768
- let v = L.coerceToExpected(raw, DYN);
3786
+ let v = boxValue
3787
+ ? boxValue(valueExpr, raw)
3788
+ : L.coerceToExpected(raw, DYN);
3769
3789
  if (v.type.kind !== "dyn") {
3770
3790
  const convDiagsBefore = L.diags.length;
3771
3791
  try {
@@ -5233,6 +5253,7 @@ export function lowerElementAccess(L, expr) {
5233
5253
  // spellings. Fence a statically-known unsupported key before the generic
5234
5254
  // checked-dynamic element-read path can turn it into a runtime missing
5235
5255
  // member.
5256
+ L.fenceStaticAbortControllerMemberRead(expr);
5236
5257
  L.fenceStaticResponseMember(expr, "read");
5237
5258
  L.fenceStaticHeadersMember(expr, "read");
5238
5259
  L.fenceStaticReadableStreamMember(expr, "read");