Sym* pathsym;
char* prefix; // escaped path for use in symbol table
Pkg* link;
+ uchar imported; // export data of this package was parsed
char exported; // import line written in export data
char direct; // imported directly
};
}
importpkg = mkpkg(path);
+ // If we already saw that package, feed a dummy statement
+ // to the lexer to avoid parsing export data twice.
+ if(importpkg->imported) {
+ file = strdup(namebuf);
+ p = smprint("package %s\n$$\n", importpkg->name);
+ cannedimports(file, p);
+ return;
+ }
+ importpkg->imported = 1;
+
imp = Bopen(namebuf, OREAD);
if(imp == nil) {
yyerror("can't open import: \"%Z\": %r", f->u.sval);