// TODO: I may want to change the requirement that DuckValue needs a // class instances, same with interface instance public DuckValue(ClassInstance obj, InterfaceDefn i) : base(obj, i) { HeronType t = obj.Type; foreach (FunctionDefn f in i.GetAllMethods()) { if (!obj.SupportsFunction(f)) throw new Exception("Failed to duck-type, object of type " + t.GetName() + " does not match interface " + i.GetName()); } }
public bool VerifyImplements(InterfaceDefn i) { foreach (FunctionDefn f in i.GetAllMethods()) { if (!HasFunction(f)) { return(false); } } return(true); }
public bool Implements(InterfaceDefn i) { foreach (FunctionDefn fd in i.GetAllMethods()) { if (!ImplementsMethod(fd)) { return(false); } } return(true); }
// TODO: I may want to change the requirement that DuckValue needs a // class instances, same with interface instance public DuckValue(ClassInstance obj, InterfaceDefn i) : base(obj, i) { HeronType t = obj.Type; foreach (FunctionDefn f in i.GetAllMethods()) { if (!obj.SupportsFunction(f)) { throw new Exception("Failed to duck-type, object of type " + t.GetName() + " does not match interface " + i.GetName()); } } }
public bool Implements(InterfaceDefn i) { foreach (FunctionDefn fd in i.GetAllMethods()) if (!ImplementsMethod(fd)) return false; return true; }