Skip to content

Commit

Permalink
remove assert require calls from production builds
Browse files Browse the repository at this point in the history
  • Loading branch information
petkaantonov committed Mar 15, 2014
1 parent 0178b84 commit b6a3385
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ast_passes.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,21 @@ var astPasses = module.exports = {
while(rlineterm.test(src.charAt(e++)));
results.push( new Empty( s + 2, e - 1) );
}
},
VariableDeclaration: function(node) {
var start = node.start;
var end = node.end;
if (node.kind === 'var' && node.declarations.length === 1) {
var decl = node.declarations[0];
if (decl.id.type === "Identifier" &&
decl.id.name === "ASSERT") {
var e = end + 1;
var s = start - 1;
while(rhorizontalws.test(src.charAt(s--)));
while(rlineterm.test(src.charAt(e++)));
results.push( new Empty( s + 2, e - 1) );
}
}
}
});
return convertSrc( src, results );
Expand Down

0 comments on commit b6a3385

Please sign in to comment.