From 02baaa019241b4d6093a46c5702798d3a3393221 Mon Sep 17 00:00:00 2001 From: nisstyre56 Date: Sun, 9 Mar 2014 16:10:44 -0400 Subject: [PATCH] some minor cosmetic fixes --- cexps.js | 8 ++++---- closure_conversion.js | 1 + pprint.js | 2 +- representation.js | 34 +++++++++++++++++----------------- tools.js | 8 ++++---- 5 files changed, 27 insertions(+), 26 deletions(-) diff --git a/cexps.js b/cexps.js index b7726d0..8a41373 100644 --- a/cexps.js +++ b/cexps.js @@ -8,7 +8,7 @@ var cexp = { type : "cexp" -} +}; function record(values_accesspaths, w, @@ -78,7 +78,7 @@ function accessPath(offp, selp) { var primoptype = { type : "primop", equal : function(pOp) { - return this.name === pOp.name + return this.name === pOp.name; } }; @@ -86,7 +86,7 @@ function Primop(name) { function ptype() { this.name = name; return this; - }; + } ptype.prototype = primoptype; return new ptype(); } @@ -113,7 +113,7 @@ var makeref = Primop("makeref"); var makerefunboxed = Primop("makerefunboxed"); var alength = Primop("alength"); var slength = Primop("slength"); -var gethdlr = Primop("gethdlr") +var gethdlr = Primop("gethdlr"); var sethdlr = Primop("sethdlr"); var boxed = Primop("boxed"); var fadd = Primop("fadd"); diff --git a/closure_conversion.js b/closure_conversion.js index eeb59c0..44c3a06 100644 --- a/closure_conversion.js +++ b/closure_conversion.js @@ -62,6 +62,7 @@ function fvs_helper(stx) { else { return $.flatten([fvs_helper(stx.condition), fvs_helper(stx.thenexp)]); } + break; case "Name": return stx.ident; } diff --git a/pprint.js b/pprint.js index 19a94a8..023b1f8 100644 --- a/pprint.js +++ b/pprint.js @@ -58,7 +58,7 @@ function pprint(expr) { else if (expr.exprType === "Let") return "let {" + expr.pairs.map( function (v) { - return pprint(v) + return pprint(v); }).join(" ; ") + "} in " + pprint(expr.body); } diff --git a/representation.js b/representation.js index ccc708c..9e23498 100644 --- a/representation.js +++ b/representation.js @@ -200,10 +200,10 @@ function makeGensym() { var gensym = makeGensym(); OPInfo = {"+" : [3, "Left"], - "-" : [3, "Left"], - "*" : [4, "Left"], - "/" : [4, "Left"], - "^" : [5, "Right"], + "-" : [3, "Left"], + "*" : [4, "Left"], + "/" : [4, "Left"], + "^" : [5, "Right"], "++" : [3, "Left"], "==" : [2, "Left"], ">" : [2, "Left"], @@ -219,22 +219,22 @@ OPInfo = {"+" : [3, "Left"], ">>=" : [1, "Left"], "<$>" : [1, "Left"], "." : [1, "Left"], - "," : [1, "Left"]} + "," : [1, "Left"]}; module.exports = { IntT : IntT, - FloatT : FloatT, - StrT : StrT, - BoolT : BoolT, - ListT : ListT, - FuncT : FuncT, - App : App, - Name : Name, - Def : Def, - OpT : OpT, - OPInfo : OPInfo, - makeApp : makeApp, - If : If, + FloatT : FloatT, + StrT : StrT, + BoolT : BoolT, + ListT : ListT, + FuncT : FuncT, + App : App, + Name : Name, + Def : Def, + OpT : OpT, + OPInfo : OPInfo, + makeApp : makeApp, + If : If, DefFunc : DefFunc, UnaryOp : UnaryOp, Nil : Nil, diff --git a/tools.js b/tools.js index 9d682a0..8be3018 100644 --- a/tools.js +++ b/tools.js @@ -123,7 +123,7 @@ function find(f, haystack) { } function dict(pairs) { - var o = new Object(); + var o = {}; pairs.map(function(p) { o[p[0]] = p[1]; }); @@ -188,8 +188,8 @@ print(matcher(">=")); */ module.exports = {compose : compose, - not : not, - on : on, + not : not, + on : on, maxBy : maxBy, len : len, groupOps : groupOps, @@ -200,4 +200,4 @@ module.exports = {compose : compose, eq: eq, extend : extend, flatten : flatten, - difference : difference} + difference : difference};