| 346 | } |
| 347 | |
| 348 | function descendProps(base, parts) { |
| 349 | for (var i = 0; i < parts.length && base != infer.ANull; ++i) { |
| 350 | var prop = parts[i]; |
| 351 | if (prop.charAt(0) == "!") { |
| 352 | if (prop == "!proto") { |
| 353 | base = (base instanceof infer.Obj && base.proto) || infer.ANull; |
| 354 | } else { |
| 355 | var fn = base.getFunctionType(); |
| 356 | if (!fn) { |
| 357 | base = infer.ANull; |
| 358 | } else if (prop == "!ret") { |
| 359 | base = fn.retval && fn.retval.getType(false) || infer.ANull; |
| 360 | } else { |
| 361 | var arg = fn.args && fn.args[Number(prop.slice(1))]; |
| 362 | base = (arg && arg.getType(false)) || infer.ANull; |
| 363 | } |
| 364 | } |
| 365 | } else if (base instanceof infer.Obj && |
| 366 | (prop == "prototype" && base instanceof infer.Fn || base.hasProp(prop))) { |
| 367 | var propVal = base.getProp(prop); |
| 368 | if (!propVal || propVal.isEmpty()) |
| 369 | base = infer.ANull; |
| 370 | else |
| 371 | base = propVal.types[0]; |
| 372 | } else { |
| 373 | base = infer.ANull; |
| 374 | } |
| 375 | } |
| 376 | return base; |
| 377 | } |
| 378 | |
| 379 | function emptyObj(ctor) { |
| 380 | var empty = Object.create(ctor.prototype); |