Fix %import and %fragment forced inclusion to not generate code.

This commit is contained in:
William S Fulton 2017-06-03 16:18:41 +01:00
commit 57a89f987d
8 changed files with 186 additions and 7 deletions

View file

@ -462,10 +462,10 @@ int JAVASCRIPT::fragmentDirective(Node *n) {
// and register them at the emitter.
String *section = Getattr(n, "section");
if (Equal(section, "templates")) {
if (Equal(section, "templates") && !ImportMode) {
emitter->registerTemplate(Getattr(n, "value"), Getattr(n, "code"));
} else {
Swig_fragment_register(n);
return Language::fragmentDirective(n);
}
return SWIG_OK;

View file

@ -624,7 +624,8 @@ int Language::constantDirective(Node *n) {
* ---------------------------------------------------------------------- */
int Language::fragmentDirective(Node *n) {
Swig_fragment_register(n);
if (!(Getattr(n, "emitonly") && ImportMode))
Swig_fragment_register(n);
return SWIG_OK;
}