do not output constrains if there are no features
This commit is contained in:
parent
38b01e67dc
commit
1e3d236aed
|
|
@ -49,9 +49,10 @@ function replaceMangled(code, file) {
|
|||
var feature_outputter = new FeatureJsonOutputter();
|
||||
generateAstFeatures(toplevel, feature_outputter);
|
||||
generateFnamesFeatures(toplevel, feature_outputter);
|
||||
generateFscopeConstraints(toplevel, feature_outputter);
|
||||
|
||||
//feature_outputter.string_map defines what id is assigment to each node in the final output
|
||||
//therefore to assign same ids, we need to first populate by running feature extraction
|
||||
//feature_outputter.string_map defines what id is assigned to each node in the final output
|
||||
//therefore to assign same ids, we need to first populate string_map by running feature extraction
|
||||
var stream = OutputStream({beautify : true, replace_mangled_map : feature_outputter.string_map});
|
||||
toplevel.print(stream);
|
||||
return stream.toString();
|
||||
|
|
@ -361,6 +362,7 @@ function FeatureJsonOutputter() {
|
|||
this.depth = 0;
|
||||
this.pairs = {};
|
||||
this.cur_scope = {};
|
||||
this.has_features = false;
|
||||
}
|
||||
|
||||
FeatureJsonOutputter.prototype.indent = function() {
|
||||
|
|
@ -432,6 +434,8 @@ FeatureJsonOutputter.prototype.addFeature = function(a, b, name){
|
|||
return;
|
||||
}
|
||||
|
||||
this.has_features = true;
|
||||
|
||||
this.openElem();
|
||||
|
||||
this.output += '"a": ' + a_id + ",";
|
||||
|
|
@ -457,6 +461,12 @@ FeatureJsonOutputter.prototype.addSymbol = function(key){
|
|||
};
|
||||
|
||||
FeatureJsonOutputter.prototype.dumpSymbols = function(){
|
||||
if (!this.has_features) {
|
||||
this.openArray("assign");
|
||||
this.closeArray();
|
||||
return;
|
||||
}
|
||||
|
||||
this.openArray("assign");
|
||||
|
||||
// var keys = Object.keys( this.string_map.map );
|
||||
|
|
@ -479,6 +489,10 @@ FeatureJsonOutputter.prototype.addToScope = function(a){
|
|||
|
||||
FeatureJsonOutputter.prototype.endScope = function(){
|
||||
//{"cn":"!=","n":[14,366,370,372,108,40,356]}
|
||||
if (!this.has_features) {
|
||||
return;
|
||||
}
|
||||
|
||||
var keys = Object.keys(this.cur_scope);
|
||||
if (keys.length <= 1) {
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user