[JS IR] Generate 'names' entries for functions in sourcemaps

This commit is contained in:
Sergej Jaskiewicz
2022-10-04 18:17:59 +02:00
committed by Space Team
parent 1d0025c3cf
commit d9681caf0c
74 changed files with 210 additions and 177 deletions
@@ -1132,6 +1132,15 @@ public class JsAstMapper {
if (astNode == null) return null;
CodePosition location = node.getPosition();
// For functions, consider their location to be at the opening parenthesis.
if (node.getType() == TokenStream.FUNCTION) {
Node c = node.getFirstChild();
while (c != null && c.getType() != TokenStream.LP)
c = c.getNext();
if (c != null && c.getPosition() != null)
location = c.getPosition();
}
if (location != null) {
JsLocation jsLocation = new JsLocation(fileName, location.getLine(), location.getOffset());
if (astNode instanceof SourceInfoAwareJsNode) {