Skip to content

Fix missing semicolon before comments in jsligo

Melwyn Saldanha requested to merge fix/jsligo_asi_comment into dev

Motivation and Context

For jsligo, If comments are present between two declations which are not terminated by semi-colon it was a syntax error

Description

This MR fixes the semi-colon insertion for the above mentioned case

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

Improves the semi-colon insertion for jsligo

Example file

const test1 = 1
/* Hello */
// There
/* Hello */
// Again
const test2 = 2

Before Fix

$ ligo.57 run test y.jsligo 
File "y.jsligo", line 6, characters 0-5:
  5 | // Again
  6 | const test2 = 2
Ill-formed top-level statement.
At this point, if the statement is complete, one of the following is
expected:
  * a semicolon ';' followed by another statement;
  * a semicolon ';' followed by the end of file;
  * the end of the file.

After Fix

$ ligo run test y.jsligo 
Everything at the top-level was executed.
- test1 exited with value 1.
- test2 exited with value 2.

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).
  • Changelog title start 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 Melwyn Saldanha

Merge request reports