Fix (nanopass `LET_SYNTAX`): use location from rhs instead of global one
Motivation and Context
Related Issue: #1664 (closed)
Description
This MR uses a different location for the compiled let_rhs. After the fix:
$ dune exec -- ligo compile contract curry.mligo --michelson-comments location --experimental-disable-optimizations-for-debugging
{ parameter unit ;
storage int ;
code { {} ;
{ /* File "curry.mligo", line 1, character 0 to line 5, character 32 */
{ /* File "curry.mligo", line 1, character 0 to line 5, character 32 */
LAMBDA
(pair unit int)
(pair (list operation) int)
{ {} ;
{ /* File "curry.mligo", line 2, character 2 to line 5, character 32 */
{ /* File "curry.mligo", line 2, character 2 to line 5, character 32 */ } ;
{} ;
{ /* File "curry.mligo", line 2, character 2 to line 5, character 32 */
{ /* File "curry.mligo", line 2, character 2 to line 5, character 32 */ } ;
CDR ;
{} ;
{ /* File "curry.mligo", line 2, character 2 to line 5, character 32 */
{ /* File "curry.mligo", line 2, character 2 to line 5, character 32 */ } ;
{} ;
{ /* File "curry.mligo", line 2, character 2 to line 5, character 32 */
{ /* File "curry.mligo", line 2, character 2 to line 5, character 32 */ } ;
{} ;
{ /* File "curry.mligo", line 2, character 2 to line 5, character 32 */
{ /* File "curry.mligo", line 2, characters 36-41 */
LAMBDA
(pair int int)
int
{ {} ;
UNPAIR ;
{} ;
{} ;
SWAP ;
{} ;
{ /* File "curry.mligo", line 2, characters 36-41 */
{ /* File "curry.mligo", line 2, characters 40-41 */ } ;
{ /* File "curry.mligo", line 2, characters 36-37 */ SWAP } ;
ADD
/* File "curry.mligo", line 2, characters 36-41 */ } } } ;
{} ;
{ /* File "curry.mligo", line 3, character 2 to line 5, character 32 */
{ /* File "curry.mligo", line 3, characters 10-12 */ PUSH int 42 } ;
{} ;
{ /* File "curry.mligo", line 4, character 2 to line 5, character 32 */
{ /* File "curry.mligo", line 4, characters 10-15 */
{ /* File "curry.mligo", line 4, characters 14-15 */ PUSH int 2 } ;
{ /* File "curry.mligo", line 4, characters 10-11 */ DIG 3 } ;
ADD
/* File "curry.mligo", line 4, characters 10-15 */ } ;
{} ;
{ /* File "curry.mligo", line 5, characters 3-31 */
{ /* File "curry.mligo", line 5, characters 26-31 */
{ /* File "curry.mligo", line 5, characters 30-31 */ } ;
{ /* File "curry.mligo", line 5, characters 28-29 */ SWAP } ;
PAIR ;
{ /* File "curry.mligo", line 5, characters 26-27 */ SWAP } ;
SWAP ;
EXEC } ;
{ /* File "curry.mligo", line 5, characters 3-24 */
NIL operation
/* File "curry.mligo", line 5, characters 3-24 */
/* File "curry.mligo", line 5, characters 3-24 */ } ;
PAIR } } } } } } } } } } ;
{} } ;
SWAP ;
EXEC } }
The ADD gets location 2:36-41.
Component
-
compiler -
website -
webide -
vscode-plugin -
debugger
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
Checklist:
-
Changes follow the existing coding style (use dune @fmtto 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 ## Changelogsection 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 E. Rivas