Skip to content

Commit 2da3dc1

Browse files
committed
allow both "Builtin" and "builtin" when parsing methods
1 parent 20136d0 commit 2da3dc1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

class.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ func (c *Class) MatchName(str string) bool {
2222
return c.Name == str || (strings.Contains(str, c.Name) && strings.Contains(str, "Object"))
2323
}
2424

25-
func (c *Class) MatchBuiltInMethods(str string) bool {
25+
func (c *Class) MatchInstanceMethods(str string) bool {
26+
return (strings.Contains(str, "builtin") || strings.Contains(str, "Builtin")) && strings.Contains(str, "Methods")
27+
}
28+
29+
func (c *Class) MatchClassMethods(str string) bool {
2630
return strings.Contains(str, "builtin") && strings.Contains(str, "Methods")
2731
}
2832

parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func classFromFile(filepath string) Class {
6060
class.Line = fset.Position(node.NamePos).Line
6161
}
6262
// Assign methods if found
63-
if vSpec, ok := spec.(*ast.ValueSpec); ok && class.MatchBuiltInMethods(vSpec.Names[0].Name) {
63+
if vSpec, ok := spec.(*ast.ValueSpec); ok && class.MatchInstanceMethods(vSpec.Names[0].Name) {
6464
methods = vSpec
6565
}
6666
}

0 commit comments

Comments
 (0)