Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[js] Run fixjsstyle --strict src/vm/js/nqp-runtime/*.js
  • Loading branch information
pmurias committed Oct 4, 2015
1 parent 33c9123 commit 5522fb4
Show file tree
Hide file tree
Showing 12 changed files with 381 additions and 368 deletions.
2 changes: 1 addition & 1 deletion src/vm/js/nqp-runtime/array.js
@@ -1,5 +1,5 @@
function NqpArray() {
this.array = [];
this.array = [];
}

module.exports = NqpArray;
4 changes: 2 additions & 2 deletions src/vm/js/nqp-runtime/bignum.js
Expand Up @@ -13,11 +13,11 @@ op.box_i = function(i, type) {
};

op.unbox_i = function(obj) {
return obj.$$get_int();
return obj.$$get_int();
};

function intish_bool(b) {
return b ? 1 : 0;
return b ? 1 : 0;
}

function makeBI(type, num) {
Expand Down
12 changes: 6 additions & 6 deletions src/vm/js/nqp-runtime/bootstrap.js
Expand Up @@ -10,18 +10,18 @@ var core = new SerializationContext('__6MODEL_CORE__');
core.description = 'core SC';

function add_to_sc_with_st(obj) {
core.root_objects.push(obj);
core.root_stables.push(obj._STable);
obj._SC = core;
obj._STable._SC = core;
core.root_objects.push(obj);
core.root_stables.push(obj._STable);
obj._SC = core;
obj._STable._SC = core;
}

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


/* Creates and installs the KnowHOWAttribute type. */
/* Creates and installs the KnowHOWAttribute type. */
function create_KnowHOWAttribute() {
var meta_obj = KnowHOW_HOW._STable.REPR.allocate(KnowHOW_HOW._STable);

Expand Down
82 changes: 41 additions & 41 deletions src/vm/js/nqp-runtime/core.js
Expand Up @@ -21,9 +21,9 @@ op.atpos = function(array, index) {

op.bindpos = function(array, index, value) {
if (array instanceof Array) {
return (array[index] = value);
return (array[index] = value);
} else {
return array.$$bindpos(index, value);
return array.$$bindpos(index, value);
}
};

Expand Down Expand Up @@ -206,17 +206,17 @@ op.defined = function(obj) {


op.setinvokespec = function(obj, classHandle, attrName, invocationHandler) {
if (invocationHandler !== null) {
throw 'invocationHandler argument to setinvokespec not supported';
}
obj._STable.setinvokespec(classHandle, attrName, invocationHandler);
return obj;
if (invocationHandler !== null) {
throw 'invocationHandler argument to setinvokespec not supported';
}
obj._STable.setinvokespec(classHandle, attrName, invocationHandler);
return obj;
};

// Stub
op.setboolspec = function(obj, mode, method) {
obj._STable.setboolspec(mode, method);
return obj;
obj._STable.setboolspec(mode, method);
return obj;
};

function Capture(named,pos) {
Expand Down Expand Up @@ -284,12 +284,12 @@ op.istype = function(obj, type) {
/* Null always type checks false. */
/* HACK - undefined */
if (obj === null || obj === undefined) {
return 0;
return 0;
}

// HACK
if (typeof obj === 'number' || typeof obj === 'string' || obj instanceof Array) {
return 0;
return 0;
}

// TODO cases where the type_check_cache isn't authoritative
Expand All @@ -308,17 +308,17 @@ op.settypecache = function(obj, cache) {
};

op.setmethcache = function(obj, cache) {
if (!cache instanceof Hash) {
console.log('we expect a hash here');
}
obj._STable.setMethodCache(cache.content);
return obj;
if (!cache instanceof Hash) {
console.log('we expect a hash here');
}
obj._STable.setMethodCache(cache.content);
return obj;
};

op.setmethcacheauth = function(obj, isAuth) {
/* TODO we currently assume method caches are always authorative
/* TODO we currently assume method caches are always authorative
sadly that's not always the case*/
return obj;
return obj;
};

op.reprname = function(obj) {
Expand Down Expand Up @@ -371,7 +371,7 @@ var where_counter = 0;
op.where = function(obj) {
if (obj._STable) { // HACK
if (!obj._WHERE) {
obj._WHERE = ++where_counter;
obj._WHERE = ++where_counter;
}
return obj._WHERE;
} else {
Expand All @@ -397,35 +397,35 @@ op.sha1 = function(text) {
};

op.curlexpad = function(get, set) {
return new CurLexpad(get, set);
return new CurLexpad(get, set);
};

op.setcontspec = function(type, cont_spec_type, hash) {
var fetch = hash.content.fetch;
var store = hash.content.store;
if (cont_spec_type === 'code_pair') {
type._STable.addInternalMethod('$$assignunchecked', function(ctx, value) {
store.$call(ctx, {}, this, value);
return value;
});
type._STable.addInternalMethod('$$assign', function(ctx, value) {
store.$call(ctx, {}, this, value);
return value;
});
type._STable.addInternalMethod('$$decont', function(ctx) {
return fetch.$call(ctx, {}, this);
});
} else {
throw 'NYI cont spec: '+ cont_spec_type;
}
var fetch = hash.content.fetch;
var store = hash.content.store;
if (cont_spec_type === 'code_pair') {
type._STable.addInternalMethod('$$assignunchecked', function(ctx, value) {
store.$call(ctx, {}, this, value);
return value;
});
type._STable.addInternalMethod('$$assign', function(ctx, value) {
store.$call(ctx, {}, this, value);
return value;
});
type._STable.addInternalMethod('$$decont', function(ctx) {
return fetch.$call(ctx, {}, this);
});
} else {
throw 'NYI cont spec: ' + cont_spec_type;
}
};

op.iscont = function(cont) {
return cont.$$decont ? 1 : 0;
return cont.$$decont ? 1 : 0;
};

op.decont = function(ctx, cont) {
return cont.$$decont ? cont.$$decont(ctx) : cont;
return cont.$$decont ? cont.$$decont(ctx) : cont;
};

op.box_n = function(n, type) {
Expand All @@ -436,7 +436,7 @@ op.box_n = function(n, type) {
};

op.unbox_n = function(obj) {
return obj.$$get_num();
return obj.$$get_num();
};

op.box_s = function(value, type) {
Expand All @@ -447,7 +447,7 @@ op.box_s = function(value, type) {
};

op.unbox_s = function(obj) {
return obj.$$get_str();
return obj.$$get_str();
};

op.elems = function(obj) {
Expand Down
12 changes: 6 additions & 6 deletions src/vm/js/nqp-runtime/curlexpad.js
@@ -1,19 +1,19 @@
function CurLexpad(get, set) {
this.get = get;
this.set = set;
this.get = get;
this.set = set;
}

CurLexpad.prototype.$$atkey = function(key) {
return this.get[key]();
return this.get[key]();
};

CurLexpad.prototype.$$bindkey = function(key, value) {
this.set[key](value);
return value;
this.set[key](value);
return value;
};

CurLexpad.prototype.$$existskey = function(key) {
return this.set.hasOwnProperty(key);
return this.set.hasOwnProperty(key);
};

module.exports = CurLexpad;

0 comments on commit 5522fb4

Please sign in to comment.