Skip to content

Extend JsLIGO nested update syntax

Nicolas Phan requested to merge nested_record_update_2 into dev

Motivation and Context

Related issue : #1665

Description

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Performance improvement (non-breaking change that improves performance)
  • None (change with no changelog)

Changelog

For a contract with nested record update using the new syntaxes, like below.

type storage = int;
type parameter = int;

const main = (_action: parameter, store: storage) : [ list<operation> , storage ] => {
  let r = { x : { y : [ 1 , 2 , { z : "World" , z1 : 7 } , 3] } };
  r["x"].y[2]["z"] = "Hello";
  return [list([]), store]
};

Before

> ligo compile contract 'test.jsligo'
File "test.jsligo", line 6, characters 2-28:
  5 |   let r = { x : { y : [ 1 , 2 , { z : "World" , z1 : 7 } , 3] } };
  6 |   r["x"].y[2]["z"] = "Hello";
  7 |   return [list([]), store]

Not supported assignment.

After

> ligo compile contract 'test.jsligo'
{ parameter int ; storage int ; code { CDR ; NIL operation ; PAIR } }

Checklist:

  • Changes follow the existing coding style (use dune @fmt to check).
  • Tests for the changes have been added (for bug fixes / feature).
  • Documentation has been updated.
  • Changelog description has been added (if appropriate).
  • Start titles under ## Changelog section with #### (if appropriate).
  • There is no image or uploaded file in changelog
  • Examples in changed behaviour have been added to the changelog (for breaking change / feature).
Edited by Nicolas Phan

Merge request reports