Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[js] Run fixjsstyle src/vm/js/nqp-runtime/*.js
  • Loading branch information
pmurias committed Oct 4, 2015
1 parent 5ca7473 commit 33c9123
Show file tree
Hide file tree
Showing 12 changed files with 142 additions and 142 deletions.
10 changes: 5 additions & 5 deletions src/vm/js/nqp-runtime/bignum.js
Expand Up @@ -31,15 +31,15 @@ function getBI(obj) {
}

op.fromstr_I = function(str, type) {
return makeBI(type,bignum(str));
return makeBI(type, bignum(str));
};

op.tostr_I = function(n) {
return getBI(n).toString();
};

op.base_I = function(n, base) {
return getBI(n).toString(base).toUpperCase().replace(/^-0+/,"-");
return getBI(n).toString(base).toUpperCase().replace(/^-0+/, '-');
};

op.iseq_I = function(a, b) {
Expand Down Expand Up @@ -76,7 +76,7 @@ op.expmod_I = function(a, b, c, type) {

op.div_In = function(a, b) {
var digits = 1e+20;
return getBI(a).mul(bignum(digits)).div(getBI(b)).toNumber()/digits;
return getBI(a).mul(bignum(digits)).div(getBI(b)).toNumber() / digits;
};

op.rand_I = function(max, type) {
Expand Down Expand Up @@ -140,9 +140,9 @@ op.tonum_I = function(n) {
op.fromnum_I = function(num, type) {
// node-bignum bug workaround, when a negative number is too big it gets turned into 0
if (num < 0) {
return makeBI(type,bignum(-num).neg());
return makeBI(type, bignum(-num).neg());
} else {
return makeBI(type,bignum(num));
return makeBI(type, bignum(num));
}
};

Expand Down
18 changes: 9 additions & 9 deletions src/vm/js/nqp-runtime/bootstrap.js
Expand Up @@ -17,7 +17,7 @@ function add_to_sc_with_st(obj) {
}

function add_to_sc_with_st_and_mo() {
throw "...";
throw '...';
}


Expand Down Expand Up @@ -61,8 +61,8 @@ var KnowHOW_HOW = repr.allocate(st);

add_to_sc_with_st(KnowHOW_HOW);

KnowHOW_HOW.id = "KnowHOW_HOW";
KnowHOW._STable.id = "KnowHOW";
KnowHOW_HOW.id = 'KnowHOW_HOW';
KnowHOW._STable.id = 'KnowHOW';
KnowHOW._STable.HOW = KnowHOW_HOW;

function add_knowhow_how_method(name, method) {
Expand All @@ -71,19 +71,19 @@ function add_knowhow_how_method(name, method) {
KnowHOW._STable.obj_constructor.prototype[name] = method;
}

add_knowhow_how_method("name", function() {
add_knowhow_how_method('name', function() {
return this.__name;
});

add_knowhow_how_method("attributes", function() {
add_knowhow_how_method('attributes', function() {
return this.__attributes;
});

add_knowhow_how_method("methods", function() {
add_knowhow_how_method('methods', function() {
return this.__methods;
});

add_knowhow_how_method("new_type", function(ctx, _NAMED) {
add_knowhow_how_method('new_type', function(ctx, _NAMED) {
/* We first create a new HOW instance. */
var HOW = this._STable.REPR.allocate(this._STable);

Expand All @@ -108,11 +108,11 @@ add_knowhow_how_method("new_type", function(ctx, _NAMED) {
return type_object;
});

