@mintplayer/polyglot-target-typescript 0.9.1 → 0.9.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintplayer/polyglot-target-typescript",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "description": "MintPlayer Polyglot TypeScript / JavaScript target — a pure-JSON language plugin (spec + emission rules + capabilities + std bindings) for the polyglot transpiler.",
5
5
  "keywords": [
6
6
  "polyglot",
@@ -3275,6 +3275,130 @@
3275
3275
  ]
3276
3276
  }
3277
3277
  ],
3278
+ [
3279
+ {
3280
+ "and": [
3281
+ {
3282
+ "eq": [
3283
+ "node.typeIsInt64",
3284
+ "true"
3285
+ ]
3286
+ },
3287
+ {
3288
+ "or": [
3289
+ {
3290
+ "eq": [
3291
+ "node.op",
3292
+ "<<"
3293
+ ]
3294
+ },
3295
+ {
3296
+ "eq": [
3297
+ "node.op",
3298
+ ">>"
3299
+ ]
3300
+ }
3301
+ ]
3302
+ }
3303
+ ]
3304
+ },
3305
+ {
3306
+ "fn": "wrap",
3307
+ "args": [
3308
+ {
3309
+ "get": "node.type"
3310
+ },
3311
+ {
3312
+ "tmpl": [
3313
+ "(",
3314
+ {
3315
+ "emit": "node.lhs"
3316
+ },
3317
+ " ",
3318
+ {
3319
+ "get": "node.op"
3320
+ },
3321
+ " (BigInt(",
3322
+ {
3323
+ "emit": "node.rhs"
3324
+ },
3325
+ ") & 63n))"
3326
+ ]
3327
+ }
3328
+ ]
3329
+ }
3330
+ ],
3331
+ [
3332
+ {
3333
+ "and": [
3334
+ {
3335
+ "eq": [
3336
+ "node.typeIsSmallInt",
3337
+ "true"
3338
+ ]
3339
+ },
3340
+ {
3341
+ "eq": [
3342
+ "node.op",
3343
+ "<<"
3344
+ ]
3345
+ }
3346
+ ]
3347
+ },
3348
+ {
3349
+ "fn": "wrap",
3350
+ "args": [
3351
+ {
3352
+ "get": "node.type"
3353
+ },
3354
+ {
3355
+ "tmpl": [
3356
+ "(",
3357
+ {
3358
+ "emit": "node.lhs"
3359
+ },
3360
+ " << ",
3361
+ {
3362
+ "emitChild": "node.rhs",
3363
+ "side": "r"
3364
+ },
3365
+ ")"
3366
+ ]
3367
+ }
3368
+ ]
3369
+ }
3370
+ ],
3371
+ [
3372
+ {
3373
+ "and": [
3374
+ {
3375
+ "eq": [
3376
+ "node.type",
3377
+ "u32"
3378
+ ]
3379
+ },
3380
+ {
3381
+ "eq": [
3382
+ "node.op",
3383
+ ">>"
3384
+ ]
3385
+ }
3386
+ ]
3387
+ },
3388
+ {
3389
+ "tmpl": [
3390
+ {
3391
+ "emitChild": "node.lhs",
3392
+ "side": "l"
3393
+ },
3394
+ " >>> ",
3395
+ {
3396
+ "emitChild": "node.rhs",
3397
+ "side": "r"
3398
+ }
3399
+ ]
3400
+ }
3401
+ ],
3278
3402
  [
3279
3403
  {
3280
3404
  "or": [
@@ -3481,8 +3605,8 @@
3481
3605
  "List.init": "[]",
3482
3606
  "List.count": "$this.length",
3483
3607
  "List.add": "$this.push($0)",
3484
- "List.clear": "$this = []",
3485
- "List.removeAll": "$this = $this.filter(__e => !(($0)(__e)))",
3608
+ "List.clear": "$this.length = 0",
3609
+ "List.removeAll": "$this.splice(0, $this.length, ...$this.filter(__e => !(($0)(__e))))",
3486
3610
  "List.removeAt": "$this.splice($0, 1)"
3487
3611
  },
3488
3612
  "std.io": {
@@ -3522,9 +3646,9 @@
3522
3646
  "Math.min": "((a, b) => (a <= b ? a : b))($0, $1)",
3523
3647
  "Math.max": "((a, b) => (a >= b ? a : b))($0, $1)",
3524
3648
  "Math.abs": "((a) => (a < (a - a) ? -a : a))($0)",
3525
- "Math.sign": "((a) => { const o = typeof a === 'bigint' ? 1n : 1; return a > (a - a) ? o : (a < (a - a) ? -o : a - a); })($0)",
3526
- "Math.clamp": "((x, lo, hi) => x < lo ? lo : (x > hi ? hi : x))($0, $1, $2)",
3527
- "Math.round": "Math.round($0)"
3649
+ "Math.sign": "((a: any): any => { const o = typeof a === 'bigint' ? 1n : 1; return a > a - a ? o : (a < a - a ? -o : a - a); })($0)",
3650
+ "Math.clamp": "(<T extends number | bigint>(x: T, lo: T, hi: T): T => x < lo ? lo : (x > hi ? hi : x))($0, $1, $2)",
3651
+ "Math.round": "((__x: number) => { const __f = Math.floor(__x); return __x - __f === 0.5 ? (__f % 2 === 0 ? __f : __f + 1) : Math.round(__x); })($0)"
3528
3652
  },
3529
3653
  "std.strings": {
3530
3654
  "string.isEmpty": "($this.length === 0)",