enhance sourceMap (#4953)

This commit is contained in:
Alex Lam S.L
2021-05-23 16:57:44 +01:00
committed by GitHub
parent d2a45ba441
commit 5d4e6e3bdc
3 changed files with 19 additions and 2 deletions

View File

@@ -1692,7 +1692,7 @@ var AST_ObjectMethod = DEFNODE("ObjectMethod", null, {
_validate: function() {
if (!(this.value instanceof AST_LambdaExpression)) throw new Error("value must be AST_LambdaExpression");
if (is_arrow(this.value)) throw new Error("value cannot be AST_Arrow or AST_AsyncArrow");
if (this.value.name != null) throw new Error("name of class method's lambda must be null");
if (this.value.name != null) throw new Error("name of object method's lambda must be null");
},
}, AST_ObjectKeyVal);

View File

@@ -1935,7 +1935,11 @@ function OutputStream(options) {
output.add_mapping(this.start);
});
DEFMAP([ AST_DestructuredKeyVal, AST_ObjectProperty ], function(output) {
DEFMAP([
AST_ClassProperty,
AST_DestructuredKeyVal,
AST_ObjectProperty,
], function(output) {
if (typeof this.key == "string") output.add_mapping(this.start, this.key);
});
})();