Commit c5c577c1 authored by Robert Griesemer's avatar Robert Griesemer

- minor tweak to composite literal production:

renamed PairExpr -> KeyValueExpr and PairExprList -> KeyValueList
(to match corresponding nodes in AST per rsc' suggestion)

- added a couple of TODOs

R=r,rsc
DELTA=10  (2 added, 0 deleted, 8 changed)
OCL=26837
CL=26840
parent 5019a8db
...@@ -25,7 +25,9 @@ Todo's: ...@@ -25,7 +25,9 @@ Todo's:
[ ] fix "else" part of if statement [ ] fix "else" part of if statement
[ ] cleanup: 6g allows: interface { f F } where F is a function type. [ ] cleanup: 6g allows: interface { f F } where F is a function type.
fine, but then we should also allow: func f F {}, where F is a function type. fine, but then we should also allow: func f F {}, where F is a function type.
[ ] decide if and what to write about evaluation order of tuple assignments
[ ] decide if and what to write about evaluation order of composite literal
elements (single expressions, (key:value) pairs)
Wish list: Wish list:
[ ] enum facility (enum symbols that are not mixable with ints) or some other [ ] enum facility (enum symbols that are not mixable with ints) or some other
...@@ -1885,15 +1887,15 @@ Composite literals construct values for structs, arrays, slices, and maps ...@@ -1885,15 +1887,15 @@ Composite literals construct values for structs, arrays, slices, and maps
and create a new value each time they are evaluated. and create a new value each time they are evaluated.
They consist of the type of the value They consist of the type of the value
followed by a brace-bound list of expressions, followed by a brace-bound list of expressions,
or a list of expression pairs for map literals. or a list of key-value pairs for map literals.
</p> </p>
<pre class="grammar"> <pre class="grammar">
CompositeLit = LiteralType "{" [ ( ExpressionList | ExprPairList ) [ "," ] ] "}" . CompositeLit = LiteralType "{" [ ( ExpressionList | KeyValueList ) [ "," ] ] "}" .
LiteralType = StructType | ArrayType | "[" "..." "]" ElementType | LiteralType = StructType | ArrayType | "[" "..." "]" ElementType |
SliceType | MapType | TypeName . SliceType | MapType | TypeName .
ExprPairList = ExprPair { "," ExprPair } . KeyValueList = KeyValueExpr { "," KeyValueExpr } .
ExprPair = Expression ":" Expression . KeyValueExpr = Expression ":" Expression .
</pre> </pre>
<p> <p>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment