-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
viper: error source mappings in moc.js
#3501
Conversation
There is currently a bug hiding somewhere in the way that I expect this to be a quick fix tomorrow, but I would appreciate a second pair of eyes in case anyone gets a chance to skim this PR. This is most likely the final step to a working demo for source locations. Here's a command to reproduce the issue: make -C src moc.js && node -e "const {Motoko} = require('./src/moc.js'); Motoko.saveFile('File.mo', 'actor { public func abc(): async () { } };'); console.log('Result:', Motoko.viper(['File.mo']).code.lookup('', [0,0,0,0]))" Replacing Does anything stand out as the issue? Otherwise I'll continue narrowing this down tomorrow morning. |
@@ -494,14 +494,12 @@ let viper_files' parsefn files : viper_result = | |||
let prog = CompUnit.combine_progs progs in | |||
let u = CompUnit.comp_unit_of_prog false prog in | |||
let v = Viper.Trans.unit u in | |||
let s = Viper.Pretty.prog v in | |||
let s = Viper.Pretty.prog_mapped "" v in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The filename passed in must be the one that the Viper-side diagnostic points to.
My hunch is that the EDIT: Oh, I see, passing 2nd hunch: reverse mappings only exist for Motoko/Viper statements, but your code has an empty body. Found a hit:
gives Result: { start: { line: 0, character: 94 }, end: { line: 0, character: 101 } } Which corresponds to the statement |
@rvanasa can this go in? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Merging. If anything needs a quick fix, I'll just commit directly to the |
Passes the
lookup
function throughmoc.js
to facilitate source mapping in VS Code.