From: Robert Griesemer
Date: Thu, 1 Feb 2018 22:08:45 +0000 (-0800)
Subject: spec: remove need for separate Function production (cleanup)
X-Git-Tag: go1.10rc2~2^2~13
X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=851e98f0ee59d3027ec82363aedc741ad14100f9;p=gostls13.git
spec: remove need for separate Function production (cleanup)
The EBNF production
Function = Signature FunctionBody .
was used in FunctionDecl, MethodDecl, and FunctionLit, but only
for the latter it shortened the syntax slightly.
This change "inlines" Function which simplifies FunctionDecl and
MethodDecl and gets rid of the Function production.
This has no impact on the specified language. Also, the Function
production is never referred to by the prose, so it's safe to
remove it from the spec.
Finally, neither go/ast nor go/parser have a representation of
this production via a corresponding node or parse function, so
no possibly valuable documentation is lost, either.
Change-Id: Ia2875d31c6ec2d2079081ef481e50bad4f43c694
Reviewed-on: https://go-review.googlesource.com/91515
Reviewed-by: Matthew Dempsky
Reviewed-by: Ian Lance Taylor
Reviewed-by: Rob Pike
---
diff --git a/doc/go_spec.html b/doc/go_spec.html
index 33b66cb905..9a166ccdf4 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -1,6 +1,6 @@
@@ -2148,9 +2148,8 @@ to a function.
-FunctionDecl = "func" FunctionName ( Function | Signature ) .
+FunctionDecl = "func" FunctionName Signature [ FunctionBody ] .
FunctionName = identifier .
-Function = Signature FunctionBody .
FunctionBody = Block .
@@ -2196,7 +2195,7 @@ and associates the method with the receiver's base type.
-MethodDecl = "func" Receiver MethodName ( Function | Signature ) .
+MethodDecl = "func" Receiver MethodName Signature [ FunctionBody ] .
Receiver = Parameters .
@@ -2518,7 +2517,7 @@ A function literal represents an anonymous func
-FunctionLit = "func" Function .
+FunctionLit = "func" Signature FunctionBody .