@mintplayer/polyglot-target-php 0.5.0 → 0.5.2

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-php",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "MintPlayer Polyglot PHP target — a pure-JSON language plugin (spec + emission rules + capabilities + std bindings) for the polyglot transpiler.",
5
5
  "keywords": [
6
6
  "polyglot",
@@ -5,10 +5,10 @@
5
5
  "patternMatching": false,
6
6
  "withExpressions": false,
7
7
  "async": false,
8
- "closures": false,
8
+ "closures": "native",
9
9
  "exceptions": false,
10
10
  "interfaces": false,
11
- "blockLambdas": false,
11
+ "blockLambdas": "native",
12
12
  "extensionMethods": false,
13
13
  "operatorOverloading": false
14
14
  },
@@ -244,6 +244,12 @@
244
244
  },
245
245
  "Call": {
246
246
  "tmpl": [
247
+ {
248
+ "case": {
249
+ "when": [ [ { "eq": ["node.isFree", "true"] }, "" ] ],
250
+ "else": "$"
251
+ }
252
+ },
247
253
  {
248
254
  "fn": "ident",
249
255
  "args": [
@@ -448,6 +454,48 @@
448
454
  "]"
449
455
  ]
450
456
  },
457
+ "Lambda": {
458
+ "case": {
459
+ "when": [
460
+ [
461
+ { "and": [ { "eq": ["node.exprBodied", "true"] }, { "eq": ["node.allCapturesByValue", "true"] } ] },
462
+ { "tmpl": [
463
+ "fn(",
464
+ { "map": "node.params", "sep": ", ", "item": { "tmpl": ["$", { "fn": "ident", "args": [ { "get": "item.name" } ] } ] } },
465
+ ") => ",
466
+ { "emit": "node.body" }
467
+ ] }
468
+ ]
469
+ ],
470
+ "else": { "tmpl": [
471
+ "function (",
472
+ { "map": "node.params", "sep": ", ", "item": { "tmpl": ["$", { "fn": "ident", "args": [ { "get": "item.name" } ] } ] } },
473
+ ")",
474
+ { "case": {
475
+ "when": [
476
+ [
477
+ { "not": { "eq": ["node.captures.count", "0"] } },
478
+ { "tmpl": [
479
+ " use (",
480
+ { "map": "node.captures", "sep": ", ", "item": { "tmpl": [
481
+ { "case": { "when": [ [ { "eq": ["item.needsCell", "true"] }, "&$" ] ], "else": "$" } },
482
+ { "fn": "ident", "args": [ { "get": "item.name" } ] }
483
+ ] } },
484
+ ")"
485
+ ] }
486
+ ]
487
+ ],
488
+ "else": ""
489
+ } },
490
+ " { ",
491
+ { "case": {
492
+ "when": [ [ { "eq": ["node.exprBodied", "true"] }, { "tmpl": ["return ", { "emit": "node.body" }, ";"] } ] ],
493
+ "else": { "fn": "inlineBlock" }
494
+ } },
495
+ " }"
496
+ ] }
497
+ }
498
+ },
451
499
  "New": {
452
500
  "tmpl": [
453
501
  "new ",