diff options
Diffstat (limited to 'src/cmd/gc/lex.c')
| -rw-r--r-- | src/cmd/gc/lex.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/cmd/gc/lex.c b/src/cmd/gc/lex.c index 68ae6864d..b7f71d553 100644 --- a/src/cmd/gc/lex.c +++ b/src/cmd/gc/lex.c @@ -376,6 +376,7 @@ main(int argc, char *argv[]) curfn = l->n; saveerrors(); typechecklist(l->n->nbody, Etop); + checkreturn(l->n); if(nerrors != 0) l->n->nbody = nil; // type errors; do not compile } @@ -601,7 +602,7 @@ void importfile(Val *f, int line) { Biobuf *imp; - char *file, *p, *q; + char *file, *p, *q, *tag; int32 c; int len; Strlit *path; @@ -609,8 +610,6 @@ importfile(Val *f, int line) USED(line); - // TODO(rsc): don't bother reloading imports more than once? - if(f->ctype != CTSTR) { yyerror("import statement not a string"); fakeimport(); @@ -685,7 +684,11 @@ importfile(Val *f, int line) // to the lexer to avoid parsing export data twice. if(importpkg->imported) { file = strdup(namebuf); - p = smprint("package %s\n$$\n", importpkg->name); + tag = ""; + if(importpkg->safe) { + tag = "safe"; + } + p = smprint("package %s %s\n$$\n", importpkg->name, tag); cannedimports(file, p); return; } |
