Skip to content

Wrong line number reported on runtime error #953

@pavel

Description

@pavel

Having a following index.ls file:

for i from 0 to 2
	console.log 'Hello', ind

When running it with:

lsc index.ls

I get the following error:

Failed at: index.ls
ReferenceError: ind is not defined
    at Object.<anonymous> (/tmp/livescript-test/index.ls:5:24)
1| // Generated by LiveScript 1.5.0
2| var i$, i;
3| for (i$ = 0; i$ <= 2; ++i$) {
4|   i = i$;
5+   console.log('Hello', ind);
6| }
7| 
8| 
9| 
    at Module._compile (module.js:571:32)
    at Object.LiveScript.run (/tmp/livescript-test/node_modules/livescript/lib/node.js:31:19)
    at compileScript (/tmp/livescript-test/node_modules/livescript/lib/command.js:222:31)
    at /tmp/livescript-test/node_modules/livescript/lib/command.js:152:11
    at /tmp/livescript-test/node_modules/livescript/lib/command.js:142:7
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:416:3)

The problem is that line number 5 reported in error log for index.ls is incorrect in scope of index.ls file. In this example I get a full compiled version as (probably) the demo is short. But when working with bigger files, I do not get a full compiled version, so it becomes difficult to track errors.

I tried to use sourcemaps by running:

lsc -m embedded index.ls

the result is still the same.

Is there a way to make errors show on correct lines in scope of ls files?


OS: Linux
Node.js: 7.5.0
LiveScript: 1.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions