diff options
author | Jose <jose@zeroc.com> | 2018-12-05 23:32:56 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2018-12-05 23:32:56 +0100 |
commit | a232d2b1998c717e086b334d94ab70cae0023d5a (patch) | |
tree | 6cd249878529c523fa5cffa57b5dd82d7b837f9d /cpp/src/slice2js/JsUtil.cpp | |
parent | Always enable error checks for mutexes (#305) (diff) | |
download | ice-a232d2b1998c717e086b334d94ab70cae0023d5a.tar.bz2 ice-a232d2b1998c717e086b334d94ab70cae0023d5a.tar.xz ice-a232d2b1998c717e086b334d94ab70cae0023d5a.zip |
TypeScript improvements
Diffstat (limited to 'cpp/src/slice2js/JsUtil.cpp')
-rw-r--r-- | cpp/src/slice2js/JsUtil.cpp | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/cpp/src/slice2js/JsUtil.cpp b/cpp/src/slice2js/JsUtil.cpp index 002919087f0..b368e7f05e6 100644 --- a/cpp/src/slice2js/JsUtil.cpp +++ b/cpp/src/slice2js/JsUtil.cpp @@ -200,32 +200,16 @@ Slice::JsGenerator::getModuleMetadata(const TypePtr& type) } string -Slice::JsGenerator::getModuleMetadata(const ContainedPtr& cont) +Slice::JsGenerator::getModuleMetadata(const ContainedPtr& p) { // - // Traverse to the top-level module. + // Check if the file contains the python:pkgdir global metadata. // - ModulePtr m; - ContainedPtr p = cont; - while (true) - { - if(ModulePtr::dynamicCast(p)) - { - m = ModulePtr::dynamicCast(p); - } - - ContainerPtr c = p->container(); - p = ContainedPtr::dynamicCast(c); // This cast fails for Unit. - if(!p) - { - break; - } - } - + DefinitionContextPtr dc = p->definitionContext(); + assert(dc); const string prefix = "js:module:"; - string value; - findMetaData(prefix, m->getMetaData(), value); - return value; + const string value = dc->findMetaData(prefix); + return value.empty() ? value : value.substr(prefix.size()); } bool |