[Pas2js] Question regarding the New() function (#34736)

silvioprog silvioprog at gmail.com
Thu Dec 20 16:41:04 CET 2018


On Thu, Dec 20, 2018 at 12:26 PM Michael Van Canneyt <michael at freepascal.org>
wrote:

> That should be
>
> o := new([
>      'foo', 'bar',
>      'object', new(['abc', 123]),
>      'array', TJSArray.new(1,2,3)
>    ]);


Using this:

  o := new([
    'foo', 'bar',
    'object', new(['abc', 123]),
    'array', TJSArray.new(1,2,3)
  ]);

will generate this:

$mod.o =
pas.JS.new$1(["foo","bar","object",pas.JS.new$1(["abc",123]),"array",new
Array(1,2,3)]);

Any change to upgrade the transpiler to use this:

  o := new(
    'foo', 'bar',
    'object', new('abc', 123),
    'array', TJSArray.new(1,2,3)
  );

to generate this?:

$mod.o = {"foo":"bar","object":{"abc",123},"array":new Array(1,2,3)};

best,

-- 
Silvio Clécio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20181220/c37188ef/attachment.html>


More information about the Pas2js mailing list