[JS BE] Make sourceMap generation more precise
- Don't produce mapping for closing bracket in case of expressionBody - Map Kt*Function declaration into corresponding js fun declaration - Update test data & add new test
This commit is contained in:
@@ -346,6 +346,10 @@ public class Node implements Cloneable {
|
||||
return position;
|
||||
}
|
||||
|
||||
public void setPosition(CodePosition position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
/** Can only be called when <tt>getType() == TokenStream.NUMBER</tt> */
|
||||
public double getDouble() throws UnsupportedOperationException {
|
||||
throw new UnsupportedOperationException(this + " is not a number node");
|
||||
|
||||
@@ -222,7 +222,6 @@ public class Parser {
|
||||
int savedFunctionNumber = functionNumber;
|
||||
Node args;
|
||||
Node body;
|
||||
CodePosition closingBracketPosition;
|
||||
try {
|
||||
functionNumber = 0;
|
||||
args = nf.createLeaf(TokenStream.LP, ts.tokenPosition);
|
||||
@@ -241,7 +240,7 @@ public class Parser {
|
||||
|
||||
mustMatchToken(ts, TokenStream.LC, "msg.no.brace.body");
|
||||
body = parseFunctionBody(ts);
|
||||
closingBracketPosition = ts.tokenPosition;
|
||||
body.setPosition(ts.tokenPosition);
|
||||
mustMatchToken(ts, TokenStream.RC, "msg.no.brace.after.body");
|
||||
// skip the last EOL so nested functions work...
|
||||
}
|
||||
@@ -250,7 +249,7 @@ public class Parser {
|
||||
functionNumber = savedFunctionNumber;
|
||||
}
|
||||
|
||||
Node pn = nf.createFunction(nameNode, args, body, closingBracketPosition);
|
||||
Node pn = nf.createFunction(nameNode, args, body, basePosition);
|
||||
if (memberExprNode != null) {
|
||||
pn = nf.createBinary(TokenStream.ASSIGN, TokenStream.NOP, memberExprNode, pn, basePosition);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user