mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-21 08:47:28 +01:00
Add wuffs_foo__bar__initialize methods
This commit is contained in:
1 parent
10ead58e2e
commit
8794a586ac
10 files changed
+348
-103
No files matched your search
@@ -24,6 +24,7 @@ import (
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
AllowBuiltInNames bool
|
||||
AllowDoubleUnderscoreNames bool
|
||||
}
|
||||
|
||||
@@ -156,6 +157,13 @@ func (p *parser) parseTopLevelDecl() (*a.Node, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !p.opts.AllowBuiltInNames {
|
||||
switch id1 {
|
||||
case t.IDInitialize, t.IDReset:
|
||||
return nil, fmt.Errorf(`parse: cannot have a method named %q at %s:%d`,
|
||||
id1.Str(p.tm), p.filename, p.line())
|
||||
}
|
||||
}
|
||||
// TODO: should we require id0 != 0? In other words, always methods
|
||||
// (attached to receivers) and never free standing functions?
|
||||
if !p.opts.AllowDoubleUnderscoreNames && isDoubleUnderscore(p.tm.ByID(id1)) {
|
||||
|
||||
Reference in new issue
Block a user