void JSBTypeScript::ExportModuleClasses(const String& moduleName) { JSBModule* module = JSBindings::Instance()->GetModuleByName(moduleName); if (!module->classes_.Size()) return; source_ += "\n"; for (unsigned i = 0; i < module->classes_.Size(); i++) { JSBClass* klass = module->classes_.At(i); source_ += " export class " + klass->GetName(); if (klass->GetBaseClass()) source_ += " extends " + klass->GetBaseClass()->GetName(); source_ += " {\n\n"; Vector<String> propertyNames; klass->GetPropertyNames(propertyNames); for (unsigned j = 0; j < propertyNames.Size(); j++) { JSBProperty* prop = klass->GetProperty(propertyNames[j]); JSBFunctionType* ftype = NULL; if (prop->getter_ && !prop->getter_->Skip()) { ftype = prop->getter_->returnType_; } else if (prop->setter_ && !prop->setter_->Skip()) ftype = prop->setter_->parameters_[0]; if (!ftype) continue; String scriptType = GetScriptType(ftype); String scriptName = propertyNames[j]; scriptName[0] = tolower(scriptName[0]); source_ += " " + scriptName + ": " + scriptType + ";\n"; } if (propertyNames.Size()) source_ += "\n"; JSBFunction* constructor = klass->GetConstructor(); if (constructor) { ExportFunction(constructor); source_ += "\n"; } for (unsigned j = 0; j < klass->GetFunctionCount(); j++) { JSBFunction* func = klass->GetFunction(j); if (func->isConstructor_ || func->isDestructor_ || func->Skip()) continue; ExportFunction(func); } source_ += "\n }\n\n"; } source_ += "\n"; }