Source:
private void walk(TypedVar symbol, boolean isDefault) { JSType type = symbol.getType(); if (type.isFunctionType()) { FunctionType ftype = (FunctionType) type; if (isDefault && ftype.isInterface()) { emit("interface"); emit(getUnqualifiedName(symbol)); visitObjectType(ftype, ftype.getPrototype(), false); emit("var"); emit(getUnqualifiedName(symbol)); emit(":"); visitRecordLikeType(ftype); emitBreak(); return; } if (type.isOrdinaryFunction()) { emit("function"); emit(getUnqualifiedName(symbol)); visitFunctionDeclaration(ftype); emit(";"); emitBreak(); return; } if (type.isConstructor()) { emit("class"); } else if (type.isInterface()) { emit("interface"); } else { checkState(false, "Unexpected function type " + type); } emit(getUnqualifiedName(symbol)); visitTemplateTypes(ftype); if (ftype.getExtendedInterfacesCount() > 0) { emit("extends"); Iterator<ObjectType> it = ftype.getExtendedInterfaces().iterator(); while (it.hasNext()) { emit(getRelativeName(it.next())); if (it.hasNext()) { emit(","); } } } if (getSuperType(ftype) != null) { emit("extends"); emit(getRelativeName(getSuperType(ftype))); } Iterator<ObjectType> it = ftype.getOwnImplementedInterfaces().iterator(); if (it.hasNext()) { emit("implements"); while (it.hasNext()) { emit(getRelativeName(it.next())); if (it.hasNext()) { emit(","); } } } visitObjectType(ftype, ftype.getPrototype()); } else { if (type.isEnumType()) { visitEnumType((EnumType) type); return; } if (type.isNoType()) { JSType registryType = typeRegistry.getType(symbol.getName()); if (registryType != null) { visitTypeAlias(registryType, getUnqualifiedName(symbol)); return; } } emit("var"); emit(getUnqualifiedName(symbol)); visitTypeDeclaration(type); emit(";"); emitBreak(); } }

Target:
private void walk(TypedVar symbol, boolean isDefault) { JSType type = symbol.getType(); if (type.isFunctionType()) { FunctionType ftype = (FunctionType) type; if (type.isOrdinaryFunction()) { emit("function"); emit(getUnqualifiedName(symbol)); visitFunctionDeclaration(ftype); emit(";"); emitBreak(); return; } if (type.isConstructor()) { emit("class"); } else if (type.isInterface()) { emit("interface"); } else { checkState(false, "Unexpected function type " + type); } emit(getUnqualifiedName(symbol)); visitTemplateTypes(ftype); if (ftype.getExtendedInterfacesCount() > 0) { emit("extends"); Iterator<ObjectType> it = ftype.getExtendedInterfaces().iterator(); while (it.hasNext()) { emit(getRelativeName(it.next())); if (it.hasNext()) { emit(","); } } } if (getSuperType(ftype) != null) { emit("extends"); emit(getRelativeName(getSuperType(ftype))); } Iterator<ObjectType> it = ftype.getOwnImplementedInterfaces().iterator(); if (it.hasNext()) { emit("implements"); while (it.hasNext()) { emit(getRelativeName(it.next())); if (it.hasNext()) { emit(","); } } } if (ftype.isInterface()) { visitObjectType(ftype, ftype.getPrototype(), false); if (any(ftype.getOwnPropertyNames(), not(equalTo("prototype")))) { emit("var"); emit(getUnqualifiedName(symbol)); emit(":"); visitRecordLikeType(ftype); emitBreak(); } } else { visitObjectType(ftype, ftype.getPrototype()); } } else { if (type.isEnumType()) { visitEnumType((EnumType) type); return; } if (type.isNoType()) { JSType registryType = typeRegistry.getType(symbol.getName()); if (registryType != null) { visitTypeAlias(registryType, getUnqualifiedName(symbol)); return; } } emit("var"); emit(getUnqualifiedName(symbol)); visitTypeDeclaration(type); emit(";"); emitBreak(); } }