add_knowhow_how_method("add_attribute", function(ctx, _NAMED, type, attr) {
add_knowhow_how_method('add_attribute', function(ctx, _NAMED, type, attr) {
this.__attributes.push(attr);
});

add_knowhow_how_method("compose", function(ctx, _NAMED, type_object) {
add_knowhow_how_method('compose', function(ctx, _NAMED, type_object) {
/* Set method cache */
type_object._STable.setMethodCache(this.__methods.content);

Expand Down
2 changes: 1 addition & 1 deletion src/vm/js/nqp-runtime/code-ref.js
Expand Up @@ -37,7 +37,7 @@ CodeRef.prototype.$$clone = function() {
var clone = new CodeRef(this.name);
clone.$call = this.$call;
clone.codeObj = this.codeObj;
clone.cuid = this.cuid+" clone";
clone.cuid = this.cuid + ' clone';
return clone;
};

Expand Down
24 changes: 12 additions & 12 deletions src/vm/js/nqp-runtime/core.js
Expand Up @@ -168,13 +168,13 @@ exports.slurpy_named = function(named) {
};

exports.unwrap_named = function(named) {
if (!named instanceof Hash) console.log("expecting a hash here");
if (!named instanceof Hash) console.log('expecting a hash here');
return named.content;
};

exports.named = function(parts) {
var all = {};
for (var i=0; i < parts.length; i++) {
for (var i = 0; i < parts.length; i++) {
var part = parts[i];
for (var key in part) {
all[key] = part[key];
Expand Down Expand Up @@ -207,7 +207,7 @@ op.defined = function(obj) {

op.setinvokespec = function(obj, classHandle, attrName, invocationHandler) {
if (invocationHandler !== null) {
throw "invocationHandler argument to setinvokespec not supported";
throw 'invocationHandler argument to setinvokespec not supported';
}
obj._STable.setinvokespec(classHandle, attrName, invocationHandler);
return obj;
Expand Down Expand Up @@ -238,7 +238,7 @@ op.setcodeobj = function(codeRef, codeObj) {
return codeRef;
};
op.getcodeobj = function(codeRef) {
return codeRef.codeObj ;
return codeRef.codeObj;
};

op.curcode = function() {
Expand Down Expand Up @@ -274,7 +274,7 @@ op.splice = function(target, source, offset, length) {
}
target.splice.apply(target, args);
return target;
}
};

op.findmethod = function(obj, method) {
return obj._STable.method_cache[method];
Expand All @@ -294,7 +294,7 @@ op.istype = function(obj, type) {

// TODO cases where the type_check_cache isn't authoritative
var cache = obj._STable.type_check_cache;
for (var i=0; i < cache.length; i++) {
for (var i = 0; i < cache.length; i++) {
if (cache[i] === type) {
return 1;
}
Expand All @@ -309,7 +309,7 @@ op.settypecache = function(obj, cache) {

op.setmethcache = function(obj, cache) {
if (!cache instanceof Hash) {
console.log("we expect a hash here");
console.log('we expect a hash here');
}
obj._STable.setMethodCache(cache.content);
return obj;
Expand All @@ -332,7 +332,7 @@ op.newtype = function(how, repr) {
var REPR = new reprs[repr]();
REPR.name = repr;
return REPR.type_object_for(how);
}
};

op.can = function(obj, method) {
return obj._STable.method_cache.hasOwnProperty(method) ? 1 : 0;
Expand All @@ -357,12 +357,12 @@ op.composetype = function(obj, reprinfo) {

op.clone = function(obj) {
if (obj.$$clone) {
return obj.$$clone();
return obj.$$clone();
} else if (obj instanceof Array) {
return obj.slice();
} else {
// STUB
console.log("NYI cloning", obj);
console.log('NYI cloning', obj);
return obj;
}
};
Expand All @@ -375,7 +375,7 @@ op.where = function(obj) {
}
return obj._WHERE;
} else {
throw "WHERE on this type of thing unimplemented";
throw 'WHERE on this type of thing unimplemented';
}
};

Expand Down Expand Up @@ -416,7 +416,7 @@ op.setcontspec = function(type, cont_spec_type, hash) {
return fetch.$call(ctx, {}, this);
});
} else {
throw "NYI cont spec: "+cont_spec_type;
throw 'NYI cont spec: '+ cont_spec_type;
}
};

Expand Down

0 comments on commit 33c9123

Please sign in to comment.