code
stringlengths 24
2.07M
| docstring
stringlengths 25
85.3k
| func_name
stringlengths 1
92
| language
stringclasses 1
value | repo
stringlengths 5
64
| path
stringlengths 4
172
| url
stringlengths 44
218
| license
stringclasses 7
values |
---|---|---|---|---|---|---|---|
later = function() {
timeout = null;
if (!immediate) result = func.apply(context, args);
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
later
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
eq = function(a, b, aStack, bStack) {
// Identical objects are equal. `0 === -0`, but they aren't identical.
// See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal.
if (a === b) return a !== 0 || 1 / a == 1 / b;
// A strict comparison is necessary because `null == undefined`.
if (a == null || b == null) return a === b;
// Unwrap any wrapped objects.
if (a instanceof _) a = a._wrapped;
if (b instanceof _) b = b._wrapped;
// Compare `[[Class]]` names.
var className = toString.call(a);
if (className != toString.call(b)) return false;
switch (className) {
// Strings, numbers, dates, and booleans are compared by value.
case '[object String]':
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
// equivalent to `new String("5")`.
return a == String(b);
case '[object Number]':
// `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
// other numeric values.
return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b);
case '[object Date]':
case '[object Boolean]':
// Coerce dates and booleans to numeric primitive values. Dates are compared by their
// millisecond representations. Note that invalid dates with millisecond representations
// of `NaN` are not equivalent.
return +a == +b;
// RegExps are compared by their source patterns and flags.
case '[object RegExp]':
return a.source == b.source &&
a.global == b.global &&
a.multiline == b.multiline &&
a.ignoreCase == b.ignoreCase;
}
if (typeof a != 'object' || typeof b != 'object') return false;
// Assume equality for cyclic structures. The algorithm for detecting cyclic
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
var length = aStack.length;
while (length--) {
// Linear search. Performance is inversely proportional to the number of
// unique nested structures.
if (aStack[length] == a) return bStack[length] == b;
}
// Add the first object to the stack of traversed objects.
aStack.push(a);
bStack.push(b);
var size = 0, result = true;
// Recursively compare objects and arrays.
if (className == '[object Array]') {
// Compare array lengths to determine if a deep comparison is necessary.
size = a.length;
result = size == b.length;
if (result) {
// Deep compare the contents, ignoring non-numeric properties.
while (size--) {
if (!(result = eq(a[size], b[size], aStack, bStack))) break;
}
}
} else {
// Objects with different constructors are not equivalent, but `Object`s
// from different frames are.
var aCtor = a.constructor, bCtor = b.constructor;
if (aCtor !== bCtor && !(_.isFunction(aCtor) && (aCtor instanceof aCtor) &&
_.isFunction(bCtor) && (bCtor instanceof bCtor))) {
return false;
}
// Deep compare objects.
for (var key in a) {
if (_.has(a, key)) {
// Count the expected number of properties.
size++;
// Deep compare each member.
if (!(result = _.has(b, key) && eq(a[key], b[key], aStack, bStack))) break;
}
}
// Ensure that both objects contain the same number of properties.
if (result) {
for (key in b) {
if (_.has(b, key) && !(size--)) break;
}
result = !size;
}
}
// Remove the first object from the stack of traversed objects.
aStack.pop();
bStack.pop();
return result;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
eq
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
template = function(data) {
return render.call(this, data, _);
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
template
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
result = function(obj) {
return this._chain ? _(obj).chain() : obj;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
result
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function checkOption(name, t) {
name = name.trim();
if (/^[+-]W\d{3}$/g.test(name)) {
return true;
}
if (valOptions[name] === undefined && boolOptions[name] === undefined) {
if (t.type !== "jslint") {
error("E001", t, name);
return false;
}
}
return true;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
checkOption
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function isString(obj) {
return Object.prototype.toString.call(obj) === "[object String]";
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
isString
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function isIdentifier(tkn, value) {
if (!tkn)
return false;
if (!tkn.identifier || tkn.value !== value)
return false;
return true;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
isIdentifier
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function isReserved(token) {
if (!token.reserved) {
return false;
}
var meta = token.meta;
if (meta && meta.isFutureReservedWord && state.option.inES5()) {
// ES3 FutureReservedWord in an ES5 environment.
if (!meta.es5) {
return false;
}
// Some ES5 FutureReservedWord identifiers are active only
// within a strict mode environment.
if (meta.strictOnly) {
if (!state.option.strict && !state.directive["use strict"]) {
return false;
}
}
if (token.isProperty) {
return false;
}
}
return true;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
isReserved
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function supplant(str, data) {
return str.replace(/\{([^{}]*)\}/g, function (a, b) {
var r = data[b];
return typeof r === "string" || typeof r === "number" ? r : a;
});
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
supplant
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function combine(dest, src) {
Object.keys(src).forEach(function (name) {
if (JSHINT.blacklist.hasOwnProperty(name)) return;
dest[name] = src[name];
});
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
combine
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function assume() {
if (state.option.es5) {
warning("I003");
}
if (state.option.couch) {
combine(predefined, vars.couch);
}
if (state.option.rhino) {
combine(predefined, vars.rhino);
}
if (state.option.shelljs) {
combine(predefined, vars.shelljs);
combine(predefined, vars.node);
}
if (state.option.typed) {
combine(predefined, vars.typed);
}
if (state.option.phantom) {
combine(predefined, vars.phantom);
}
if (state.option.prototypejs) {
combine(predefined, vars.prototypejs);
}
if (state.option.node) {
combine(predefined, vars.node);
combine(predefined, vars.typed);
}
if (state.option.devel) {
combine(predefined, vars.devel);
}
if (state.option.dojo) {
combine(predefined, vars.dojo);
}
if (state.option.browser) {
combine(predefined, vars.browser);
combine(predefined, vars.typed);
}
if (state.option.nonstandard) {
combine(predefined, vars.nonstandard);
}
if (state.option.jquery) {
combine(predefined, vars.jquery);
}
if (state.option.mootools) {
combine(predefined, vars.mootools);
}
if (state.option.worker) {
combine(predefined, vars.worker);
}
if (state.option.wsh) {
combine(predefined, vars.wsh);
}
if (state.option.globalstrict && state.option.strict !== false) {
state.option.strict = true;
}
if (state.option.yui) {
combine(predefined, vars.yui);
}
// Let's assume that chronologically ES3 < ES5 < ES6/ESNext < Moz
state.option.inMoz = function (strict) {
if (strict) {
return state.option.moz && !state.option.esnext;
}
return state.option.moz;
};
state.option.inESNext = function (strict) {
if (strict) {
return !state.option.moz && state.option.esnext;
}
return state.option.moz || state.option.esnext;
};
state.option.inES5 = function (/* strict */) {
return !state.option.es3;
};
state.option.inES3 = function (strict) {
if (strict) {
return !state.option.moz && !state.option.esnext && state.option.es3;
}
return state.option.es3;
};
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
assume
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function quit(code, line, chr) {
var percentage = Math.floor((line / state.lines.length) * 100);
var message = messages.errors[code].desc;
throw {
name: "JSHintError",
line: line,
character: chr,
message: message + " (" + percentage + "% scanned).",
raw: message,
code: code
};
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
quit
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function isundef(scope, code, token, a) {
return JSHINT.undefs.push([scope, code, token, a]);
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
isundef
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function warning(code, t, a, b, c, d) {
var ch, l, w, msg;
if (/^W\d{3}$/.test(code)) {
if (state.ignored[code])
return;
msg = messages.warnings[code];
} else if (/E\d{3}/.test(code)) {
msg = messages.errors[code];
} else if (/I\d{3}/.test(code)) {
msg = messages.info[code];
}
t = t || state.tokens.next;
if (t.id === "(end)") { // `~
t = state.tokens.curr;
}
l = t.line || 0;
ch = t.from || 0;
w = {
id: "(error)",
raw: msg.desc,
code: msg.code,
evidence: state.lines[l - 1] || "",
line: l,
character: ch,
scope: JSHINT.scope,
a: a,
b: b,
c: c,
d: d
};
w.reason = supplant(msg.desc, w);
JSHINT.errors.push(w);
if (state.option.passfail) {
quit("E042", l, ch);
}
warnings += 1;
if (warnings >= state.option.maxerr) {
quit("E043", l, ch);
}
return w;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
warning
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function warningAt(m, l, ch, a, b, c, d) {
return warning(m, {
line: l,
from: ch
}, a, b, c, d);
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
warningAt
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function error(m, t, a, b, c, d) {
warning(m, t, a, b, c, d);
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
error
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function errorAt(m, l, ch, a, b, c, d) {
return error(m, {
line: l,
from: ch
}, a, b, c, d);
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
errorAt
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function addInternalSrc(elem, src) {
var i;
i = {
id: "(internal)",
elem: elem,
value: src
};
JSHINT.internals.push(i);
return i;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
addInternalSrc
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function addlabel(name, opts) {
opts = opts || {};
var type = opts.type;
var token = opts.token;
var islet = opts.islet;
// Define label in the current function in the current scope.
if (type === "exception") {
if (_.has(funct["(context)"], name)) {
if (funct[name] !== true && !state.option.node) {
warning("W002", state.tokens.next, name);
}
}
}
if (_.has(funct, name) && !funct["(global)"]) {
if (funct[name] === true) {
if (state.option.latedef) {
if ((state.option.latedef === true && _.contains([funct[name], type], "unction")) ||
!_.contains([funct[name], type], "unction")) {
warning("W003", state.tokens.next, name);
}
}
} else {
if ((!state.option.shadow || _.contains([ "inner", "outer" ], state.option.shadow)) &&
type !== "exception" || funct["(blockscope)"].getlabel(name)) {
warning("W004", state.tokens.next, name);
}
}
}
if (funct["(context)"] && _.has(funct["(context)"], name) && type !== "function") {
if (state.option.shadow === "outer") {
warning("W123", state.tokens.next, name);
}
}
// if the identifier is from a let, adds it only to the current blockscope
if (islet) {
funct["(blockscope)"].current.add(name, type, state.tokens.curr);
} else {
funct["(blockscope)"].shadow(name);
funct[name] = type;
if (token) {
funct["(tokens)"][name] = token;
}
setprop(funct, name, { unused: opts.unused || false });
if (funct["(global)"]) {
global[name] = funct;
if (_.has(implied, name)) {
if (state.option.latedef) {
if ((state.option.latedef === true && _.contains([funct[name], type], "unction")) ||
!_.contains([funct[name], type], "unction")) {
warning("W003", state.tokens.next, name);
}
}
delete implied[name];
}
} else {
scope[name] = funct;
}
}
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
addlabel
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function doOption() {
var nt = state.tokens.next;
var body = nt.body.split(",").map(function (s) { return s.trim(); });
var predef = {};
if (nt.type === "globals") {
body.forEach(function (g) {
g = g.split(":");
var key = (g[0] || "").trim();
var val = (g[1] || "").trim();
if (key.charAt(0) === "-") {
key = key.slice(1);
val = false;
JSHINT.blacklist[key] = key;
delete predefined[key];
} else {
predef[key] = (val === "true");
}
});
combine(predefined, predef);
for (var key in predef) {
if (_.has(predef, key)) {
declared[key] = nt;
}
}
}
if (nt.type === "exported") {
body.forEach(function (e) {
exported[e] = true;
});
}
if (nt.type === "members") {
membersOnly = membersOnly || {};
body.forEach(function (m) {
var ch1 = m.charAt(0);
var ch2 = m.charAt(m.length - 1);
if (ch1 === ch2 && (ch1 === "\"" || ch1 === "'")) {
m = m
.substr(1, m.length - 2)
.replace("\\\"", "\"");
}
membersOnly[m] = false;
});
}
var numvals = [
"maxstatements",
"maxparams",
"maxdepth",
"maxcomplexity",
"maxerr",
"maxlen",
"indent"
];
if (nt.type === "jshint" || nt.type === "jslint") {
body.forEach(function (g) {
g = g.split(":");
var key = (g[0] || "").trim();
var val = (g[1] || "").trim();
if (!checkOption(key, nt)) {
return;
}
if (numvals.indexOf(key) >= 0) {
// GH988 - numeric options can be disabled by setting them to `false`
if (val !== "false") {
val = +val;
if (typeof val !== "number" || !isFinite(val) || val <= 0 || Math.floor(val) !== val) {
error("E032", nt, g[1].trim());
return;
}
if (key === "indent") {
state.option["(explicitIndent)"] = true;
}
state.option[key] = val;
} else {
if (key === "indent") {
state.option["(explicitIndent)"] = false;
} else {
state.option[key] = false;
}
}
return;
}
if (key === "validthis") {
// `validthis` is valid only within a function scope.
if (funct["(global)"])
return void error("E009");
if (val !== "true" && val !== "false")
return void error("E002", nt);
state.option.validthis = (val === "true");
return;
}
if (key === "quotmark") {
switch (val) {
case "true":
case "false":
state.option.quotmark = (val === "true");
break;
case "double":
case "single":
state.option.quotmark = val;
break;
default:
error("E002", nt);
}
return;
}
if (key === "shadow") {
switch (val) {
case "true":
state.option.shadow = true;
break;
case "outer":
state.option.shadow = "outer";
break;
case "false":
case "inner":
state.option.shadow = "inner";
break;
default:
error("E002", nt);
}
return;
}
if (key === "unused") {
switch (val) {
case "true":
state.option.unused = true;
break;
case "false":
state.option.unused = false;
break;
case "vars":
case "strict":
state.option.unused = val;
break;
default:
error("E002", nt);
}
return;
}
if (key === "latedef") {
switch (val) {
case "true":
state.option.latedef = true;
break;
case "false":
state.option.latedef = false;
break;
case "nofunc":
state.option.latedef = "nofunc";
break;
default:
error("E002", nt);
}
return;
}
if (key === "ignore") {
switch (val) {
case "start":
state.ignoreLinterErrors = true;
break;
case "end":
state.ignoreLinterErrors = false;
break;
case "line":
// Any errors or warnings that happened on the current line, make them go away.
JSHINT.errors = _.reject(JSHINT.errors, function (error) {
// nt.line returns to the current line
return error.line === nt.line;
});
break;
default:
error("E002", nt);
}
return;
}
var match = /^([+-])(W\d{3})$/g.exec(key);
if (match) {
// ignore for -W..., unignore for +W...
state.ignored[match[2]] = (match[1] === "-");
return;
}
var tn;
if (val === "true" || val === "false") {
if (nt.type === "jslint") {
tn = renamedOptions[key] || key;
state.option[tn] = (val === "true");
if (invertedOptions[tn] !== undefined) {
state.option[tn] = !state.option[tn];
}
} else {
state.option[key] = (val === "true");
}
if (key === "newcap") {
state.option["(explicitNewcap)"] = true;
}
return;
}
error("E002", nt);
});
assume();
}
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
doOption
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function peek(p) {
var i = p || 0, j = 0, t;
while (j <= i) {
t = lookahead[j];
if (!t) {
t = lookahead[j] = lex.token();
}
j += 1;
}
return t;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
peek
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function advance(id, t) {
switch (state.tokens.curr.id) {
case "(number)":
if (state.tokens.next.id === ".") {
warning("W005", state.tokens.curr);
}
break;
case "-":
if (state.tokens.next.id === "-" || state.tokens.next.id === "--") {
warning("W006");
}
break;
case "+":
if (state.tokens.next.id === "+" || state.tokens.next.id === "++") {
warning("W007");
}
break;
}
if (state.tokens.curr.type === "(string)" || state.tokens.curr.identifier) {
anonname = state.tokens.curr.value;
}
if (id && state.tokens.next.id !== id) {
if (t) {
if (state.tokens.next.id === "(end)") {
error("E019", t, t.id);
} else {
error("E020", state.tokens.next, id, t.id, t.line, state.tokens.next.value);
}
} else if (state.tokens.next.type !== "(identifier)" || state.tokens.next.value !== id) {
warning("W116", state.tokens.next, id, state.tokens.next.value);
}
}
state.tokens.prev = state.tokens.curr;
state.tokens.curr = state.tokens.next;
for (;;) {
state.tokens.next = lookahead.shift() || lex.token();
if (!state.tokens.next) { // No more tokens left, give up
quit("E041", state.tokens.curr.line);
}
if (state.tokens.next.id === "(end)" || state.tokens.next.id === "(error)") {
return;
}
if (state.tokens.next.check) {
state.tokens.next.check();
}
if (state.tokens.next.isSpecial) {
doOption();
} else {
if (state.tokens.next.id !== "(endline)") {
break;
}
}
}
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
advance
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function isInfix(token) {
return token.infix || (!token.identifier && !!token.led);
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
isInfix
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function isEndOfExpr() {
var curr = state.tokens.curr;
var next = state.tokens.next;
if (next.id === ";" || next.id === "}" || next.id === ":") {
return true;
}
if (isInfix(next) === isInfix(curr) || (curr.id === "yield" && state.option.inMoz(true))) {
return curr.line !== next.line;
}
return false;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
isEndOfExpr
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function expression(rbp, initial) {
var left, isArray = false, isObject = false, isLetExpr = false;
// if current expression is a let expression
if (!initial && state.tokens.next.value === "let" && peek(0).value === "(") {
if (!state.option.inMoz(true)) {
warning("W118", state.tokens.next, "let expressions");
}
isLetExpr = true;
// create a new block scope we use only for the current expression
funct["(blockscope)"].stack();
advance("let");
advance("(");
state.syntax["let"].fud.call(state.syntax["let"].fud, false);
advance(")");
}
if (state.tokens.next.id === "(end)")
error("E006", state.tokens.curr);
advance();
if (initial) {
anonname = "anonymous";
funct["(verb)"] = state.tokens.curr.value;
}
if (initial === true && state.tokens.curr.fud) {
left = state.tokens.curr.fud();
} else {
if (state.tokens.curr.nud) {
left = state.tokens.curr.nud();
} else {
error("E030", state.tokens.curr, state.tokens.curr.id);
}
while (rbp < state.tokens.next.lbp && !isEndOfExpr()) {
isArray = state.tokens.curr.value === "Array";
isObject = state.tokens.curr.value === "Object";
// #527, new Foo.Array(), Foo.Array(), new Foo.Object(), Foo.Object()
// Line breaks in IfStatement heads exist to satisfy the checkJSHint
// "Line too long." error.
if (left && (left.value || (left.first && left.first.value))) {
// If the left.value is not "new", or the left.first.value is a "."
// then safely assume that this is not "new Array()" and possibly
// not "new Object()"...
if (left.value !== "new" ||
(left.first && left.first.value && left.first.value === ".")) {
isArray = false;
// ...In the case of Object, if the left.value and state.tokens.curr.value
// are not equal, then safely assume that this not "new Object()"
if (left.value !== state.tokens.curr.value) {
isObject = false;
}
}
}
advance();
if (isArray && state.tokens.curr.id === "(" && state.tokens.next.id === ")") {
warning("W009", state.tokens.curr);
}
if (isObject && state.tokens.curr.id === "(" && state.tokens.next.id === ")") {
warning("W010", state.tokens.curr);
}
if (left && state.tokens.curr.led) {
left = state.tokens.curr.led(left);
} else {
error("E033", state.tokens.curr, state.tokens.curr.id);
}
}
}
if (isLetExpr) {
funct["(blockscope)"].unstack();
}
return left;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
expression
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function adjacent(left, right) {
left = left || state.tokens.curr;
right = right || state.tokens.next;
if (state.option.white) {
if (left.character !== right.from && left.line === right.line) {
left.from += (left.character - left.from);
warning("W011", left, left.value);
}
}
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
adjacent
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function nobreak(left, right) {
left = left || state.tokens.curr;
right = right || state.tokens.next;
if (state.option.white && (left.character !== right.from || left.line !== right.line)) {
warning("W012", right, right.value);
}
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
nobreak
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function nospace(left, right) {
left = left || state.tokens.curr;
right = right || state.tokens.next;
if (state.option.white && !left.comment) {
if (left.line === right.line) {
adjacent(left, right);
}
}
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
nospace
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function nonadjacent(left, right) {
if (state.option.white) {
left = left || state.tokens.curr;
right = right || state.tokens.next;
if (left.value === ";" && right.value === ";") {
return;
}
if (left.line === right.line && left.character === right.from) {
left.from += (left.character - left.from);
warning("W013", left, left.value);
}
}
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
nonadjacent
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function nobreaknonadjacent(left, right) {
left = left || state.tokens.curr;
right = right || state.tokens.next;
if (!state.option.laxbreak && left.line !== right.line) {
warning("W014", right, right.value);
} else if (state.option.white) {
left = left || state.tokens.curr;
right = right || state.tokens.next;
if (left.character === right.from) {
left.from += (left.character - left.from);
warning("W013", left, left.value);
}
}
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
nobreaknonadjacent
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function indentation(bias) {
if (!state.option.white && !state.option["(explicitIndent)"]) {
return;
}
if (state.tokens.next.id === "(end)") {
return;
}
var i = indent + (bias || 0);
if (state.tokens.next.from !== i) {
warning("W015", state.tokens.next, state.tokens.next.value, i, state.tokens.next.from);
}
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
indentation
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function nolinebreak(t) {
t = t || state.tokens.curr;
if (t.line !== state.tokens.next.line) {
warning("E022", t, t.value);
}
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
nolinebreak
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function nobreakcomma(left, right) {
if (left.line !== right.line) {
if (!state.option.laxcomma) {
if (comma.first) {
warning("I001");
comma.first = false;
}
warning("W014", left, right.value);
}
} else if (!left.comment && left.character !== right.from && state.option.white) {
left.from += (left.character - left.from);
warning("W011", left, left.value);
}
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
nobreakcomma
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function comma(opts) {
opts = opts || {};
if (!opts.peek) {
nobreakcomma(state.tokens.curr, state.tokens.next);
advance(",");
} else {
nobreakcomma(state.tokens.prev, state.tokens.curr);
}
// TODO: This is a temporary solution to fight against false-positives in
// arrays and objects with trailing commas (see GH-363). The best solution
// would be to extract all whitespace rules out of parser.
if (state.tokens.next.value !== "]" && state.tokens.next.value !== "}") {
nonadjacent(state.tokens.curr, state.tokens.next);
}
if (state.tokens.next.identifier && !(opts.property && state.option.inES5())) {
// Keywords that cannot follow a comma operator.
switch (state.tokens.next.value) {
case "break":
case "case":
case "catch":
case "continue":
case "default":
case "do":
case "else":
case "finally":
case "for":
case "if":
case "in":
case "instanceof":
case "return":
case "switch":
case "throw":
case "try":
case "var":
case "let":
case "while":
case "with":
error("E024", state.tokens.next, state.tokens.next.value);
return false;
}
}
if (state.tokens.next.type === "(punctuator)") {
switch (state.tokens.next.value) {
case "}":
case "]":
case ",":
if (opts.allowTrailing) {
return true;
}
/* falls through */
case ")":
error("E024", state.tokens.next, state.tokens.next.value);
return false;
}
}
return true;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
comma
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function symbol(s, p) {
var x = state.syntax[s];
if (!x || typeof x !== "object") {
state.syntax[s] = x = {
id: s,
lbp: p,
value: s
};
}
return x;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
symbol
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function delim(s) {
return symbol(s, 0);
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
delim
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function stmt(s, f) {
var x = delim(s);
x.identifier = x.reserved = true;
x.fud = f;
return x;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
stmt
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function blockstmt(s, f) {
var x = stmt(s, f);
x.block = true;
return x;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
blockstmt
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function reserveName(x) {
var c = x.id.charAt(0);
if ((c >= "a" && c <= "z") || (c >= "A" && c <= "Z")) {
x.identifier = x.reserved = true;
}
return x;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
reserveName
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function prefix(s, f) {
var x = symbol(s, 150);
reserveName(x);
x.nud = (typeof f === "function") ? f : function () {
this.right = expression(150);
this.arity = "unary";
if (this.id === "++" || this.id === "--") {
if (state.option.plusplus) {
warning("W016", this, this.id);
} else if (this.right && (!this.right.identifier || isReserved(this.right)) &&
this.right.id !== "." && this.right.id !== "[") {
warning("W017", this);
}
}
return this;
};
return x;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
prefix
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function type(s, f) {
var x = delim(s);
x.type = s;
x.nud = f;
return x;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
type
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function reserve(name, func) {
var x = type(name, func);
x.identifier = true;
x.reserved = true;
return x;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
reserve
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function FutureReservedWord(name, meta) {
var x = type(name, (meta && meta.nud) || function () {
return this;
});
meta = meta || {};
meta.isFutureReservedWord = true;
x.value = name;
x.identifier = true;
x.reserved = true;
x.meta = meta;
return x;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
FutureReservedWord
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function reservevar(s, v) {
return reserve(s, function () {
if (typeof v === "function") {
v(this);
}
return this;
});
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
reservevar
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function infix(s, f, p, w) {
var x = symbol(s, p);
reserveName(x);
x.infix = true;
x.led = function (left) {
if (!w) {
nobreaknonadjacent(state.tokens.prev, state.tokens.curr);
nonadjacent(state.tokens.curr, state.tokens.next);
}
if (s === "in" && left.id === "!") {
warning("W018", left, "!");
}
if (typeof f === "function") {
return f(left, this);
} else {
this.left = left;
this.right = expression(p);
return this;
}
};
return x;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
infix
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function application(s) {
var x = symbol(s, 42);
x.led = function (left) {
if (!state.option.inESNext()) {
warning("W104", state.tokens.curr, "arrow function syntax (=>)");
}
nobreaknonadjacent(state.tokens.prev, state.tokens.curr);
nonadjacent(state.tokens.curr, state.tokens.next);
this.left = left;
this.right = doFunction(undefined, undefined, false, left);
return this;
};
return x;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
application
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function relation(s, f) {
var x = symbol(s, 100);
x.led = function (left) {
nobreaknonadjacent(state.tokens.prev, state.tokens.curr);
nonadjacent(state.tokens.curr, state.tokens.next);
var right = expression(100);
if (isIdentifier(left, "NaN") || isIdentifier(right, "NaN")) {
warning("W019", this);
} else if (f) {
f.apply(this, [left, right]);
}
if (!left || !right) {
quit("E041", state.tokens.curr.line);
}
if (left.id === "!") {
warning("W018", left, "!");
}
if (right.id === "!") {
warning("W018", right, "!");
}
this.left = left;
this.right = right;
return this;
};
return x;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
relation
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function isPoorRelation(node) {
return node &&
((node.type === "(number)" && +node.value === 0) ||
(node.type === "(string)" && node.value === "") ||
(node.type === "null" && !state.option.eqnull) ||
node.type === "true" ||
node.type === "false" ||
node.type === "undefined");
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
isPoorRelation
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function isTypoTypeof(left, right) {
if (state.option.notypeof)
return false;
if (!left || !right)
return false;
var values = [
"undefined", "object", "boolean", "number",
"string", "function", "xml", "object", "unknown"
];
if (right.type === "(identifier)" && right.value === "typeof" && left.type === "(string)")
return !_.contains(values, left.value);
return false;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
isTypoTypeof
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function findNativePrototype(left) {
var natives = [
"Array", "ArrayBuffer", "Boolean", "Collator", "DataView", "Date",
"DateTimeFormat", "Error", "EvalError", "Float32Array", "Float64Array",
"Function", "Infinity", "Intl", "Int16Array", "Int32Array", "Int8Array",
"Iterator", "Number", "NumberFormat", "Object", "RangeError",
"ReferenceError", "RegExp", "StopIteration", "String", "SyntaxError",
"TypeError", "Uint16Array", "Uint32Array", "Uint8Array", "Uint8ClampedArray",
"URIError"
];
function walkPrototype(obj) {
if (typeof obj !== "object") return;
return obj.right === "prototype" ? obj : walkPrototype(obj.left);
}
function walkNative(obj) {
while (!obj.identifier && typeof obj.left === "object")
obj = obj.left;
if (obj.identifier && natives.indexOf(obj.value) >= 0)
return obj.value;
}
var prototype = walkPrototype(left);
if (prototype) return walkNative(prototype);
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
findNativePrototype
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function walkPrototype(obj) {
if (typeof obj !== "object") return;
return obj.right === "prototype" ? obj : walkPrototype(obj.left);
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
walkPrototype
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function walkNative(obj) {
while (!obj.identifier && typeof obj.left === "object")
obj = obj.left;
if (obj.identifier && natives.indexOf(obj.value) >= 0)
return obj.value;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
walkNative
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function assignop(s, f, p) {
var x = infix(s, typeof f === "function" ? f : function (left, that) {
that.left = left;
if (left) {
if (state.option.freeze) {
var nativeObject = findNativePrototype(left);
if (nativeObject)
warning("W121", left, nativeObject);
}
if (predefined[left.value] === false &&
scope[left.value]["(global)"] === true) {
warning("W020", left);
} else if (left["function"]) {
warning("W021", left, left.value);
}
if (funct[left.value] === "const") {
error("E013", left, left.value);
}
if (left.id === ".") {
if (!left.left) {
warning("E031", that);
} else if (left.left.value === "arguments" && !state.directive["use strict"]) {
warning("E031", that);
}
that.right = expression(10);
return that;
} else if (left.id === "[") {
if (state.tokens.curr.left.first) {
state.tokens.curr.left.first.forEach(function (t) {
if (funct[t.value] === "const") {
error("E013", t, t.value);
}
});
} else if (!left.left) {
warning("E031", that);
} else if (left.left.value === "arguments" && !state.directive["use strict"]) {
warning("E031", that);
}
that.right = expression(10);
return that;
} else if (left.identifier && !isReserved(left)) {
if (funct[left.value] === "exception") {
warning("W022", left);
}
that.right = expression(10);
return that;
}
if (left === state.syntax["function"]) {
warning("W023", state.tokens.curr);
}
}
error("E031", that);
}, p);
x.exps = true;
x.assign = true;
return x;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
assignop
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function bitwise(s, f, p) {
var x = symbol(s, p);
reserveName(x);
x.led = (typeof f === "function") ? f : function (left) {
if (state.option.bitwise) {
warning("W016", this, this.id);
}
this.left = left;
this.right = expression(p);
return this;
};
return x;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
bitwise
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function bitwiseassignop(s) {
return assignop(s, function (left, that) {
if (state.option.bitwise) {
warning("W016", that, that.id);
}
nonadjacent(state.tokens.prev, state.tokens.curr);
nonadjacent(state.tokens.curr, state.tokens.next);
if (left) {
if (left.id === "." || left.id === "[" ||
(left.identifier && !isReserved(left))) {
expression(10);
return that;
}
if (left === state.syntax["function"]) {
warning("W023", state.tokens.curr);
}
return that;
}
error("E031", that);
}, 20);
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
bitwiseassignop
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function suffix(s) {
var x = symbol(s, 150);
x.led = function (left) {
if (state.option.plusplus) {
warning("W016", this, this.id);
} else if ((!left.identifier || isReserved(left)) && left.id !== "." && left.id !== "[") {
warning("W017", this);
}
this.left = left;
return this;
};
return x;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
suffix
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function optionalidentifier(fnparam, prop) {
if (!state.tokens.next.identifier) {
return;
}
advance();
var curr = state.tokens.curr;
var val = state.tokens.curr.value;
if (!isReserved(curr)) {
return val;
}
if (prop) {
if (state.option.inES5()) {
return val;
}
}
if (fnparam && val === "undefined") {
return val;
}
warning("W024", state.tokens.curr, state.tokens.curr.id);
return val;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
optionalidentifier
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function identifier(fnparam, prop) {
var i = optionalidentifier(fnparam, prop);
if (i) {
return i;
}
if (state.tokens.curr.id === "function" && state.tokens.next.id === "(") {
warning("W025");
} else {
error("E030", state.tokens.next, state.tokens.next.value);
}
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
identifier
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function reachable(s) {
var i = 0, t;
if (state.tokens.next.id !== ";" || noreach) {
return;
}
for (;;) {
do {
t = peek(i);
i += 1;
} while (t.id != "(end)" && t.id === "(comment)");
if (t.reach) {
return;
}
if (t.id !== "(endline)") {
if (t.id === "function") {
if (state.option.latedef === true) {
warning("W026", t);
}
break;
}
warning("W027", t, t.value, s);
break;
}
}
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
reachable
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function statement(noindent) {
var values;
var i = indent, r, s = scope, t = state.tokens.next;
if (t.id === ";") {
advance(";");
return;
}
// Is this a labelled statement?
var res = isReserved(t);
// We're being more tolerant here: if someone uses
// a FutureReservedWord as a label, we warn but proceed
// anyway.
if (res && t.meta && t.meta.isFutureReservedWord && peek().id === ":") {
warning("W024", t, t.id);
res = false;
}
// detect a destructuring assignment
if (_.has(["[", "{"], t.value)) {
if (lookupBlockType().isDestAssign) {
if (!state.option.inESNext()) {
warning("W104", state.tokens.curr, "destructuring expression");
}
values = destructuringExpression();
values.forEach(function (tok) {
isundef(funct, "W117", tok.token, tok.id);
});
advance("=");
destructuringExpressionMatch(values, expression(10, true));
advance(";");
return;
}
}
if (t.identifier && !res && peek().id === ":") {
advance();
advance(":");
scope = Object.create(s);
addlabel(t.value, { type: "label" });
if (!state.tokens.next.labelled && state.tokens.next.value !== "{") {
warning("W028", state.tokens.next, t.value, state.tokens.next.value);
}
state.tokens.next.label = t.value;
t = state.tokens.next;
}
// Is it a lonely block?
if (t.id === "{") {
// Is it a switch case block?
//
// switch (foo) {
// case bar: { <= here.
// ...
// }
// }
var iscase = (funct["(verb)"] === "case" && state.tokens.curr.value === ":");
block(true, true, false, false, iscase);
return;
}
// Parse the statement.
if (!noindent) {
indentation();
}
r = expression(0, true);
if (r && (!r.identifier || r.value !== "function") && (r.type !== "(punctuator)")) {
if (!state.directive["use strict"] &&
state.option.globalstrict &&
state.option.strict) {
warning("E007");
}
}
// Look for the final semicolon.
if (!t.block) {
if (!state.option.expr && (!r || !r.exps)) {
warning("W030", state.tokens.curr);
} else if (state.option.nonew && r && r.left && r.id === "(" && r.left.id === "new") {
warning("W031", t);
}
if (state.tokens.next.id !== ";") {
if (!state.option.asi) {
// If this is the last statement in a block that ends on
// the same line *and* option lastsemic is on, ignore the warning.
// Otherwise, complain about missing semicolon.
if (!state.option.lastsemic || state.tokens.next.id !== "}" ||
state.tokens.next.line !== state.tokens.curr.line) {
warningAt("W033", state.tokens.curr.line, state.tokens.curr.character);
}
}
} else {
adjacent(state.tokens.curr, state.tokens.next);
advance(";");
nonadjacent(state.tokens.curr, state.tokens.next);
}
}
// Restore the indentation.
indent = i;
scope = s;
return r;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
statement
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function statements(startLine) {
var a = [], p;
while (!state.tokens.next.reach && state.tokens.next.id !== "(end)") {
if (state.tokens.next.id === ";") {
p = peek();
if (!p || (p.id !== "(" && p.id !== "[")) {
warning("W032");
}
advance(";");
} else {
a.push(statement(startLine === state.tokens.next.line));
}
}
return a;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
statements
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function directives() {
var i, p, pn;
for (;;) {
if (state.tokens.next.id === "(string)") {
p = peek(0);
if (p.id === "(endline)") {
i = 1;
do {
pn = peek(i);
i = i + 1;
} while (pn.id === "(endline)");
if (pn.id !== ";") {
if (pn.id !== "(string)" && pn.id !== "(number)" &&
pn.id !== "(regexp)" && pn.identifier !== true &&
pn.id !== "}") {
break;
}
warning("W033", state.tokens.next);
} else {
p = pn;
}
} else if (p.id === "}") {
// Directive with no other statements, warn about missing semicolon
warning("W033", p);
} else if (p.id !== ";") {
break;
}
indentation();
advance();
if (state.directive[state.tokens.curr.value]) {
warning("W034", state.tokens.curr, state.tokens.curr.value);
}
if (state.tokens.curr.value === "use strict") {
if (!state.option["(explicitNewcap)"])
state.option.newcap = true;
state.option.undef = true;
}
// there's no directive negation, so always set to true
state.directive[state.tokens.curr.value] = true;
if (p.id === ";") {
advance(";");
}
continue;
}
break;
}
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
directives
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function block(ordinary, stmt, isfunc, isfatarrow, iscase) {
var a,
b = inblock,
old_indent = indent,
m,
s = scope,
t,
line,
d;
inblock = ordinary;
if (!ordinary || !state.option.funcscope)
scope = Object.create(scope);
nonadjacent(state.tokens.curr, state.tokens.next);
t = state.tokens.next;
var metrics = funct["(metrics)"];
metrics.nestedBlockDepth += 1;
metrics.verifyMaxNestedBlockDepthPerFunction();
if (state.tokens.next.id === "{") {
advance("{");
// create a new block scope
funct["(blockscope)"].stack();
line = state.tokens.curr.line;
if (state.tokens.next.id !== "}") {
indent += state.option.indent;
while (!ordinary && state.tokens.next.from > indent) {
indent += state.option.indent;
}
if (isfunc) {
m = {};
for (d in state.directive) {
if (_.has(state.directive, d)) {
m[d] = state.directive[d];
}
}
directives();
if (state.option.strict && funct["(context)"]["(global)"]) {
if (!m["use strict"] && !state.directive["use strict"]) {
warning("E007");
}
}
}
a = statements(line);
metrics.statementCount += a.length;
if (isfunc) {
state.directive = m;
}
indent -= state.option.indent;
if (line !== state.tokens.next.line) {
indentation();
}
} else if (line !== state.tokens.next.line) {
indentation();
}
advance("}", t);
funct["(blockscope)"].unstack();
indent = old_indent;
} else if (!ordinary) {
if (isfunc) {
m = {};
if (stmt && !isfatarrow && !state.option.inMoz(true)) {
error("W118", state.tokens.curr, "function closure expressions");
}
if (!stmt) {
for (d in state.directive) {
if (_.has(state.directive, d)) {
m[d] = state.directive[d];
}
}
}
expression(10);
if (state.option.strict && funct["(context)"]["(global)"]) {
if (!m["use strict"] && !state.directive["use strict"]) {
warning("E007");
}
}
} else {
error("E021", state.tokens.next, "{", state.tokens.next.value);
}
} else {
// check to avoid let declaration not within a block
funct["(nolet)"] = true;
if (!stmt || state.option.curly) {
warning("W116", state.tokens.next, "{", state.tokens.next.value);
}
noreach = true;
indent += state.option.indent;
// test indentation only if statement is in new line
a = [statement(state.tokens.next.line === state.tokens.curr.line)];
indent -= state.option.indent;
noreach = false;
delete funct["(nolet)"];
}
// Don't clear and let it propagate out if it is "break", "return", or "throw" in switch case
if (!(iscase && ["break", "return", "throw"].indexOf(funct["(verb)"]) != -1)) {
funct["(verb)"] = null;
}
if (!ordinary || !state.option.funcscope) scope = s;
inblock = b;
if (ordinary && state.option.noempty && (!a || a.length === 0)) {
warning("W035");
}
metrics.nestedBlockDepth -= 1;
return a;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
block
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function countMember(m) {
if (membersOnly && typeof membersOnly[m] !== "boolean") {
warning("W036", state.tokens.curr, m);
}
if (typeof member[m] === "number") {
member[m] += 1;
} else {
member[m] = 1;
}
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
countMember
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function note_implied(tkn) {
var name = tkn.value;
var desc = Object.getOwnPropertyDescriptor(implied, name);
if (!desc)
implied[name] = [tkn.line];
else
desc.value.push(tkn.line);
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
note_implied
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function comprehensiveArrayExpression() {
var res = {};
res.exps = true;
funct["(comparray)"].stack();
// Handle reversed for expressions, used in spidermonkey
var reversed = false;
if (state.tokens.next.value !== "for") {
reversed = true;
if (!state.option.inMoz(true)) {
warning("W116", state.tokens.next, "for", state.tokens.next.value);
}
funct["(comparray)"].setState("use");
res.right = expression(10);
}
advance("for");
if (state.tokens.next.value === "each") {
advance("each");
if (!state.option.inMoz(true)) {
warning("W118", state.tokens.curr, "for each");
}
}
advance("(");
funct["(comparray)"].setState("define");
res.left = expression(130);
if (_.contains(["in", "of"], state.tokens.next.value)) {
advance();
} else {
error("E045", state.tokens.curr);
}
funct["(comparray)"].setState("generate");
expression(10);
advance(")");
if (state.tokens.next.value === "if") {
advance("if");
advance("(");
funct["(comparray)"].setState("filter");
res.filter = expression(10);
advance(")");
}
if (!reversed) {
funct["(comparray)"].setState("use");
res.right = expression(10);
}
advance("]");
funct["(comparray)"].unstack();
return res;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
comprehensiveArrayExpression
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function property_name() {
var id = optionalidentifier(false, true);
if (!id) {
if (state.tokens.next.id === "(string)") {
id = state.tokens.next.value;
advance();
} else if (state.tokens.next.id === "(number)") {
id = state.tokens.next.value.toString();
advance();
}
}
if (id === "hasOwnProperty") {
warning("W001");
}
return id;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
property_name
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function functionparams(parsed) {
var curr, next;
var params = [];
var ident;
var tokens = [];
var t;
var pastDefault = false;
if (parsed) {
if (Array.isArray(parsed)) {
for (var i in parsed) {
curr = parsed[i];
if (curr.value === "...") {
if (!state.option.inESNext()) {
warning("W104", curr, "spread/rest operator");
}
continue;
} else if (curr.value !== ",") {
params.push(curr.value);
addlabel(curr.value, { type: "unused", token: curr });
}
}
return params;
} else {
if (parsed.identifier === true) {
addlabel(parsed.value, { type: "unused", token: parsed });
return [parsed];
}
}
}
next = state.tokens.next;
advance("(");
nospace();
if (state.tokens.next.id === ")") {
advance(")");
return;
}
for (;;) {
if (_.contains(["{", "["], state.tokens.next.id)) {
tokens = destructuringExpression();
for (t in tokens) {
t = tokens[t];
if (t.id) {
params.push(t.id);
addlabel(t.id, { type: "unused", token: t.token });
}
}
} else if (state.tokens.next.value === "...") {
if (!state.option.inESNext()) {
warning("W104", state.tokens.next, "spread/rest operator");
}
advance("...");
nospace();
ident = identifier(true);
params.push(ident);
addlabel(ident, { type: "unused", token: state.tokens.curr });
} else {
ident = identifier(true);
params.push(ident);
addlabel(ident, { type: "unused", token: state.tokens.curr });
}
// it is a syntax error to have a regular argument after a default argument
if (pastDefault) {
if (state.tokens.next.id !== "=") {
error("E051", state.tokens.current);
}
}
if (state.tokens.next.id === "=") {
if (!state.option.inESNext()) {
warning("W119", state.tokens.next, "default parameters");
}
advance("=");
pastDefault = true;
expression(10);
}
if (state.tokens.next.id === ",") {
comma();
} else {
advance(")", next);
nospace(state.tokens.prev, state.tokens.curr);
return params;
}
}
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
functionparams
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function setprop(funct, name, values) {
if (!funct["(properties)"][name]) {
funct["(properties)"][name] = { unused: false };
}
_.extend(funct["(properties)"][name], values);
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
setprop
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function getprop(funct, name, prop) {
if (!funct["(properties)"][name])
return null;
return funct["(properties)"][name][prop] || null;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
getprop
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function functor(name, token, scope, overwrites) {
var funct = {
"(name)" : name,
"(breakage)" : 0,
"(loopage)" : 0,
"(scope)" : scope,
"(tokens)" : {},
"(properties)": {},
"(catch)" : false,
"(global)" : false,
"(line)" : null,
"(character)" : null,
"(metrics)" : null,
"(statement)" : null,
"(context)" : null,
"(blockscope)": null,
"(comparray)" : null,
"(generator)" : null,
"(params)" : null
};
if (token) {
_.extend(funct, {
"(line)" : token.line,
"(character)": token.character,
"(metrics)" : createMetrics(token)
});
}
_.extend(funct, overwrites);
if (funct["(context)"]) {
funct["(blockscope)"] = funct["(context)"]["(blockscope)"];
funct["(comparray)"] = funct["(context)"]["(comparray)"];
}
return funct;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
functor
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function doFunction(name, statement, generator, fatarrowparams) {
var f;
var oldOption = state.option;
var oldIgnored = state.ignored;
var oldScope = scope;
state.option = Object.create(state.option);
state.ignored = Object.create(state.ignored);
scope = Object.create(scope);
funct = functor(name || "\"" + anonname + "\"", state.tokens.next, scope, {
"(statement)": statement,
"(context)": funct,
"(generator)": generator ? true : null
});
f = funct;
state.tokens.curr.funct = funct;
functions.push(funct);
if (name) {
addlabel(name, { type: "function" });
}
funct["(params)"] = functionparams(fatarrowparams);
funct["(metrics)"].verifyMaxParametersPerFunction(funct["(params)"]);
// So we parse fat-arrow functions after we encounter =>. So basically
// doFunction is called with the left side of => as its last argument.
// This means that the parser, at that point, had already added its
// arguments to the undefs array and here we undo that.
JSHINT.undefs = _.filter(JSHINT.undefs, function (item) {
return !_.contains(_.union(fatarrowparams), item[2]);
});
block(false, true, true, fatarrowparams ? true : false);
if (!state.option.noyield && generator && funct["(generator)"] !== "yielded") {
warning("W124", state.tokens.curr);
}
funct["(metrics)"].verifyMaxStatementsPerFunction();
funct["(metrics)"].verifyMaxComplexityPerFunction();
funct["(unusedOption)"] = state.option.unused;
scope = oldScope;
state.option = oldOption;
state.ignored = oldIgnored;
funct["(last)"] = state.tokens.curr.line;
funct["(lastcharacter)"] = state.tokens.curr.character;
_.map(Object.keys(funct), function (key) {
if (key[0] === "(") return;
funct["(blockscope)"].unshadow(key);
});
funct = funct["(context)"];
return f;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
doFunction
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function createMetrics(functionStartToken) {
return {
statementCount: 0,
nestedBlockDepth: -1,
ComplexityCount: 1,
verifyMaxStatementsPerFunction: function () {
if (state.option.maxstatements &&
this.statementCount > state.option.maxstatements) {
warning("W071", functionStartToken, this.statementCount);
}
},
verifyMaxParametersPerFunction: function (params) {
params = params || [];
if (state.option.maxparams && params.length > state.option.maxparams) {
warning("W072", functionStartToken, params.length);
}
},
verifyMaxNestedBlockDepthPerFunction: function () {
if (state.option.maxdepth &&
this.nestedBlockDepth > 0 &&
this.nestedBlockDepth === state.option.maxdepth + 1) {
warning("W073", null, this.nestedBlockDepth);
}
},
verifyMaxComplexityPerFunction: function () {
var max = state.option.maxcomplexity;
var cc = this.ComplexityCount;
if (max && cc > max) {
warning("W074", functionStartToken, cc);
}
}
};
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
createMetrics
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function increaseComplexityCount() {
funct["(metrics)"].ComplexityCount += 1;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
increaseComplexityCount
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function checkCondAssignment(expr) {
var id, paren;
if (expr) {
id = expr.id;
paren = expr.paren;
if (id === "," && (expr = expr.exprs[expr.exprs.length - 1])) {
id = expr.id;
paren = paren || expr.paren;
}
}
switch (id) {
case "=":
case "+=":
case "-=":
case "*=":
case "%=":
case "&=":
case "|=":
case "^=":
case "/=":
if (!paren && !state.option.boss) {
warning("W084");
}
}
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
checkCondAssignment
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function saveProperty(name, tkn) {
if (props[name] && _.has(props, name))
warning("W075", state.tokens.next, i);
else
props[name] = {};
props[name].basic = true;
props[name].basictkn = tkn;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
saveProperty
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function saveSetter(name, tkn) {
if (props[name] && _.has(props, name)) {
if (props[name].basic || props[name].setter)
warning("W075", state.tokens.next, i);
} else {
props[name] = {};
}
props[name].setter = true;
props[name].setterToken = tkn;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
saveSetter
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function saveGetter(name) {
if (props[name] && _.has(props, name)) {
if (props[name].basic || props[name].getter)
warning("W075", state.tokens.next, i);
} else {
props[name] = {};
}
props[name].getter = true;
props[name].getterToken = state.tokens.curr;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
saveGetter
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function destructuringExpression() {
var id, ids;
var identifiers = [];
if (!state.option.inESNext()) {
warning("W104", state.tokens.curr, "destructuring expression");
}
var nextInnerDE = function () {
var ident;
if (_.contains(["[", "{"], state.tokens.next.value)) {
ids = destructuringExpression();
for (var id in ids) {
id = ids[id];
identifiers.push({ id: id.id, token: id.token });
}
} else if (state.tokens.next.value === ",") {
identifiers.push({ id: null, token: state.tokens.curr });
} else if (state.tokens.next.value === "(") {
advance("(");
nextInnerDE();
advance(")");
} else {
ident = identifier();
if (ident)
identifiers.push({ id: ident, token: state.tokens.curr });
}
};
if (state.tokens.next.value === "[") {
advance("[");
nextInnerDE();
while (state.tokens.next.value !== "]") {
advance(",");
nextInnerDE();
}
advance("]");
} else if (state.tokens.next.value === "{") {
advance("{");
id = identifier();
if (state.tokens.next.value === ":") {
advance(":");
nextInnerDE();
} else {
identifiers.push({ id: id, token: state.tokens.curr });
}
while (state.tokens.next.value !== "}") {
advance(",");
id = identifier();
if (state.tokens.next.value === ":") {
advance(":");
nextInnerDE();
} else {
identifiers.push({ id: id, token: state.tokens.curr });
}
}
advance("}");
}
return identifiers;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
destructuringExpression
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
nextInnerDE = function () {
var ident;
if (_.contains(["[", "{"], state.tokens.next.value)) {
ids = destructuringExpression();
for (var id in ids) {
id = ids[id];
identifiers.push({ id: id.id, token: id.token });
}
} else if (state.tokens.next.value === ",") {
identifiers.push({ id: null, token: state.tokens.curr });
} else if (state.tokens.next.value === "(") {
advance("(");
nextInnerDE();
advance(")");
} else {
ident = identifier();
if (ident)
identifiers.push({ id: ident, token: state.tokens.curr });
}
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
nextInnerDE
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function destructuringExpressionMatch(tokens, value) {
var first = value.first;
if (!first)
return;
_.zip(tokens, Array.isArray(first) ? first : [ first ]).forEach(function (val) {
var token = val[0];
var value = val[1];
if (token && value)
token.first = value;
else if (token && token.first && !value)
warning("W080", token.first, token.first.value);
});
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
destructuringExpressionMatch
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function classdef(stmt) {
/*jshint validthis:true */
if (!state.option.inESNext()) {
warning("W104", state.tokens.curr, "class");
}
if (stmt) {
// BindingIdentifier
this.name = identifier();
addlabel(this.name, { type: "unused", token: state.tokens.curr });
} else if (state.tokens.next.identifier && state.tokens.next.value !== "extends") {
// BindingIdentifier(opt)
this.name = identifier();
}
classtail(this);
return this;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
classdef
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function classtail(c) {
var strictness = state.directive["use strict"];
// ClassHeritage(opt)
if (state.tokens.next.value === "extends") {
advance("extends");
c.heritage = expression(10);
}
// A ClassBody is always strict code.
state.directive["use strict"] = true;
advance("{");
// ClassBody(opt)
c.body = state.syntax["{"].nud(true);
state.directive["use strict"] = strictness;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
classtail
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function doCatch() {
var oldScope = scope;
var e;
advance("catch");
nonadjacent(state.tokens.curr, state.tokens.next);
advance("(");
scope = Object.create(oldScope);
e = state.tokens.next.value;
if (state.tokens.next.type !== "(identifier)") {
e = null;
warning("E030", state.tokens.next, e);
}
advance();
funct = functor("(catch)", state.tokens.next, scope, {
"(context)" : funct,
"(breakage)" : funct["(breakage)"],
"(loopage)" : funct["(loopage)"],
"(statement)": false,
"(catch)" : true
});
if (e) {
addlabel(e, { type: "exception" });
}
if (state.tokens.next.value === "if") {
if (!state.option.inMoz(true)) {
warning("W118", state.tokens.curr, "catch filter");
}
advance("if");
expression(0);
}
advance(")");
state.tokens.curr.funct = funct;
functions.push(funct);
block(false);
scope = oldScope;
funct["(last)"] = state.tokens.curr.line;
funct["(lastcharacter)"] = state.tokens.curr.character;
funct = funct["(context)"];
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
doCatch
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
lookupBlockType = function () {
var pn, pn1;
var i = -1;
var bracketStack = 0;
var ret = {};
if (_.contains(["[", "{"], state.tokens.curr.value))
bracketStack += 1;
do {
pn = (i === -1) ? state.tokens.next : peek(i);
pn1 = peek(i + 1);
i = i + 1;
if (_.contains(["[", "{"], pn.value)) {
bracketStack += 1;
} else if (_.contains(["]", "}"], pn.value)) {
bracketStack -= 1;
}
if (pn.identifier && pn.value === "for" && bracketStack === 1) {
ret.isCompArray = true;
ret.notJson = true;
break;
}
if (_.contains(["}", "]"], pn.value) && pn1.value === "=" && bracketStack === 0) {
ret.isDestAssign = true;
ret.notJson = true;
break;
}
if (pn.value === ";") {
ret.isBlock = true;
ret.notJson = true;
}
} while (bracketStack > 0 && pn.id !== "(end)" && i < 15);
return ret;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
lookupBlockType
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function destructuringAssignOrJsonValue() {
// lookup for the assignment (esnext only)
// if it has semicolons, it is a block, so go parse it as a block
// or it's not a block, but there are assignments, check for undeclared variables
var block = lookupBlockType();
if (block.notJson) {
if (!state.option.inESNext() && block.isDestAssign) {
warning("W104", state.tokens.curr, "destructuring assignment");
}
statements();
// otherwise parse json value
} else {
state.option.laxbreak = true;
state.jsonMode = true;
jsonValue();
}
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
destructuringAssignOrJsonValue
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
arrayComprehension = function () {
var CompArray = function () {
this.mode = "use";
this.variables = [];
};
var _carrays = [];
var _current;
function declare(v) {
var l = _current.variables.filter(function (elt) {
// if it has, change its undef state
if (elt.value === v) {
elt.undef = false;
return v;
}
}).length;
return l !== 0;
}
function use(v) {
var l = _current.variables.filter(function (elt) {
// and if it has been defined
if (elt.value === v && !elt.undef) {
if (elt.unused === true) {
elt.unused = false;
}
return v;
}
}).length;
// otherwise we warn about it
return (l === 0);
}
return {stack: function () {
_current = new CompArray();
_carrays.push(_current);
},
unstack: function () {
_current.variables.filter(function (v) {
if (v.unused)
warning("W098", v.token, v.value);
if (v.undef)
isundef(v.funct, "W117", v.token, v.value);
});
_carrays.splice(-1, 1);
_current = _carrays[_carrays.length - 1];
},
setState: function (s) {
if (_.contains(["use", "define", "generate", "filter"], s))
_current.mode = s;
},
check: function (v) {
if (!_current) {
return;
}
// When we are in "use" state of the list comp, we enqueue that var
if (_current && _current.mode === "use") {
if (use(v)) {
_current.variables.push({
funct: funct,
token: state.tokens.curr,
value: v,
undef: true,
unused: false
});
}
return true;
// When we are in "define" state of the list comp,
} else if (_current && _current.mode === "define") {
// check if the variable has been used previously
if (!declare(v)) {
_current.variables.push({
funct: funct,
token: state.tokens.curr,
value: v,
undef: false,
unused: true
});
}
return true;
// When we are in the "generate" state of the list comp,
} else if (_current && _current.mode === "generate") {
isundef(funct, "W117", state.tokens.curr, v);
return true;
// When we are in "filter" state,
} else if (_current && _current.mode === "filter") {
// we check whether current variable has been declared
if (use(v)) {
// if not we warn about it
isundef(funct, "W117", state.tokens.curr, v);
}
return true;
}
return false;
}
};
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
arrayComprehension
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
CompArray = function () {
this.mode = "use";
this.variables = [];
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
CompArray
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function declare(v) {
var l = _current.variables.filter(function (elt) {
// if it has, change its undef state
if (elt.value === v) {
elt.undef = false;
return v;
}
}).length;
return l !== 0;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
declare
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function use(v) {
var l = _current.variables.filter(function (elt) {
// and if it has been defined
if (elt.value === v && !elt.undef) {
if (elt.unused === true) {
elt.unused = false;
}
return v;
}
}).length;
// otherwise we warn about it
return (l === 0);
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
use
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function jsonValue() {
function jsonObject() {
var o = {}, t = state.tokens.next;
advance("{");
if (state.tokens.next.id !== "}") {
for (;;) {
if (state.tokens.next.id === "(end)") {
error("E026", state.tokens.next, t.line);
} else if (state.tokens.next.id === "}") {
warning("W094", state.tokens.curr);
break;
} else if (state.tokens.next.id === ",") {
error("E028", state.tokens.next);
} else if (state.tokens.next.id !== "(string)") {
warning("W095", state.tokens.next, state.tokens.next.value);
}
if (o[state.tokens.next.value] === true) {
warning("W075", state.tokens.next, state.tokens.next.value);
} else if ((state.tokens.next.value === "__proto__" &&
!state.option.proto) || (state.tokens.next.value === "__iterator__" &&
!state.option.iterator)) {
warning("W096", state.tokens.next, state.tokens.next.value);
} else {
o[state.tokens.next.value] = true;
}
advance();
advance(":");
jsonValue();
if (state.tokens.next.id !== ",") {
break;
}
advance(",");
}
}
advance("}");
}
function jsonArray() {
var t = state.tokens.next;
advance("[");
if (state.tokens.next.id !== "]") {
for (;;) {
if (state.tokens.next.id === "(end)") {
error("E027", state.tokens.next, t.line);
} else if (state.tokens.next.id === "]") {
warning("W094", state.tokens.curr);
break;
} else if (state.tokens.next.id === ",") {
error("E028", state.tokens.next);
}
jsonValue();
if (state.tokens.next.id !== ",") {
break;
}
advance(",");
}
}
advance("]");
}
switch (state.tokens.next.id) {
case "{":
jsonObject();
break;
case "[":
jsonArray();
break;
case "true":
case "false":
case "null":
case "(number)":
case "(string)":
advance();
break;
case "-":
advance("-");
if (state.tokens.curr.character !== state.tokens.next.from) {
warning("W011", state.tokens.curr);
}
adjacent(state.tokens.curr, state.tokens.next);
advance("(number)");
break;
default:
error("E003", state.tokens.next);
}
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
jsonValue
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function jsonObject() {
var o = {}, t = state.tokens.next;
advance("{");
if (state.tokens.next.id !== "}") {
for (;;) {
if (state.tokens.next.id === "(end)") {
error("E026", state.tokens.next, t.line);
} else if (state.tokens.next.id === "}") {
warning("W094", state.tokens.curr);
break;
} else if (state.tokens.next.id === ",") {
error("E028", state.tokens.next);
} else if (state.tokens.next.id !== "(string)") {
warning("W095", state.tokens.next, state.tokens.next.value);
}
if (o[state.tokens.next.value] === true) {
warning("W075", state.tokens.next, state.tokens.next.value);
} else if ((state.tokens.next.value === "__proto__" &&
!state.option.proto) || (state.tokens.next.value === "__iterator__" &&
!state.option.iterator)) {
warning("W096", state.tokens.next, state.tokens.next.value);
} else {
o[state.tokens.next.value] = true;
}
advance();
advance(":");
jsonValue();
if (state.tokens.next.id !== ",") {
break;
}
advance(",");
}
}
advance("}");
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
jsonObject
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function jsonArray() {
var t = state.tokens.next;
advance("[");
if (state.tokens.next.id !== "]") {
for (;;) {
if (state.tokens.next.id === "(end)") {
error("E027", state.tokens.next, t.line);
} else if (state.tokens.next.id === "]") {
warning("W094", state.tokens.curr);
break;
} else if (state.tokens.next.id === ",") {
error("E028", state.tokens.next);
}
jsonValue();
if (state.tokens.next.id !== ",") {
break;
}
advance(",");
}
}
advance("]");
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
jsonArray
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
blockScope = function () {
var _current = {};
var _variables = [_current];
function _checkBlockLabels() {
for (var t in _current) {
if (_current[t]["(type)"] === "unused") {
if (state.option.unused) {
var tkn = _current[t]["(token)"];
var line = tkn.line;
var chr = tkn.character;
warningAt("W098", line, chr, t);
}
}
}
}
return {
stack: function () {
_current = {};
_variables.push(_current);
},
unstack: function () {
_checkBlockLabels();
_variables.splice(_variables.length - 1, 1);
_current = _.last(_variables);
},
getlabel: function (l) {
for (var i = _variables.length - 1 ; i >= 0; --i) {
if (_.has(_variables[i], l) && !_variables[i][l]["(shadowed)"]) {
return _variables[i];
}
}
},
shadow: function (name) {
for (var i = _variables.length - 1; i >= 0; i--) {
if (_.has(_variables[i], name)) {
_variables[i][name]["(shadowed)"] = true;
}
}
},
unshadow: function (name) {
for (var i = _variables.length - 1; i >= 0; i--) {
if (_.has(_variables[i], name)) {
_variables[i][name]["(shadowed)"] = false;
}
}
},
current: {
has: function (t) {
return _.has(_current, t);
},
add: function (t, type, tok) {
_current[t] = { "(type)" : type, "(token)": tok, "(shadowed)": false };
}
}
};
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
blockScope
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function _checkBlockLabels() {
for (var t in _current) {
if (_current[t]["(type)"] === "unused") {
if (state.option.unused) {
var tkn = _current[t]["(token)"];
var line = tkn.line;
var chr = tkn.character;
warningAt("W098", line, chr, t);
}
}
}
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
_checkBlockLabels
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
itself = function (s, o, g) {
var i, k, x;
var optionKeys;
var newOptionObj = {};
var newIgnoredObj = {};
o = _.clone(o);
state.reset();
if (o && o.scope) {
JSHINT.scope = o.scope;
} else {
JSHINT.errors = [];
JSHINT.undefs = [];
JSHINT.internals = [];
JSHINT.blacklist = {};
JSHINT.scope = "(main)";
}
predefined = Object.create(null);
combine(predefined, vars.ecmaIdentifiers);
combine(predefined, vars.reservedVars);
combine(predefined, g || {});
declared = Object.create(null);
exported = Object.create(null);
function each(obj, cb) {
if (!obj)
return;
if (!Array.isArray(obj) && typeof obj === "object")
obj = Object.keys(obj);
obj.forEach(cb);
}
if (o) {
each(o.predef || null, function (item) {
var slice, prop;
if (item[0] === "-") {
slice = item.slice(1);
JSHINT.blacklist[slice] = slice;
} else {
prop = Object.getOwnPropertyDescriptor(o.predef, item);
predefined[item] = prop ? prop.value : false;
}
});
each(o.exported || null, function (item) {
exported[item] = true;
});
delete o.predef;
delete o.exported;
optionKeys = Object.keys(o);
for (x = 0; x < optionKeys.length; x++) {
if (/^-W\d{3}$/g.test(optionKeys[x])) {
newIgnoredObj[optionKeys[x].slice(1)] = true;
} else {
newOptionObj[optionKeys[x]] = o[optionKeys[x]];
if (optionKeys[x] === "newcap" && o[optionKeys[x]] === false)
newOptionObj["(explicitNewcap)"] = true;
if (optionKeys[x] === "indent")
newOptionObj["(explicitIndent)"] = o[optionKeys[x]] === false ? false : true;
}
}
}
state.option = newOptionObj;
state.ignored = newIgnoredObj;
state.option.indent = state.option.indent || 4;
state.option.maxerr = state.option.maxerr || 50;
indent = 1;
global = Object.create(predefined);
scope = global;
funct = functor("(global)", null, scope, {
"(global)" : true,
"(blockscope)": blockScope(),
"(comparray)" : arrayComprehension(),
"(metrics)" : createMetrics(state.tokens.next)
});
functions = [funct];
urls = [];
stack = null;
member = {};
membersOnly = null;
implied = {};
inblock = false;
lookahead = [];
warnings = 0;
unuseds = [];
if (!isString(s) && !Array.isArray(s)) {
errorAt("E004", 0);
return false;
}
api = {
get isJSON() {
return state.jsonMode;
},
getOption: function (name) {
return state.option[name] || null;
},
getCache: function (name) {
return state.cache[name];
},
setCache: function (name, value) {
state.cache[name] = value;
},
warn: function (code, data) {
warningAt.apply(null, [ code, data.line, data.char ].concat(data.data));
},
on: function (names, listener) {
names.split(" ").forEach(function (name) {
emitter.on(name, listener);
}.bind(this));
}
};
emitter.removeAllListeners();
(extraModules || []).forEach(function (func) {
func(api);
});
state.tokens.prev = state.tokens.curr = state.tokens.next = state.syntax["(begin)"];
lex = new Lexer(s);
lex.on("warning", function (ev) {
warningAt.apply(null, [ ev.code, ev.line, ev.character].concat(ev.data));
});
lex.on("error", function (ev) {
errorAt.apply(null, [ ev.code, ev.line, ev.character ].concat(ev.data));
});
lex.on("fatal", function (ev) {
quit("E041", ev.line, ev.from);
});
lex.on("Identifier", function (ev) {
emitter.emit("Identifier", ev);
});
lex.on("String", function (ev) {
emitter.emit("String", ev);
});
lex.on("Number", function (ev) {
emitter.emit("Number", ev);
});
lex.start();
// Check options
for (var name in o) {
if (_.has(o, name)) {
checkOption(name, state.tokens.curr);
}
}
assume();
// combine the passed globals after we've assumed all our options
combine(predefined, g || {});
//reset values
comma.first = true;
try {
advance();
switch (state.tokens.next.id) {
case "{":
case "[":
destructuringAssignOrJsonValue();
break;
default:
directives();
if (state.directive["use strict"]) {
if (!state.option.globalstrict && !(state.option.node || state.option.phantom)) {
warning("W097", state.tokens.prev);
}
}
statements();
}
advance((state.tokens.next && state.tokens.next.value !== ".") ? "(end)" : undefined);
funct["(blockscope)"].unstack();
var markDefined = function (name, context) {
do {
if (typeof context[name] === "string") {
// JSHINT marks unused variables as 'unused' and
// unused function declaration as 'unction'. This
// code changes such instances back 'var' and
// 'closure' so that the code in JSHINT.data()
// doesn't think they're unused.
if (context[name] === "unused")
context[name] = "var";
else if (context[name] === "unction")
context[name] = "closure";
return true;
}
context = context["(context)"];
} while (context);
return false;
};
var clearImplied = function (name, line) {
if (!implied[name])
return;
var newImplied = [];
for (var i = 0; i < implied[name].length; i += 1) {
if (implied[name][i] !== line)
newImplied.push(implied[name][i]);
}
if (newImplied.length === 0)
delete implied[name];
else
implied[name] = newImplied;
};
var warnUnused = function (name, tkn, type, unused_opt) {
var line = tkn.line;
var chr = tkn.character;
if (unused_opt === undefined) {
unused_opt = state.option.unused;
}
if (unused_opt === true) {
unused_opt = "last-param";
}
var warnable_types = {
"vars": ["var"],
"last-param": ["var", "param"],
"strict": ["var", "param", "last-param"]
};
if (unused_opt) {
if (warnable_types[unused_opt] && warnable_types[unused_opt].indexOf(type) !== -1) {
warningAt("W098", line, chr, name);
}
}
unuseds.push({
name: name,
line: line,
character: chr
});
};
var checkUnused = function (func, key) {
var type = func[key];
var tkn = func["(tokens)"][key];
if (key.charAt(0) === "(")
return;
if (type !== "unused" && type !== "unction" && type !== "const")
return;
// Params are checked separately from other variables.
if (func["(params)"] && func["(params)"].indexOf(key) !== -1)
return;
// Variable is in global scope and defined as exported.
if (func["(global)"] && _.has(exported, key))
return;
// Is this constant unused?
if (type === "const" && !getprop(func, key, "unused"))
return;
warnUnused(key, tkn, "var");
};
// Check queued 'x is not defined' instances to see if they're still undefined.
for (i = 0; i < JSHINT.undefs.length; i += 1) {
k = JSHINT.undefs[i].slice(0);
if (markDefined(k[2].value, k[0])) {
clearImplied(k[2].value, k[2].line);
} else if (state.option.undef) {
warning.apply(warning, k.slice(1));
}
}
functions.forEach(function (func) {
if (func["(unusedOption)"] === false) {
return;
}
for (var key in func) {
if (_.has(func, key)) {
checkUnused(func, key);
}
}
if (!func["(params)"])
return;
var params = func["(params)"].slice();
var param = params.pop();
var type, unused_opt;
while (param) {
type = func[param];
unused_opt = func["(unusedOption)"] || state.option.unused;
unused_opt = unused_opt === true ? "last-param" : unused_opt;
// 'undefined' is a special case for (function (window, undefined) { ... })();
// patterns.
if (param === "undefined")
return;
if (type === "unused" || type === "unction") {
warnUnused(param, func["(tokens)"][param], "param", func["(unusedOption)"]);
} else if (unused_opt === "last-param") {
return;
}
param = params.pop();
}
});
for (var key in declared) {
if (_.has(declared, key) && !_.has(global, key) && !_.has(exported, key)) {
warnUnused(key, declared[key], "var");
}
}
} catch (err) {
if (err && err.name === "JSHintError") {
var nt = state.tokens.next || {};
JSHINT.errors.push({
scope : "(main)",
raw : err.raw,
code : err.code,
reason : err.message,
line : err.line || nt.line,
character : err.character || nt.from
}, null);
} else {
throw err;
}
}
// Loop over the listed "internals", and check them as well.
if (JSHINT.scope === "(main)") {
o = o || {};
for (i = 0; i < JSHINT.internals.length; i += 1) {
k = JSHINT.internals[i];
o.scope = k.elem;
itself(k.value, o, g);
}
}
return JSHINT.errors.length === 0;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
itself
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
function each(obj, cb) {
if (!obj)
return;
if (!Array.isArray(obj) && typeof obj === "object")
obj = Object.keys(obj);
obj.forEach(cb);
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
each
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
get isJSON() {
return state.jsonMode;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
isJSON
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
markDefined = function (name, context) {
do {
if (typeof context[name] === "string") {
// JSHINT marks unused variables as 'unused' and
// unused function declaration as 'unction'. This
// code changes such instances back 'var' and
// 'closure' so that the code in JSHINT.data()
// doesn't think they're unused.
if (context[name] === "unused")
context[name] = "var";
else if (context[name] === "unction")
context[name] = "closure";
return true;
}
context = context["(context)"];
} while (context);
return false;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
markDefined
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
clearImplied = function (name, line) {
if (!implied[name])
return;
var newImplied = [];
for (var i = 0; i < implied[name].length; i += 1) {
if (implied[name][i] !== line)
newImplied.push(implied[name][i]);
}
if (newImplied.length === 0)
delete implied[name];
else
implied[name] = newImplied;
}
|
Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using normal JavaScript does not work as
expected during bootstrapping (see mirror.js in r114903).
@param {function} ctor Constructor function which needs to inherit the
prototype.
@param {function} superCtor Constructor function to inherit prototype from.
|
clearImplied
|
javascript
|
keystonejs/keystone-classic
|
admin/public/js/lib/codemirror/codemirror-compressed.js
|
https://github.com/keystonejs/keystone-classic/blob/master/admin/public/js/lib/codemirror/codemirror-compressed.js
|
MIT
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.