Incorporated Kou's patch for the Ruby module's %import directive, so
that nested module names are imported correctly. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5908 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
aff4882c26
commit
410af41cae
2 changed files with 42 additions and 1 deletions
|
|
@ -484,7 +484,25 @@ public:
|
|||
virtual int importDirective(Node *n) {
|
||||
String *modname = Getattr(n,"module");
|
||||
if (modname) {
|
||||
Printf(f_init,"rb_require(\"%s\");\n", modname);
|
||||
List *modules = Split(modname,':',INT_MAX);
|
||||
if (modules && Len(modules) > 0) {
|
||||
modname = NewString("");
|
||||
String *last = NULL;
|
||||
Iterator m = First(modules);
|
||||
while (m.item) {
|
||||
if (Len(m.item) > 0) {
|
||||
if (last) {
|
||||
Append(modname, "/");
|
||||
}
|
||||
Append(modname, m.item);
|
||||
last = m.item;
|
||||
}
|
||||
m = Next(m);
|
||||
}
|
||||
Printf(f_init,"rb_require(\"%s\");\n", modname);
|
||||
Delete(modname);
|
||||
}
|
||||
Delete(modules);
|
||||
}
|
||||
return Language::importDirective(n);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue