diff options
Diffstat (limited to 'cpp/src/slice2php/Main.cpp')
-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 { |