more jslinting
This commit is contained in:
parent
97b303a002
commit
40c8d6b0aa
|
@ -1,44 +1,47 @@
|
|||
/*jslint unparam: true, vars: true, maxerr: 50, indent: 4 */
|
||||
|
||||
// Keywords
|
||||
(function(baselib) {
|
||||
|
||||
(function (baselib) {
|
||||
'use strict';
|
||||
var exports = {};
|
||||
baselib.keywords = exports;
|
||||
|
||||
|
||||
var Keyword = function(val) {
|
||||
var Keyword = function (val) {
|
||||
this.val = val;
|
||||
};
|
||||
|
||||
var keywordCache = {};
|
||||
|
||||
// makeInstance: string -> Keyword.
|
||||
Keyword.makeInstance = function(val) {
|
||||
Keyword.makeInstance = function (val) {
|
||||
// To ensure that we can eq? symbols with equal values.
|
||||
if (!(val in keywordCache)) {
|
||||
keywordCache[val] = new Keyword(val);
|
||||
} else {
|
||||
if (!(keywordCache.hasOwnProperty(val))) {
|
||||
keywordCache[val] = new Keyword(val);
|
||||
}
|
||||
return keywordCache[val];
|
||||
};
|
||||
|
||||
Keyword.prototype.equals = function(other, aUnionFind) {
|
||||
Keyword.prototype.equals = function (other, aUnionFind) {
|
||||
return other instanceof Keyword &&
|
||||
this.val == other.val;
|
||||
this.val === other.val;
|
||||
};
|
||||
|
||||
|
||||
Keyword.prototype.toString = function(cache) {
|
||||
Keyword.prototype.toString = function (cache) {
|
||||
return this.val;
|
||||
};
|
||||
|
||||
Keyword.prototype.toWrittenString = function(cache) {
|
||||
Keyword.prototype.toWrittenString = function (cache) {
|
||||
return this.val;
|
||||
};
|
||||
|
||||
Keyword.prototype.toDisplayedString = function(cache) {
|
||||
Keyword.prototype.toDisplayedString = function (cache) {
|
||||
return this.val;
|
||||
};
|
||||
|
||||
|
||||
exports.Keyword = Keyword;
|
||||
|
||||
})(this['plt'].baselib);
|
||||
}(this.plt.baselib));
|
|
@ -1,18 +1,21 @@
|
|||
/*jslint vars: true, plusplus: true, maxerr: 50, indent: 4 */
|
||||
|
||||
// Basic library functions. This will include a few simple functions,
|
||||
// but be augmented with several namespaces for the other libraries in
|
||||
// the base library.
|
||||
if (! this['plt']) { this['plt'] = {}; }
|
||||
if (!(this.plt)) { this.plt = {}; }
|
||||
(function (plt) {
|
||||
'use strict';
|
||||
var baselib = {};
|
||||
plt['baselib'] = baselib;
|
||||
plt.baselib = baselib;
|
||||
|
||||
|
||||
|
||||
// Simple object inheritance.
|
||||
var heir = function(parentPrototype) {
|
||||
var f = function() {}
|
||||
f.prototype = parentPrototype;
|
||||
return new f();
|
||||
var heir = function (parentPrototype) {
|
||||
var F = function () {};
|
||||
F.prototype = parentPrototype;
|
||||
return new F();
|
||||
};
|
||||
|
||||
|
||||
|
@ -20,22 +23,23 @@ if (! this['plt']) { this['plt'] = {}; }
|
|||
// clone: object -> object
|
||||
// Copies an object. The new object should respond like the old
|
||||
// object, including to things like instanceof.
|
||||
var clone = function(obj) {
|
||||
var C = function() {}
|
||||
var clone = function (obj) {
|
||||
var property;
|
||||
var C = function () {};
|
||||
C.prototype = obj;
|
||||
var c = new C();
|
||||
for (property in obj) {
|
||||
if (obj.hasOwnProperty(property)) {
|
||||
c[property] = obj[property];
|
||||
}
|
||||
if (obj.hasOwnProperty(property)) {
|
||||
c[property] = obj[property];
|
||||
}
|
||||
}
|
||||
return c;
|
||||
};
|
||||
|
||||
|
||||
// Consumes a class and creates a predicate that recognizes subclasses.
|
||||
var makeClassPredicate = function(aClass) {
|
||||
return function(x) { return x instanceof aClass; };
|
||||
var makeClassPredicate = function (aClass) {
|
||||
return function (x) { return x instanceof aClass; };
|
||||
};
|
||||
|
||||
|
||||
|
@ -45,12 +49,9 @@ if (! this['plt']) { this['plt'] = {}; }
|
|||
// MACHINE.argcount has been initialized with the number of
|
||||
// arguments on the stack. vs provides optional values for the
|
||||
// arguments that go beyond those of the mandatoryArgCount.
|
||||
var withArguments = function(MACHINE,
|
||||
mandatoryArgCount,
|
||||
vs,
|
||||
f) {
|
||||
var args = [];
|
||||
for (var i = 0; i < MACHINE.argcount; i++) {
|
||||
var withArguments = function (MACHINE, mandatoryArgCount, vs, f) {
|
||||
var args = [], i;
|
||||
for (i = 0; i < MACHINE.argcount; i++) {
|
||||
if (i < mandatoryArgCount) {
|
||||
args.push(MACHINE.env[MACHINE.env.length - 1 - i]);
|
||||
} else {
|
||||
|
@ -72,4 +73,4 @@ if (! this['plt']) { this['plt'] = {}; }
|
|||
baselib.withArguments = withArguments;
|
||||
|
||||
|
||||
})(this['plt']);
|
||||
}(this.plt));
|
||||
|
|
Loading…
Reference in New Issue
Block a user