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

Function passOne

lib/web/tern/def.js:394–417  ·  view source on GitHub ↗
(base, spec, path)

Source from the content-addressed store, hash-verified

392 }
393
394 function passOne(base, spec, path) {
395 if (!base) {
396 var tp = spec["!type"];
397 if (tp) {
398 if (/^fn\(/.test(tp)) base = emptyObj(infer.Fn);
399 else if (tp.charAt(0) == "[") base = emptyObj(infer.Arr);
400 else if (tp.charAt(0) == "+") base = emptyObj(infer.Obj)
401 else throw new Error("Invalid !type spec: " + tp);
402 } else if (spec["!stdProto"]) {
403 base = infer.cx().protos[spec["!stdProto"]];
404 } else {
405 base = emptyObj(infer.Obj);
406 }
407 base.name = path;
408 }
409
410 for (var name in spec) if (hop(spec, name) && name.charCodeAt(0) != 33) {
411 var inner = spec[name];
412 if (typeof inner == "string" || isSimpleAnnotation(inner)) continue;
413 var prop = base.defProp(name);
414 passOne(prop.getObjType(), inner, path ? path + "." + name : name).propagate(prop);
415 }
416 return base;
417 }
418
419 function passTwo(base, spec, path) {
420 if (base.isShell) {

Callers 2

doLoadEnvironmentFunction · 0.85
def.jsFile · 0.85

Calls 5

emptyObjFunction · 0.85
hopFunction · 0.85
isSimpleAnnotationFunction · 0.85
propagateMethod · 0.80
testMethod · 0.45

Tested by

no test coverage detected