]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/api: include constant values
authorBrad Fitzpatrick <bradfitz@golang.org>
Fri, 6 Sep 2013 19:01:01 +0000 (12:01 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 6 Sep 2013 19:01:01 +0000 (12:01 -0700)
Update #5935

R=golang-dev, rsc, iant, dave
CC=golang-dev
https://golang.org/cl/13261050

src/cmd/api/goapi.go
src/cmd/api/testdata/src/pkg/p1/golden.txt

index 1138f4db02f0a5492ff179e9f7a1589e322a9931..7102e9d409af21086e57beefb88d90cb8b12626e 100644 (file)
@@ -690,16 +690,13 @@ func (w *Walker) emitObj(obj types.Object) {
        switch obj := obj.(type) {
        case *types.Const:
                w.emitf("const %s %s", obj.Name(), w.typeString(obj.Type()))
-
+               w.emitf("const %s = %s", obj.Name(), obj.Val())
        case *types.Var:
                w.emitf("var %s %s", obj.Name(), w.typeString(obj.Type()))
-
        case *types.TypeName:
                w.emitType(obj)
-
        case *types.Func:
                w.emitFunc(obj)
-
        default:
                panic("unknown object: " + obj.String())
        }
index 12fd452ffe50637b747acbdcfdb212449000fb89..3c43a226ff7bd663c7848c37d0b5263c395aebc3 100644 (file)
@@ -1,10 +1,18 @@
+pkg p1, const A = 1
 pkg p1, const A ideal-int
+pkg p1, const A64 = 1
 pkg p1, const A64 int64
+pkg p1, const AIsLowerA = 11
 pkg p1, const AIsLowerA ideal-int
+pkg p1, const B0 = 2
 pkg p1, const B0 ideal-int
+pkg p1, const ConstChase2 = 11
 pkg p1, const ConstChase2 ideal-int
+pkg p1, const ConversionConst = 5
 pkg p1, const ConversionConst MyInt
+pkg p1, const FloatConst = 3/2
 pkg p1, const FloatConst ideal-float
+pkg p1, const StrConst = "foo"
 pkg p1, const StrConst ideal-string
 pkg p1, func Bar(int8, int16, int64)
 pkg p1, func Bar1(int8, int16, int64) uint64