Fix Go -package option. Previously SWIG could get confused if the

module name was not the same as the package name, as is the default.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13395 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Ian Lance Taylor 2012-07-24 05:43:39 +00:00
commit 1e1c0ad951

View file

@ -18,6 +18,8 @@ class GO:public Language {
// Go package name. // Go package name.
String *package; String *package;
// SWIG module name.
String *module;
// Flag for generating gccgo output. // Flag for generating gccgo output.
bool gccgo_flag; bool gccgo_flag;
// Prefix to use with gccgo. // Prefix to use with gccgo.
@ -81,6 +83,7 @@ class GO:public Language {
public: public:
GO():package(NULL), GO():package(NULL),
module(NULL),
gccgo_flag(false), gccgo_flag(false),
go_prefix(NULL), go_prefix(NULL),
soname(NULL), soname(NULL),
@ -235,7 +238,7 @@ private:
allow_allprotected(GetFlag(optionsnode, "allprotected")); allow_allprotected(GetFlag(optionsnode, "allprotected"));
} }
String *module = Getattr(n, "name"); module = Getattr(n, "name");
if (!package) { if (!package) {
package = Copy(module); package = Copy(module);
} }
@ -4397,7 +4400,7 @@ private:
ret = exportedName(ret); ret = exportedName(ret);
Node *cnmod = Getattr(cn, "module"); Node *cnmod = Getattr(cn, "module");
if (!cnmod || Strcmp(Getattr(cnmod, "name"), package) == 0) { if (!cnmod || Strcmp(Getattr(cnmod, "name"), module) == 0) {
Setattr(undefined_types, t, t); Setattr(undefined_types, t, t);
} else { } else {
String *nw = NewString(""); String *nw = NewString("");
@ -4579,7 +4582,7 @@ private:
} }
ex = exportedName(cname); ex = exportedName(cname);
Node *cnmod = Getattr(cn, "module"); Node *cnmod = Getattr(cn, "module");
if (!cnmod || Strcmp(Getattr(cnmod, "name"), package) == 0) { if (!cnmod || Strcmp(Getattr(cnmod, "name"), module) == 0) {
if (add_to_hash) { if (add_to_hash) {
Setattr(undefined_types, ty, ty); Setattr(undefined_types, ty, ty);
} }