diff options
author | Jose <jose@zeroc.com> | 2014-06-17 19:09:31 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2014-06-17 19:09:31 +0200 |
commit | db7d72e5343b2e03406e5dea9b2d5eb7d5b6385f (patch) | |
tree | 61e4cc928a04956119a5a423c89d2b25b8e66bba /cpp | |
parent | Fix for ICE-5321: Ice.Config set to empty value (C++, Java, C#) (diff) | |
download | ice-db7d72e5343b2e03406e5dea9b2d5eb7d5b6385f.tar.bz2 ice-db7d72e5343b2e03406e5dea9b2d5eb7d5b6385f.tar.xz ice-db7d72e5343b2e03406e5dea9b2d5eb7d5b6385f.zip |
JavaScript nested modules patch
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/slice2js/Gen.cpp | 5 | ||||
-rw-r--r-- | cpp/test/Ice/objects/Test.ice | 36 | ||||
-rw-r--r-- | cpp/test/Ice/objects/TestI.cpp | 28 | ||||
-rw-r--r-- | cpp/test/Ice/objects/TestI.h | 6 |
4 files changed, 72 insertions, 3 deletions
diff --git a/cpp/src/slice2js/Gen.cpp b/cpp/src/slice2js/Gen.cpp index a95735661f6..1542b04f8fd 100644 --- a/cpp/src/slice2js/Gen.cpp +++ b/cpp/src/slice2js/Gen.cpp @@ -835,7 +835,7 @@ Slice::Gen::TypesVisitor::visitModuleStart(const ModulePtr& p) // // For an inner module we write // - // Foo.Bar = global.Foo ? (global.Foo.Bar || {}) : {}; + // Foo.Bar = Foo.Bar || {}; // const string scoped = getLocalScope(p->scoped()); @@ -850,8 +850,7 @@ Slice::Gen::TypesVisitor::visitModuleStart(const ModulePtr& p) } else { - _out << nl << scoped << " = global." << getLocalScope(p->scope()) << " ? (global." << scoped - << " || {}) : {};"; + _out << nl << scoped << " = " << scoped << " || {};"; } } return true; diff --git a/cpp/test/Ice/objects/Test.ice b/cpp/test/Ice/objects/Test.ice index 51bad251fd7..93771fce993 100644 --- a/cpp/test/Ice/objects/Test.ice +++ b/cpp/test/Ice/objects/Test.ice @@ -105,6 +105,36 @@ class CompactExt(CompactExtId) extends Compact { }; +module Inner +{ + +class A +{ + ::Test::A theA; +}; + +exception Ex +{ + string reason; +}; + +module Sub +{ + +class A +{ + ::Test::Inner::A theA; +}; + +exception Ex +{ + string reason; +}; + +}; + +}; + class Initial { void shutdown(); @@ -126,6 +156,12 @@ class Initial BaseSeq opBaseSeq(BaseSeq inSeq, out BaseSeq outSeq); Compact getCompact(); + + Inner::A getInnerA(); + Inner::Sub::A getInnerSubA(); + + void throwInnerEx() throws Inner::Ex; + void throwInnerSubEx() throws Inner::Sub::Ex; }; class Empty diff --git a/cpp/test/Ice/objects/TestI.cpp b/cpp/test/Ice/objects/TestI.cpp index 595bc6f3e18..a5df2c6d3c9 100644 --- a/cpp/test/Ice/objects/TestI.cpp +++ b/cpp/test/Ice/objects/TestI.cpp @@ -223,6 +223,34 @@ InitialI::getCompact(const Ice::Current&) return new CompactExt(); } +Test::Inner::APtr +InitialI::getInnerA(const Ice::Current&) +{ + return new Inner::A(_b1); +} + +Test::Inner::Sub::APtr +InitialI::getInnerSubA(const Ice::Current&) +{ + return new Inner::Sub::A(new Inner::A(_b1)); +} + +void +InitialI::throwInnerEx(const Ice::Current&) +{ + Inner::Ex ex; + ex.reason = "Inner::Ex"; + throw ex; +} + +void +InitialI::throwInnerSubEx(const Ice::Current&) +{ + Inner::Sub::Ex ex; + ex.reason = "Inner::Sub::Ex"; + throw ex; +} + IPtr InitialI::getJ(const Ice::Current&) { diff --git a/cpp/test/Ice/objects/TestI.h b/cpp/test/Ice/objects/TestI.h index 8f7b280d9f2..622fb011cb5 100644 --- a/cpp/test/Ice/objects/TestI.h +++ b/cpp/test/Ice/objects/TestI.h @@ -115,6 +115,12 @@ public: virtual Test::CompactPtr getCompact(const Ice::Current&); + virtual Test::Inner::APtr getInnerA(const Ice::Current&); + virtual Test::Inner::Sub::APtr getInnerSubA(const Ice::Current&); + + virtual void throwInnerEx(const Ice::Current&); + virtual void throwInnerSubEx(const Ice::Current&); + private: Ice::ObjectAdapterPtr _adapter; |