MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / findNativePrototype

Function findNativePrototype

lib/web/jshint.js:20241–20269  ·  view source on GitHub ↗
(left)

Source from the content-addressed store, hash-verified

20239 }
20240
20241 function findNativePrototype(left) {
20242 var natives = [
20243 "Array", "ArrayBuffer", "Boolean", "Collator", "DataView", "Date",
20244 "DateTimeFormat", "Error", "EvalError", "Float32Array", "Float64Array",
20245 "Function", "Infinity", "Intl", "Int16Array", "Int32Array", "Int8Array",
20246 "Iterator", "Number", "NumberFormat", "Object", "RangeError",
20247 "ReferenceError", "RegExp", "StopIteration", "String", "SyntaxError",
20248 "TypeError", "Uint16Array", "Uint32Array", "Uint8Array", "Uint8ClampedArray",
20249 "URIError"
20250 ];
20251
20252 function walkPrototype(obj) {
20253 if (typeof obj !== "object") return;
20254 return obj.right === "prototype" ? obj : walkPrototype(obj.left);
20255 }
20256
20257 function walkNative(obj) {
20258 while (!obj.identifier && typeof obj.left === "object")
20259 obj = obj.left;
20260
20261 if (obj.identifier && natives.indexOf(obj.value) >= 0 &&
20262 state.funct["(scope)"].isPredefined(obj.value)) {
20263 return obj.value;
20264 }
20265 }
20266
20267 var prototype = walkPrototype(left);
20268 if (prototype) return walkNative(prototype);
20269 }
20270
20271 /**
20272 * Checks the left hand side of an assignment for issues, returns if ok

Callers 1

checkLeftSideAssignFunction · 0.85

Calls 2

walkPrototypeFunction · 0.85
walkNativeFunction · 0.85

Tested by

no test coverage detected