Skip to content

Commit

Permalink
cfg: fix some nits
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny committed Sep 25, 2012
1 parent 65979fa commit 42dbc39
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/spoon/cfg.js
Expand Up @@ -933,10 +933,11 @@ Cfg.prototype.visitTry = function visitTry(ast) {

Cfg.prototype.visitThrow = function visitTry(ast) {
this.add('throw', ast.argument ? [ this.visit(ast.argument) ] : []);
return null;
};

Cfg.prototype.visitNew = function visitNew(ast) {
this.add('new', [
return this.add('new', [
this.visit(ast.callee)
].concat(ast.arguments.map(function(arg) {
return this.visit(arg);
Expand Down
6 changes: 5 additions & 1 deletion lib/spoon/renderer.js
Expand Up @@ -216,8 +216,12 @@ Renderer.prototype.renderInstruction = function renderInstruction(instr) {
Renderer.prototype.renderLiteral = function renderLiteral(args) {
if (typeof args[0] === 'string') {
return ['string', args[0]];
} else {
} else if (typeof args[0] === 'number') {
return ['num', args[0]];
} else if (args[0] === undefined) {
return ['name', 'undefined'];
} else {
return ['name', args[0].toString()];
}
};

Expand Down

0 comments on commit 42dbc39

Please sign in to comment.