(base, spec, path)
| 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) { |
no test coverage detected