MCPcopy
hub / github.com/winjs/winjs / parseInterface

Function parseInterface

tools/dts-verifier/tscore.js:435–470  ·  view source on GitHub ↗
(node, host)

Source from the content-addressed store, hash-verified

433 }
434}
435function parseInterface(node, host) {
436 current_node = node;
437 var qname = qualify(host, node.name.text());
438 var typ = new TObject(qname, {kind:'interface', origin:current_file})
439 current_scope = new TTypeParameterScope(current_scope)
440 node.typeParameters && node.typeParameters.members.forEach(function(tp,index) {
441 var name = tp.name.text()
442 current_scope.env.put(name, new TTypeParam(name))
443 typ.typeParameters.push(parseTypeParameter(tp))
444 })
445 node.extendsList && node.extendsList.members.forEach(function(ext) {
446 typ.supers.push(parseType(ext))
447 })
448 node.members.members.forEach(function(member) {
449 if (member instanceof TypeScript.FunctionDeclaration) {
450 var t;
451 if (member.name && !member.isIndexerMember()) {
452 var optional = TypeScript.hasFlag(member.name.getFlags(), TypeScript.ASTFlags.OptionalName)
453 t = typ.getMember(member.name.text(), optional)
454 } else {
455 t = typ;
456 }
457 t.calls.push(parseFunctionType(member))
458 }
459 else if (member instanceof TypeScript.VariableDeclarator) {
460 var optional = TypeScript.hasFlag(member.id.getFlags(), TypeScript.ASTFlags.OptionalName)
461 var t = member.typeExpr ? parseType(member.typeExpr) : TAny;
462 typ.setMember(member.id.text(), t, optional)
463 }
464 else {
465 throw new TypeError("Unexpected member " + member.constructor.name + " in interface")
466 }
467 })
468 current_scope = current_scope.parent
469 return typ
470}
471
472function lookupTypeParameterDirect(scope, name) {
473 if (scope instanceof TTypeParameterScope)

Callers 2

addModuleMemberFunction · 0.85
parseTypeFunction · 0.85

Calls 8

qualifyFunction · 0.85
parseTypeParameterFunction · 0.85
parseTypeFunction · 0.85
parseFunctionTypeFunction · 0.85
textMethod · 0.80
putMethod · 0.80
forEachMethod · 0.65
pushMethod · 0.65

Tested by

no test coverage detected