Amos Wenger

Results 189 comments of Amos Wenger

Alright. I've been reading up more on sweet.js to be able to understand and help with ki. I'll try writing the minimal set of macro/rules required to reproduce the issues...

Here's a test case that makes it obvious what the real problem is: ![screen shot 2014-11-05 at 17 54 10](https://cloud.githubusercontent.com/assets/7998310/4921750/7323d802-650c-11e4-87b7-cc468de0cec8.png) Generated source maps refer to the macro definitions. Since in...

Including ki's `macros/index.js` verbatim in a test ki program and compiling via sjs gives a similar result than the simple test above: ![screen shot 2014-11-05 at 17 59 36](https://cloud.githubusercontent.com/assets/7998310/4921870/40d360b0-650d-11e4-88e9-939462294829.png)

@lantiga I managed to isolate the problem, and opened https://github.com/mozilla/sweet.js/issues/411 to track it.

> It's not entirely clear to me what should happen here. Optionally suppress the stack trace that goes into the module? I think, when the code is macro-expanded using definitions...

> My guess is that sweet is concatenating modules to code right before macroexpansion. I don't think so. The line numbers pointed at by the source map do exist and...

Dumping the AST shows this: ![screen shot 2014-11-05 at 22 21 12](https://cloud.githubusercontent.com/assets/7998310/4926233/b8c6496a-6531-11e4-87e1-534d051a6e28.png) As you can see, the throw statement is wrongly located (line 13), but its argument is correct (line...

@lantiga I agree. I've just stumbled upon sweet.js's "debug.js" file that allows stepping through the compilation process, hopefully I can gain a better understanding of how modules are handled in...

> My guess is that sweet is concatenating modules to code right before macroexpansion. Actually it does, but on an AST level, not a source level: ``` js // fun...

Right now, seems to be a feature, not a bug, as `adjustLineContext` seems to show: ``` js function adjustLineContext(stx, original, current) { // short circuit when the array is empty;...