fix pure with number arg in shapeshifter
This commit is contained in:
parent
56069a2d38
commit
8bf7a6ba6e
2 changed files with 4 additions and 3 deletions
|
|
@ -91,7 +91,9 @@ export default (code) => {
|
||||||
const isMarkable = isPatternArg(parents) || hasModifierCall(parent);
|
const isMarkable = isPatternArg(parents) || hasModifierCall(parent);
|
||||||
// add to location to pure(x) calls
|
// add to location to pure(x) calls
|
||||||
if (node.type === 'CallExpression' && node.callee.name === 'pure') {
|
if (node.type === 'CallExpression' && node.callee.name === 'pure') {
|
||||||
return reifyWithLocation(node.arguments[0].name, node.arguments[0], ast.locations, artificialNodes);
|
const literal = node.arguments[0];
|
||||||
|
const value = literal[{ LiteralNumericExpression: 'value', LiteralStringExpression: 'name' }[literal.type]];
|
||||||
|
return reifyWithLocation(value + '', node.arguments[0], ast.locations, artificialNodes);
|
||||||
}
|
}
|
||||||
// replace pseudo note variables
|
// replace pseudo note variables
|
||||||
if (node.type === 'IdentifierExpression') {
|
if (node.type === 'IdentifierExpression') {
|
||||||
|
|
@ -339,4 +341,3 @@ function getLocationObject(node, locations) {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ class Hap {
|
||||||
}
|
}
|
||||||
|
|
||||||
show() {
|
show() {
|
||||||
return "(" + (this.whole == undefined ? "~" : this.whole.show()) + ", " + this.part.show() + ", " + this.value + ")"
|
return "(" + (this.whole == undefined ? "~" : this.whole.show()) + ", " + this.part.show() + ", " + JSON.stringify(this.value?.value ?? this.value) + ")"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue