mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 16:32:11 +01:00
Reserve the "ideal" name.
Also reject using built-in names as struct or func names.
This commit is contained in:
1 parent
567e6f7459
commit
a8a246be7c
3 files changed
+17
-8
No files matched your search
@@ -67,6 +67,14 @@ func (p *parser) parseTopLevelDecl() (*a.Node, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if id0 != 0 && id0.IsBuiltIn() {
|
||||
return nil, fmt.Errorf("parse: built-in %q used for func receiver at %s:%d",
|
||||
p.m.ByID(id0), p.filename, p.line())
|
||||
}
|
||||
if id1.IsBuiltIn() {
|
||||
return nil, fmt.Errorf("parse: built-in %q used for func name at %s:%d",
|
||||
p.m.ByID(id1), p.filename, p.line())
|
||||
}
|
||||
if p.peekID() == t.IDQuestion {
|
||||
flags |= a.FlagsSuspendible
|
||||
p.src = p.src[1:]
|
||||
@@ -97,6 +105,10 @@ func (p *parser) parseTopLevelDecl() (*a.Node, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if name.IsBuiltIn() {
|
||||
return nil, fmt.Errorf("parse: built-in %q used for struct name at %s:%d",
|
||||
p.m.ByID(name), p.filename, p.line())
|
||||
}
|
||||
if p.peekID() == t.IDQuestion {
|
||||
flags |= a.FlagsSuspendible
|
||||
p.src = p.src[1:]
|
||||
|
||||
Reference in new issue
Block a user