diff options
author | Jose <jose@zeroc.com> | 2018-11-22 21:36:37 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2018-11-22 21:42:20 +0100 |
commit | 6e53fc191bbcdd999021d8c0e9542171f63a593c (patch) | |
tree | 5a18415751b3ba395bebd0e16bd62358d787151e /cpp/src/slice2js/JsUtil.cpp | |
parent | typescript: missing ice_cause in Ice.Exception (diff) | |
download | ice-6e53fc191bbcdd999021d8c0e9542171f63a593c.tar.bz2 ice-6e53fc191bbcdd999021d8c0e9542171f63a593c.tar.xz ice-6e53fc191bbcdd999021d8c0e9542171f63a593c.zip |
typescript: don't generate Prx definiton for Class without operations
Close #302
Diffstat (limited to 'cpp/src/slice2js/JsUtil.cpp')
-rw-r--r-- | cpp/src/slice2js/JsUtil.cpp | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/cpp/src/slice2js/JsUtil.cpp b/cpp/src/slice2js/JsUtil.cpp index c1f6e6912fe..002919087f0 100644 --- a/cpp/src/slice2js/JsUtil.cpp +++ b/cpp/src/slice2js/JsUtil.cpp @@ -520,20 +520,34 @@ Slice::JsGenerator::typeToString(const TypePtr& type, if(proxy) { ostringstream os; - string prefix; - if(typescript) + ClassDefPtr def = proxy->_class()->definition(); + if(!def->isInterface() && def->allOperations().empty()) { - prefix = importPrefix(ContainedPtr::dynamicCast(proxy->_class()->definition()), toplevel, imports); - os << prefix; - } - - if(prefix.empty() && typescript) - { - os << getUnqualified(fixId(proxy->_class()->scoped() + "Prx"), toplevel->scope(), prefix); + if(getModuleMetadata(toplevel) != "ice") + { + os << "iceNS0."; + } + os << getUnqualified(typeScriptBuiltinTable[Builtin::KindObjectProxy], + toplevel->scope(), + getModuleMetadata(toplevel)); } else { - os << fixId(proxy->_class()->scoped() + "Prx"); + string prefix; + if(typescript) + { + prefix = importPrefix(ContainedPtr::dynamicCast(def), toplevel, imports); + os << prefix; + } + + if(prefix.empty() && typescript) + { + os << getUnqualified(fixId(proxy->_class()->scoped() + "Prx"), toplevel->scope(), prefix); + } + else + { + os << fixId(proxy->_class()->scoped() + "Prx"); + } } return os.str(); } |