-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase_verb.go
More file actions
53 lines (40 loc) · 1.15 KB
/
base_verb.go
File metadata and controls
53 lines (40 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package main
import "go/ast"
type baseVerbPhrase struct {
verb VerbDefinition
idef *InterfaceDefinition
field *ast.Field
}
// Verb is part of the VerbPhrase interface.
func (vp *baseVerbPhrase) Tag() string {
return vp.verb.Tag()
}
// Verb is part of the VerbPhrase interface.
func (vp *baseVerbPhrase) Verb() VerbDefinition {
return vp.verb
}
// InterfaceDefinition is part of the VerbPhrase interface.
func (vp *baseVerbPhrase) InterfaceDefinition() *InterfaceDefinition {
return vp.idef
}
// Field is part of the VerbPhrase interface.
func (vp *baseVerbPhrase) Field() *ast.Field {
return vp.field
}
func (vp *baseVerbPhrase) MethodName() string {
return vp.field.Names[0].Name
}
func (vp *baseVerbPhrase) InterfaceName() string {
return vp.InterfaceDefinition().InterfaceName
}
func (vp *baseVerbPhrase) StructName() string {
return vp.InterfaceDefinition().StructName()
}
func (vp *baseVerbPhrase) MethodParameters() string {
panic("MethodParameters called on a VerbPhrase that doesn't support it.")
return ""
}
func (vp *baseVerbPhrase) MethodResults() string {
panic("MethodResults called on a VerbPhrase that doesn't support it.")
return ""
}