mirror of
https://github.com/golang/go
synced 2024-11-25 01:57:56 -07:00
- removed CompoundStat in favor of Block
SVN=112111
This commit is contained in:
parent
8b212f67ff
commit
213702a3e6
@ -210,11 +210,11 @@ productions are in CamelCase.
|
|||||||
Common productions
|
Common productions
|
||||||
----
|
----
|
||||||
|
|
||||||
IdentifierList = identifier { ',' identifier }.
|
IdentifierList = identifier { ',' identifier } .
|
||||||
ExpressionList = Expression { ',' Expression }.
|
ExpressionList = Expression { ',' Expression } .
|
||||||
|
|
||||||
QualifiedIdent = [ PackageName '.' ] identifier.
|
QualifiedIdent = [ PackageName '.' ] identifier .
|
||||||
PackageName = identifier.
|
PackageName = identifier .
|
||||||
|
|
||||||
|
|
||||||
Source code representation
|
Source code representation
|
||||||
@ -713,7 +713,11 @@ Function Literals
|
|||||||
Function literals represent anonymous functions.
|
Function literals represent anonymous functions.
|
||||||
|
|
||||||
FunctionLit = FunctionType Block .
|
FunctionLit = FunctionType Block .
|
||||||
Block = CompoundStat .
|
Block = '{' [ StatementList [ ';' ] ] '}' .
|
||||||
|
|
||||||
|
The scope of an identifier declared within a block extends
|
||||||
|
from the declaration of the identifier (that is, the position
|
||||||
|
immediately after the identifier) to the end of the block.
|
||||||
|
|
||||||
A function literal can be invoked
|
A function literal can be invoked
|
||||||
or assigned to a variable of the corresponding function pointer type.
|
or assigned to a variable of the corresponding function pointer type.
|
||||||
@ -1094,7 +1098,7 @@ Statements control execution.
|
|||||||
[ LabelDecl ] ( StructuredStat | UnstructuredStat ) .
|
[ LabelDecl ] ( StructuredStat | UnstructuredStat ) .
|
||||||
|
|
||||||
StructuredStat =
|
StructuredStat =
|
||||||
CompoundStat | IfStat | SwitchStat | ForStat | RangeStat .
|
Block | IfStat | SwitchStat | ForStat | RangeStat .
|
||||||
|
|
||||||
UnstructuredStat =
|
UnstructuredStat =
|
||||||
Declaration |
|
Declaration |
|
||||||
@ -1135,20 +1139,6 @@ IncDec statements
|
|||||||
Note that ++ and -- are not operators for expressions.
|
Note that ++ and -- are not operators for expressions.
|
||||||
|
|
||||||
|
|
||||||
Compound statements
|
|
||||||
----
|
|
||||||
|
|
||||||
CompoundStat = '{' [ StatementList [ ";" ] ] '}' .
|
|
||||||
|
|
||||||
{
|
|
||||||
x := 1;
|
|
||||||
f(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
The scope of an Identifier declared within a compound statement extends
|
|
||||||
from the declaration to the end of the compound statement.
|
|
||||||
|
|
||||||
|
|
||||||
Assignments
|
Assignments
|
||||||
----
|
----
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user