summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2018-09-10 15:27:41 +0200
committerJose <jose@zeroc.com>2018-09-10 15:27:41 +0200
commitfe9ec7014990b78b4633ade369aaa6e6ec87e0f3 (patch)
tree621950af4bdc2639925fcdcc84cbd03b6defcec9
parentDo not use std::map::at introduced in C++11 (diff)
downloadice-fe9ec7014990b78b4633ade369aaa6e6ec87e0f3.tar.bz2
ice-fe9ec7014990b78b4633ade369aaa6e6ec87e0f3.tar.xz
ice-fe9ec7014990b78b4633ade369aaa6e6ec87e0f3.zip
Do not use Ice__t_Value as parent for local PHP types
Close #175
-rw-r--r--cpp/src/slice2php/Main.cpp40
-rw-r--r--slice/Ice/Plugin.ice2
-rw-r--r--slice/Ice/PluginF.ice2
3 files changed, 34 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
{
diff --git a/slice/Ice/Plugin.ice b/slice/Ice/Plugin.ice
index 8c06eebccf6..2b11fa39022 100644
--- a/slice/Ice/Plugin.ice
+++ b/slice/Ice/Plugin.ice
@@ -33,6 +33,7 @@ module Ice
* each one.
*
**/
+["php:internal"]
local interface Plugin
{
/**
@@ -56,6 +57,7 @@ local interface Plugin
* plug-ins.
*
**/
+["php:internal"]
local interface PluginManager
{
/**
diff --git a/slice/Ice/PluginF.ice b/slice/Ice/PluginF.ice
index aa5f4a5ba47..2f4255025ac 100644
--- a/slice/Ice/PluginF.ice
+++ b/slice/Ice/PluginF.ice
@@ -19,7 +19,9 @@
module Ice
{
+["php:internal"]
local interface Plugin;
+["php:internal"]
local interface PluginManager;
}