minor clean-ups (#5604)

This commit is contained in:
Alex Lam S.L
2022-08-06 03:45:44 +01:00
committed by GitHub
parent a9d9af53e9
commit 387c69b194
4 changed files with 65 additions and 130 deletions

View File

@@ -127,8 +127,10 @@ function push_uniq(array, el) {
function string_template(text, props) {
return text.replace(/\{([^{}]+)\}/g, function(str, p) {
var value = props[p];
return value instanceof AST_Node ? value.print_to_string() : value;
var value = p == "this" ? props : props[p];
if (value instanceof AST_Node) return value.print_to_string();
if (value instanceof AST_Token) return value.file + ":" + value.line + "," + value.col;
return value;
});
}