]> Cypherpunks.ru repositories - gostls13.git/commitdiff
remove uses of *T as an implicit forward declaration of T
authorRuss Cox <rsc@golang.org>
Tue, 7 Oct 2008 19:59:54 +0000 (12:59 -0700)
committerRuss Cox <rsc@golang.org>
Tue, 7 Oct 2008 19:59:54 +0000 (12:59 -0700)
R=gri,r
OCL=16648
CL=16652

src/lib/flag.go
test/bugs/bug041.go
test/fixedbugs/bug066.go
test/ken/rob2.go
usr/gri/gosrc/globals.go
usr/gri/pretty/ast.go

index 968790edf0561ef6707f8853b79a8016a13fd19c..a46e5fda1cb191af2d668ea778430cbb48975a99 100644 (file)
@@ -98,6 +98,12 @@ func atob(str string) (value bool, ok bool) {
        return false, false
 }
 
+type (
+       BoolValue struct;
+       IntValue struct;
+       StringValue struct;
+)
+
 // -- Bool Value
 type BoolValue struct {
        val bool;
index 1a6e0dde801039ffca70033c5ddafb2ef8e76f46..f5656666913c8cfbe423b92cfbacc6eca9f1f973 100644 (file)
@@ -6,6 +6,7 @@
 
 package main
 
+type T struct
 type S struct {
   p *T  // BUG T never declared
 }
index 792e265f606bcf8572b3e62e223e14ed687d1dae..ab692579201ca91d40de6cd72dc7b943182baf28 100644 (file)
@@ -6,6 +6,10 @@
 
 package main
 
+type (
+       Type struct;
+       Object struct;
+)
 
 type Scope struct {
        entries *map[string] *Object;
index cca74e57a5425caf21ece07e9ef18287383ef039..7d2eecbf7d906f68c589e0221823631a00e38b75 100644 (file)
@@ -9,6 +9,12 @@ package main
 
 const nilchar = 0;
 
+type (
+       Atom struct;
+       List struct;
+       Slist struct;
+)
+
 type Atom struct {
        str             string;
        integer         int;
index da5125a5f9857fd8d099f3a5cc0bead6b90d93ca..14e588ee9da2c76ab5e512619211c4009e8d4637 100644 (file)
@@ -13,6 +13,11 @@ package Globals
 
 // ----------------------------------------------------------------------------
 
+type Type struct
+type Scope struct
+type Elem struct
+type Compilation struct
+
 export type Object struct {
        exported bool;
        pos int;  // source position (< 0 if unknown position)
@@ -86,7 +91,7 @@ export type Compilation struct {
        // environment
        flags *Flags;
        env *Environment;
-       
+
        // TODO use open arrays eventually
        pkg_list [256] *Package;  // pkg_list[0] is the current package
        pkg_ref int;
@@ -199,7 +204,7 @@ func (L *List) at(i int) *Elem {
        for ; i > 0; i-- {
                p = p.next;
        }
-       
+
        return p;
 }
 
index 58f2d6e41d5682943d56179cdd6c734cd14ef43d..cd31f3f21afaaa715d37f6ab87df2c992c3f8f78 100644 (file)
@@ -8,11 +8,54 @@ package AST
 // ----------------------------------------------------------------------------
 // Visitor
 
+type (
+       Nil struct;
+       Ident struct;
+       ArrayType struct;
+       StructType struct;
+       MapType struct;
+       ChannelType struct;
+       PointerType struct;
+       InterfaceType struct;
+       FunctionType struct;
+       VarDeclList struct;
+       ImportDecl struct;
+       ConstDecl struct;
+       TypeDecl struct;
+       VarDecl struct;
+       Declaration struct;
+       FuncDecl struct;
+       MethodDecl struct;
+       Selector struct;
+       Index struct;
+       Call struct;
+       Pair struct;
+       Binary struct;
+       Unary struct;
+       Literal struct;
+       CompositeLit struct;
+       FunctionLit struct;
+       Label struct;
+       Block struct;
+       ExprStat struct;
+       Assignment struct;
+       ControlClause struct;
+       IfStat struct;
+       ForStat struct;
+       CaseClause struct;
+       SwitchStat struct;
+       ReturnStat struct;
+       IncDecStat struct;
+       ControlFlowStat struct;
+       GoStat struct;
+       Program struct;
+)
+
 export type Visitor interface {
        // Basics
        DoNil(x *Nil);
        DoIdent(x *Ident);
-       
+
        // Types
        DoFunctionType(x *FunctionType);
        DoArrayType(x *ArrayType);
@@ -21,7 +64,7 @@ export type Visitor interface {
        DoChannelType(x *ChannelType);
        DoInterfaceType(x *InterfaceType);
        DoPointerType(x *PointerType);
-       
+
        // Declarations
        DoImportDecl(x *ImportDecl);
        DoConstDecl(x *ConstDecl);
@@ -31,7 +74,7 @@ export type Visitor interface {
        DoFuncDecl(x *FuncDecl);
        DoMethodDecl(x *MethodDecl);
        DoDeclaration(x *Declaration);
-       
+
        // Expressions
        DoBinary(x *Binary);
        DoUnary(x *Unary);