diff --git a/eo2js/src/resources/xsl/attrs.xsl b/eo2js/src/resources/xsl/attrs.xsl index e677b4d..67c9027 100644 --- a/eo2js/src/resources/xsl/attrs.xsl +++ b/eo2js/src/resources/xsl/attrs.xsl @@ -36,7 +36,7 @@ SOFTWARE. bound - free + void diff --git a/eo2js/src/resources/xsl/to-js.xsl b/eo2js/src/resources/xsl/to-js.xsl index f9a222e..fbc50d3 100644 --- a/eo2js/src/resources/xsl/to-js.xsl +++ b/eo2js/src/resources/xsl/to-js.xsl @@ -34,6 +34,14 @@ SOFTWARE. + + + ρ + + + + φ + @@ -97,10 +105,10 @@ SOFTWARE. - φ + - ρ + @@ -158,7 +166,7 @@ SOFTWARE. const - = function(sigma) { + = function() { @@ -180,7 +188,7 @@ SOFTWARE. - const obj = object(sigma, ' + const obj = object(' ') @@ -205,11 +213,6 @@ SOFTWARE. - - - - - @@ -231,7 +234,7 @@ SOFTWARE. - + attr.void(' @@ -249,14 +252,7 @@ SOFTWARE. - - - return cached(ret) - - - return ret - - + return ret } @@ -314,8 +310,6 @@ SOFTWARE. - - .copy() rho @@ -324,10 +318,9 @@ SOFTWARE. phi - rho.take('ρ') - - - rho.take('σ') + taken(rho, ' + + ') @@ -337,13 +330,21 @@ SOFTWARE. + + taken( + rho - .take('σ') + , ' + + ') + , ' + + ') - rho.take(' + taken(rho, ' ') @@ -378,19 +379,13 @@ SOFTWARE. let - = + = taken( - _base.take(' + _base, ' - ρ - - - σ - - - ν + @@ -406,20 +401,6 @@ SOFTWARE. - - - - - - - - - - - - = - - .copy() @@ -449,10 +430,6 @@ SOFTWARE. - - - .copy() - @@ -470,9 +447,9 @@ SOFTWARE. - = + = applied( - .with({ + , { @@ -488,9 +465,6 @@ SOFTWARE. - - 'α' - @@ -596,10 +570,10 @@ SOFTWARE. const object = require('eo2js-runtime/src/runtime/object') const phi = require('eo2js-runtime/src/runtime/phi') - - - const cached = require('eo2js-runtime/src/runtime/cached') - + + const taken = require('eo2js-runtime/src/runtime/taken') + + const applied = require('eo2js-runtime/src/runtime/applied') diff --git a/eo2js/test/resources/transpile/packs/adds-attrs.json b/eo2js/test/resources/transpile/packs/adds-attrs.json index 8729c71..0b03faa 100644 --- a/eo2js/test/resources/transpile/packs/adds-attrs.json +++ b/eo2js/test/resources/transpile/packs/adds-attrs.json @@ -5,7 +5,7 @@ ], "tests": [ ".program.objects.object{.\"@_name\" == 'simple'}{.attr{.bound.o{.\"@_base\" == 'org.eolang.stdout'}}}", - ".program.objects.object{.\"@_name\" == 'simple'}{.attr{.free.o{.\"@_name\" == 'x'}}}" + ".program.objects.object{.\"@_name\" == 'simple'}{.attr{.void.o{.\"@_name\" == 'x'}}}" ], "eo": [ "+package com.eo2js\n", diff --git a/eo2js/test/resources/transpile/packs/bindings-to-js.json b/eo2js/test/resources/transpile/packs/bindings-to-js.json index 3b312a3..470a1da 100644 --- a/eo2js/test/resources/transpile/packs/bindings-to-js.json +++ b/eo2js/test/resources/transpile/packs/bindings-to-js.json @@ -12,12 +12,12 @@ "method": "includes", "args": [ [ - " ret = ret.with({", + " ret = applied(ret, {", " 0: ret_1", " })" ], [ - " ret = ret.with({", + " ret = applied(ret, {", " 'text': ret_1", " })" ] diff --git a/eo2js/test/resources/transpile/packs/data-as-bytes.json b/eo2js/test/resources/transpile/packs/data-as-bytes.json index 75bbc0d..c934031 100644 --- a/eo2js/test/resources/transpile/packs/data-as-bytes.json +++ b/eo2js/test/resources/transpile/packs/data-as-bytes.json @@ -22,10 +22,10 @@ "method": "includes", "args": [ [ - " let ret = phi.take('org').take('eolang').take('int').copy()", - " let ret_1 = phi.take('org').take('eolang').take('bytes').copy()", + " let ret = phi.take('org').take('eolang').take('int')", + " let ret_1 = phi.take('org').take('eolang').take('bytes')", " ret_1.assets['Δ'] = ['0x00', '0x00', '0x00', '0x00', '0x00', '0x00', '0x00', '0x2A']", - " ret = ret.with({", + " ret = applied(ret, {", " 0: ret_1", " })", " return ret" @@ -37,10 +37,10 @@ "method": "includes", "args": [ [ - " let ret = phi.take('org').take('eolang').take('float').copy()", - " let ret_1 = phi.take('org').take('eolang').take('bytes').copy()", + " let ret = phi.take('org').take('eolang').take('float')", + " let ret_1 = phi.take('org').take('eolang').take('bytes')", " ret_1.assets['Δ'] = ['0x40', '0x0C', '0x00', '0x00', '0x00', '0x00', '0x00', '0x00']", - " ret = ret.with({", + " ret = applied(ret, {", " 0: ret_1", " })", " return ret" @@ -52,7 +52,7 @@ "method": "includes", "args": [ [ - " let ret = phi.take('org').take('eolang').take('bytes').copy()", + " let ret = phi.take('org').take('eolang').take('bytes')", " ret.assets['Δ'] = ['0x01', '0xAF']", " return ret" ] diff --git a/eo2js/test/resources/transpile/packs/embedded-object.json b/eo2js/test/resources/transpile/packs/embedded-object.json index 0a95b1d..524ec34 100644 --- a/eo2js/test/resources/transpile/packs/embedded-object.json +++ b/eo2js/test/resources/transpile/packs/embedded-object.json @@ -57,8 +57,8 @@ " obj.attrs['φ'] = attr.once(", " attr.lambda(", " obj, function(rho) {", - " let ret_base = rho.take('σ').take('σ')", - " let ret = ret_base.take('x')", + " let ret_base = taken(taken(taken(rho, 'ρ'), 'ρ'), 'this')", + " let ret = taken(ret_base, 'x')", " return ret", " }", " )", diff --git a/eo2js/test/resources/transpile/packs/take-top-level-abstract-via-rho.json b/eo2js/test/resources/transpile/packs/take-top-level-abstract-via-rho.json new file mode 100644 index 0000000..d8262cd --- /dev/null +++ b/eo2js/test/resources/transpile/packs/take-top-level-abstract-via-rho.json @@ -0,0 +1,38 @@ +{ + "xsls": [ + "objects", + "package", + "attrs", + "data", + "to-js" + ], + "tests": [ + { + "node": ".program.objects.object{.\"@_name\" == 'simple$second'}.javascript", + "method": "includes", + "args": [ + [ + " obj.attrs['five'] = attr.once(", + " attr.lambda(", + " obj, function(rho) {", + " let ret_base = taken(taken(rho, 'ρ'), 'first')", + " let ret = taken(ret_base, 'x')", + " return ret", + " }", + " )", + " )" + ] + ] + } + ], + "eo": [ + "# This is the default 64+ symbols comment in front of named abstract object.", + "[] > simple", + " # This is the default 64+ symbols comment in front of named abstract object.", + " [] > first", + " 5 > x", + " # This is the default 64+ symbols comment in front of named abstract object.", + " [] > second", + " first.x > five" + ] +}