dot returns the type of "typ.name", making its decision using the type information in cfg.
(cfg *TypeConfig, name string)
| 104 | // dot returns the type of "typ.name", making its decision |
| 105 | // using the type information in cfg. |
| 106 | func (typ *Type) dot(cfg *TypeConfig, name string) string { |
| 107 | if typ.Field != nil { |
| 108 | if t := typ.Field[name]; t != "" { |
| 109 | return t |
| 110 | } |
| 111 | } |
| 112 | if typ.Method != nil { |
| 113 | if t := typ.Method[name]; t != "" { |
| 114 | return t |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | for _, e := range typ.Embed { |
| 119 | etyp := cfg.Type[e] |
| 120 | if etyp != nil { |
| 121 | if t := etyp.dot(cfg, name); t != "" { |
| 122 | return t |
| 123 | } |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | return "" |
| 128 | } |
| 129 | |
| 130 | // typecheck type checks the AST f assuming the information in cfg. |
| 131 | // It returns two maps with type information: |