From 4ba4d1458cc9f6e9e4727de382828dce8ecffc83 Mon Sep 17 00:00:00 2001 From: Shu-yu Guo Date: Fri, 24 Sep 2010 14:01:52 -0700 Subject: [PATCH] Small narcissus formatting fixes. (rs=brendan) --- js/narcissus/jsexec.js | 6 +++--- js/narcissus/jsparse.js | 6 ++---- js/narcissus/jsssa.js | 13 +++++-------- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/js/narcissus/jsexec.js b/js/narcissus/jsexec.js index 531c28e86dd4..eb5184f93edc 100644 --- a/js/narcissus/jsexec.js +++ b/js/narcissus/jsexec.js @@ -307,7 +307,7 @@ Narcissus.interpreter = (function() { : new TypeError(message); } - function valuatePhis(n, v) { + function evaluatePhis(n, v) { var ps = n.phiUses; if (!ps) return; @@ -319,7 +319,7 @@ Narcissus.interpreter = (function() { if (ps[i].v === v) break; ps[i].v = v; - valuatePhis(ps[i], v); + evaluatePhis(ps[i], v); } } @@ -869,7 +869,7 @@ Narcissus.interpreter = (function() { if (n.backwards) { n.v = v; } - valuatePhis(n, v); + evaluatePhis(n, v); return v; } diff --git a/js/narcissus/jsparse.js b/js/narcissus/jsparse.js index 3983254c9c8c..0fa386b0140d 100644 --- a/js/narcissus/jsparse.js +++ b/js/narcissus/jsparse.js @@ -86,10 +86,8 @@ Narcissus.parser = (function() { if (typeof unbound !== "object") continue; - /* - * We store the bound sub-builder as builder's own property - * so that we can have multiple builders at the same time. - */ + // We store the bound sub-builder as builder's own property + // so that we can have multiple builders at the same time. var bound = builder[ns] = {}; for (var m in unbound) { bound[m] = bindMethod(unbound[m], builder); diff --git a/js/narcissus/jsssa.js b/js/narcissus/jsssa.js index 7680c0c17682..6e9bbd93602b 100644 --- a/js/narcissus/jsssa.js +++ b/js/narcissus/jsssa.js @@ -1068,21 +1068,18 @@ for (var ns in super.prototype) { var childNS = childProto[ns]; var superNS = superProto[ns]; - var childNSType = typeof childNS; - if (childNSType === "undefined") { + if (childNS === undefined) { childProto[ns] = superNS; - } else if (childNSType === "object") { + } else { for (var m in superNS) { let childMethod = childNS[m]; let superMethod = superNS[m]; - if (typeof childMethod === "undefined") { + if (childMethod === undefined) { childNS[m] = superMethod; } else { childNS[m] = function() { - if (this.binds) - return childMethod.apply(this, arguments); - else - return superMethod.apply(this, arguments); + return (this.binds ? childMethod : superMethod) + .apply(this, arguments); }; } }