mirror of
https://github.com/golang/go
synced 2024-11-13 17:30:24 -07:00
casify struct fields
R=r OCL=22998 CL=22998
This commit is contained in:
parent
aedf121e30
commit
626d25065d
@ -99,14 +99,14 @@ export func NewObject(pos, kind int, ident string) *Object {
|
|||||||
// Scopes
|
// Scopes
|
||||||
|
|
||||||
export type Scope struct {
|
export type Scope struct {
|
||||||
parent *Scope;
|
Parent *Scope;
|
||||||
entries map[string] *Object;
|
entries map[string] *Object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export func NewScope(parent *Scope) *Scope {
|
export func NewScope(parent *Scope) *Scope {
|
||||||
scope := new(Scope);
|
scope := new(Scope);
|
||||||
scope.parent = parent;
|
scope.Parent = parent;
|
||||||
scope.entries = make(map[string]*Object, 8);
|
scope.entries = make(map[string]*Object, 8);
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
@ -127,7 +127,7 @@ func (scope *Scope) Lookup(ident string) *Object {
|
|||||||
if obj != nil {
|
if obj != nil {
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
scope = scope.parent;
|
scope = scope.Parent;
|
||||||
}
|
}
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
@ -24,13 +24,13 @@ func assert(b bool) {
|
|||||||
|
|
||||||
|
|
||||||
export type Flags struct {
|
export type Flags struct {
|
||||||
verbose bool;
|
Verbose bool;
|
||||||
sixg bool;
|
Sixg bool;
|
||||||
deps bool;
|
Deps bool;
|
||||||
columns bool;
|
Columns bool;
|
||||||
testmode bool;
|
Testmode bool;
|
||||||
tokenchan bool;
|
Tokenchan bool;
|
||||||
naming bool;
|
Naming bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -125,18 +125,18 @@ export func Compile(src_file string, flags *Flags) (*AST.Program, int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var err errorHandler;
|
var err errorHandler;
|
||||||
err.Init(src_file, src, flags.columns);
|
err.Init(src_file, src, flags.Columns);
|
||||||
|
|
||||||
var scanner Scanner.Scanner;
|
var scanner Scanner.Scanner;
|
||||||
scanner.Init(&err, src, true, flags.testmode);
|
scanner.Init(&err, src, true, flags.Testmode);
|
||||||
|
|
||||||
var tstream <-chan *Scanner.Token;
|
var tstream <-chan *Scanner.Token;
|
||||||
if flags.tokenchan {
|
if flags.Tokenchan {
|
||||||
tstream = scanner.TokenStream();
|
tstream = scanner.TokenStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
var parser Parser.Parser;
|
var parser Parser.Parser;
|
||||||
parser.Open(flags.verbose, flags.sixg, flags.deps, flags.naming, &scanner, tstream);
|
parser.Open(flags.Verbose, flags.Sixg, flags.Deps, flags.Naming, &scanner, tstream);
|
||||||
|
|
||||||
prog := parser.ParseProgram();
|
prog := parser.ParseProgram();
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ func (P *Parser) OpenScope() {
|
|||||||
|
|
||||||
|
|
||||||
func (P *Parser) CloseScope() {
|
func (P *Parser) CloseScope() {
|
||||||
P.top_scope = P.top_scope.parent;
|
P.top_scope = P.top_scope.Parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,14 +18,14 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Flag.BoolVar(&flags.verbose, "v", false, "verbose mode: trace parsing");
|
Flag.BoolVar(&flags.Verbose, "v", false, "verbose mode: trace parsing");
|
||||||
Flag.BoolVar(&flags.sixg, "6g", true, "6g compatibility mode");
|
Flag.BoolVar(&flags.Sixg, "6g", true, "6g compatibility mode");
|
||||||
//TODO fix this code again
|
//TODO fix this code again
|
||||||
//Flag.BoolVar(&flags.deps, "d", false, "print dependency information only");
|
//Flag.BoolVar(&flags.Deps, "d", false, "print dependency information only");
|
||||||
Flag.BoolVar(&flags.columns, "columns", Platform.USER == "gri", "print column info in error messages");
|
Flag.BoolVar(&flags.Columns, "columns", Platform.USER == "gri", "print column info in error messages");
|
||||||
Flag.BoolVar(&flags.testmode, "t", false, "test mode: interprets /* ERROR */ and /* SYNC */ comments");
|
Flag.BoolVar(&flags.Testmode, "t", false, "test mode: interprets /* ERROR */ and /* SYNC */ comments");
|
||||||
Flag.BoolVar(&flags.tokenchan, "token_chan", false, "use token channel for scanner-parser connection");
|
Flag.BoolVar(&flags.Tokenchan, "token_chan", false, "use token channel for scanner-parser connection");
|
||||||
Flag.BoolVar(&flags.naming, "naming", false, "verify export naming scheme");
|
Flag.BoolVar(&flags.Naming, "naming", false, "verify export naming scheme");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ func main() {
|
|||||||
if nerrors > 0 {
|
if nerrors > 0 {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if !flags.naming && !*silent && !flags.testmode {
|
if !flags.Naming && !*silent && !flags.Testmode {
|
||||||
Printer.Print(prog);
|
Printer.Print(prog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user