diff options
author | Mark Spruiell <mes@zeroc.com> | 2014-09-29 15:04:05 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2014-09-29 15:04:05 -0700 |
commit | c88472a53c1170b1db6af6e0a3f6d308b1f016f5 (patch) | |
tree | bf0f3f65026174d3f0eec5718423d4513ae692cd /cpp | |
parent | ICE-5478 fixed Silverligh demo readmes to set startup page properly (diff) | |
download | ice-c88472a53c1170b1db6af6e0a3f6d308b1f016f5.tar.bz2 ice-c88472a53c1170b1db6af6e0a3f6d308b1f016f5.tar.xz ice-c88472a53c1170b1db6af6e0a3f6d308b1f016f5.zip |
ICE-5692 - PHP type objects should be global
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/slice2php/Main.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/cpp/src/slice2php/Main.cpp b/cpp/src/slice2php/Main.cpp index 5e6a98becad..f65118bf1e7 100644 --- a/cpp/src/slice2php/Main.cpp +++ b/cpp/src/slice2php/Main.cpp @@ -144,7 +144,12 @@ CodeVisitor::visitClassDecl(const ClassDeclPtr& p) startNamespace(p); string type = getTypeVar(p); - _out << sp << nl << "if(!isset(" << type << "))"; + _out << sp << nl << "global " << type << ';'; + if(!p->isLocal()) + { + _out << nl << "global " << type << "Prx;"; + } + _out << nl << "if(!isset(" << type << "))"; _out << sb; _out << nl << type << " = IcePHP_declareClass('" << scoped << "');"; if(!p->isLocal()) @@ -178,6 +183,12 @@ CodeVisitor::visitClassDefStart(const ClassDefPtr& p) startNamespace(p); + _out << sp << nl << "global " << type << ';'; + if(!p->isLocal()) + { + _out << nl << "global " << prxType << ';'; + } + // // Define the class. // @@ -613,6 +624,7 @@ CodeVisitor::visitExceptionStart(const ExceptionPtr& p) startNamespace(p); + _out << sp << nl << "global " << type << ';'; _out << sp << nl << "if(!class_exists('" << escapeName(abs) << "'))"; _out << sb; _out << nl << "class " << name << " extends "; @@ -774,6 +786,7 @@ CodeVisitor::visitStructStart(const StructPtr& p) startNamespace(p); + _out << sp << nl << "global " << type << ';'; _out << sp << nl << "if(!class_exists('" << escapeName(abs) << "'))"; _out << sb; @@ -853,6 +866,7 @@ CodeVisitor::visitSequence(const SequencePtr& p) // Emit the type information. // string scoped = p->scoped(); + _out << sp << nl << "global " << type << ';'; _out << sp << nl << "if(!isset(" << type << "))"; _out << sb; _out << nl << type << " = IcePHP_defineSequence('" << scoped << "', "; @@ -907,6 +921,7 @@ CodeVisitor::visitDictionary(const DictionaryPtr& p) // Emit the type information. // string scoped = p->scoped(); + _out << sp << nl << "global " << type << ';'; _out << sp << nl << "if(!isset(" << type << "))"; _out << sb; _out << nl << type << " = IcePHP_defineDictionary('" << scoped << "', "; @@ -930,6 +945,7 @@ CodeVisitor::visitEnum(const EnumPtr& p) startNamespace(p); + _out << sp << nl << "global " << type << ';'; _out << sp << nl << "if(!class_exists('" << escapeName(abs) << "'))"; _out << sb; _out << nl << "class " << name; |