From cad5e8935f92e10172e37ef1692a193394c26a5c Mon Sep 17 00:00:00 2001 From: Pavol Bielik Date: Thu, 19 Feb 2015 01:10:45 +0100 Subject: [PATCH] update features --- lib/feature_extractor.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/feature_extractor.js b/lib/feature_extractor.js index 0e927bc1..6651443d 100644 --- a/lib/feature_extractor.js +++ b/lib/feature_extractor.js @@ -57,7 +57,7 @@ function replaceMangled(code, file, infered_names) { //replace variables with inferred names stream = OutputStream({ beautify: true, replace_mangled: function (node) { - var label = nodeToString(node); + var label = nodeToProperty(node).toString(); if (node.definition() && feature_outputter.string_map.hasId(label) && feature_outputter.string_map.getId(label) in infered_names){ return infered_names[feature_outputter.string_map.getId(label)]; } else { @@ -70,8 +70,8 @@ function replaceMangled(code, file, infered_names) { //replace variables with placeholders. Using in the online demo for interactive renaming. stream = OutputStream({ beautify: true, replace_mangled: function (node) { - if (node.definition() && feature_outputter.string_map.hasId(nodeToString(node))){ - return "local$$" + feature_outputter.string_map.getId(nodeToString(node)); + if (node.definition() && feature_outputter.string_map.hasId(nodeToProperty(node).toString())){ + return "local$$" + feature_outputter.string_map.getId(nodeToProperty(node).toString()); } else { return node.name; } @@ -244,10 +244,10 @@ function pathToStringFw(path, start){ } function pathToStringBw(path, start){ - var res = ""; + var res = "[" + path[path.length-1].child_id + "]"; for (var i = path.length - 2; i >= start; i--) { res += nodeType(path[i]); - res += "[" + path[i+1].child_id + "]"; + res += "[" + path[i].child_id + "]"; } return res;