summaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorJeremiah Harmsen <jeremiah@google.com>2013-05-06 10:15:16 -0700
committerJeremiah Harmsen <jeremiah@google.com>2013-05-06 10:15:16 -0700
commitfe2ebdda0392f6a9f39ce56a1818d15224bf98e6 (patch)
tree4039690be4a8177cf62f92c4c0af5184d8d19ac1 /api
parented171f670aa02e254ccc6659d814e35e33836ca6 (diff)
downloadgo-fe2ebdda0392f6a9f39ce56a1818d15224bf98e6.tar.gz
go/doc/example: Fix bug causing false negatives for Example playability.
Allows Examples with KeyValue expressions to be playable in godoc. During the traversal of the abstract syntax tree any KeyValueExpr Key.Name was incorrectly being added as an unresolved identifier. Since this identifier could not be provided the Example was marked as unplayable. This updates the AST traversal to skip Keys (but continue traversing the Values). Example of problematic AST now fixed (see L99 where "UpperBound" was being added as a missing identifier): 81 . . . . . . . . . Values: []ast.Expr (len = 1) { 82 . . . . . . . . . . 0: *ast.UnaryExpr { 83 . . . . . . . . . . . OpPos: 12:19 84 . . . . . . . . . . . Op: & 85 . . . . . . . . . . . X: *ast.CompositeLit { 86 . . . . . . . . . . . . Type: *ast.SelectorExpr { 87 . . . . . . . . . . . . . X: *ast.Ident { 88 . . . . . . . . . . . . . . NamePos: 12:20 89 . . . . . . . . . . . . . . Name: "t_proto" 90 . . . . . . . . . . . . . } 91 . . . . . . . . . . . . . Sel: *ast.Ident { 92 . . . . . . . . . . . . . . NamePos: 12:41 93 . . . . . . . . . . . . . . Name: "BConfig" 94 . . . . . . . . . . . . . } 95 . . . . . . . . . . . . } 96 . . . . . . . . . . . . Lbrace: 12:79 97 . . . . . . . . . . . . Elts: []ast.Expr (len = 2) { 98 . . . . . . . . . . . . . 0: *ast.KeyValueExpr { 99 . . . . . . . . . . . . . . Key: *ast.Ident { 100 . . . . . . . . . . . . . . . NamePos: 13:3 101 . . . . . . . . . . . . . . . Name: "UpperBound" 102 . . . . . . . . . . . . . . } 103 . . . . . . . . . . . . . . Colon: 13:13 104 . . . . . . . . . . . . . . Value: *ast.CallExpr { 105 . . . . . . . . . . . . . . . Fun: *ast.SelectorExpr { 106 . . . . . . . . . . . . . . . . X: *ast.Ident { 107 . . . . . . . . . . . . . . . . . NamePos: 13:15 108 . . . . . . . . . . . . . . . . . Name: "proto" 109 . . . . . . . . . . . . . . . . } 110 . . . . . . . . . . . . . . . . Sel: *ast.Ident { 111 . . . . . . . . . . . . . . . . . NamePos: 13:21 112 . . . . . . . . . . . . . . . . . Name: "Float32" 113 . . . . . . . . . . . . . . . . } R=adg CC=gobot, golang-dev, gri https://codereview.appspot.com/8569045 Committer: Andrew Gerrand <adg@golang.org>
Diffstat (limited to 'api')
0 files changed, 0 insertions, 0 deletions