Check struct declarations.

This commit is contained in:
Nigel Tao committed 2017-05-13 15:36:37 +10:00
1 parent e87ff7163b
commit f7095028f0
3 files changed
+73 -17

No files matched your search

+5 -3
View File
@@ -215,9 +215,11 @@ func (c *typeChecker) checkExprOther(n *a.Expr) error {
return nil
case id1.IsIdent():
if typ, ok := c.typeMap[id1]; ok {
n.SetMType(typ)
return nil
if c.typeMap != nil {
if typ, ok := c.typeMap[id1]; ok {
n.SetMType(typ)
return nil
}
}
// TODO: look for (global) names (constants, funcs, structs).
return fmt.Errorf("check: unrecognized identifier %q", c.idMap.ByID(id1))