diff options
author | Jose <jose@zeroc.com> | 2018-09-10 15:27:41 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2018-09-10 15:27:41 +0200 |
commit | fe9ec7014990b78b4633ade369aaa6e6ec87e0f3 (patch) | |
tree | 621950af4bdc2639925fcdcc84cbd03b6defcec9 /cpp/src/slice2php | |
parent | Do not use std::map::at introduced in C++11 (diff) | |
download | ice-fe9ec7014990b78b4633ade369aaa6e6ec87e0f3.tar.bz2 ice-fe9ec7014990b78b4633ade369aaa6e6ec87e0f3.tar.xz ice-fe9ec7014990b78b4633ade369aaa6e6ec87e0f3.zip |
Do not use Ice__t_Value as parent for local PHP types
Close #175
Diffstat (limited to 'cpp/src/slice2php')
-rw-r--r-- | cpp/src/slice2php/Main.cpp | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/cpp/src/slice2php/Main.cpp b/cpp/src/slice2php/Main.cpp index 3d8e5438aa2..90c8a761e5d 100644 --- a/cpp/src/slice2php/Main.cpp +++ b/cpp/src/slice2php/Main.cpp @@ -151,6 +151,16 @@ void CodeVisitor::visitClassDecl(const ClassDeclPtr& p) { // + // Do not generate any code for php:internal types, those are provided by + // IcePHP C++ extension. + // + StringList metadata = p->getMetaData(); + if(find(metadata.begin(), metadata.end(), "php:internal") != metadata.end()) + { + return; + } + + // // Handle forward declarations. // string scoped = p->scoped(); @@ -430,16 +440,19 @@ CodeVisitor::visitClassDefStart(const ClassDefPtr& p) { string type; vector<string> seenType; - _out << sp << nl << "global "; - if(!base || (isInterface && !p->isLocal())) - { - type = "$Ice__t_Value"; - } - else + if(base || (!p->isLocal() && !isInterface)) { - type = getTypeVar(base); + _out << sp << nl << "global "; + if(!base) + { + type = "$Ice__t_Value"; + } + else + { + type = getTypeVar(base); + } + _out << type << ";"; } - _out << type << ";"; seenType.push_back(type); for(DataMemberList::iterator q = members.begin(); q != members.end(); ++q) @@ -460,9 +473,16 @@ CodeVisitor::visitClassDefStart(const ClassDefPtr& p) _out << nl << type << " = IcePHP_defineClass('" << scoped << "', '" << escapeName(abs) << "', " << p->compactId() << ", " << (preserved ? "true" : "false") << ", " << (isInterface ? "true" : "false") << ", "; - if(!base || (isInterface && !p->isLocal())) + if(!base) { - _out << "$Ice__t_Value"; + if(p->isLocal() || isInterface) + { + _out << "null"; + } + else + { + _out << "$Ice__t_Value"; + } } else { |