Sha256: df23cac5c33773f4795b0ed9dbbe4948017533b81b00d5aa0821b3458117cce6
Contents?: true
Size: 742 Bytes
Versions: 21
Compression:
Stored size: 742 Bytes
Contents
var jsp = require("./parse-js"), pro = require("./process"), slice = jsp.slice, member = jsp.member, PRECEDENCE = jsp.PRECEDENCE, OPERATORS = jsp.OPERATORS; function ast_squeeze_more(ast) { var w = pro.ast_walker(), walk = w.walk; return w.with_walkers({ "call": function(expr, args) { if (expr[0] == "dot" && expr[2] == "toString" && args.length == 0) { // foo.toString() ==> foo+"" return [ "binary", "+", expr[1], [ "string", "" ]]; } } }, function() { return walk(ast); }); }; exports.ast_squeeze_more = ast_squeeze_more;
Version data entries
21 entries across 21 versions & 4 rubygems