mirror of
https://github.com/golang/go
synced 2024-11-22 04:54:42 -07:00
gc: add GOEXPERIMENT=os.Error
This won't last long, I promise. R=ken2 CC=golang-dev https://golang.org/cl/5330066
This commit is contained in:
parent
a2149f2638
commit
47f4bf763d
@ -852,6 +852,7 @@ EXTERN int typecheckok;
|
||||
EXTERN int compiling_runtime;
|
||||
|
||||
EXTERN int rune32;
|
||||
EXTERN int oserror;
|
||||
|
||||
/*
|
||||
* y.tab.c
|
||||
|
@ -38,6 +38,7 @@ static struct {
|
||||
int *val;
|
||||
} exper[] = {
|
||||
{"rune32", &rune32},
|
||||
{"os.Error", &oserror},
|
||||
};
|
||||
|
||||
static void
|
||||
|
@ -2967,6 +2967,17 @@ mkpkg(Strlit *path)
|
||||
p->prefix = pathtoprefix(path->s);
|
||||
p->link = phash[h];
|
||||
phash[h] = p;
|
||||
|
||||
// If the compiler was built with
|
||||
// GOEXPERIMENT=os.Error
|
||||
// define os.Error as an alias for error.
|
||||
// Terrible and won't last long, but useful for transitions.
|
||||
if(oserror && strcmp(path->s, "os") == 0) {
|
||||
Sym *s;
|
||||
s = pkglookup("Error", p);
|
||||
s->def = typenod(errortype);
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user