public virtual ResolvedVariable ResolveMethodFunction(CStructType structType, CStructMethod method) { var r = ParentContext?.ResolveMethodFunction(structType, method); if (r != null) { return(r); } throw new Exception("Cannot resolve method function"); }
public override ResolvedVariable ResolveMethodFunction(CStructType structType, CStructMethod method) { if (method.MemberType is CFunctionType ftype) { var nameContext = structType.Name; var funcs = Executable.Functions.Select((f, i) => (f, i)).Where(x => x.Item1.NameContext == nameContext && x.Item1.Name == method.Name); for (var i = 0; i < Executable.Functions.Count; i++) { var f = Executable.Functions[i]; if (f.NameContext == nameContext && f.Name == method.Name && f.FunctionType.ParameterTypesEqual(ftype)) { return(new ResolvedVariable(f, i)); } } } Report.Error(9000, $"No definition for '{structType.Name}::{method.Name}' found"); return(new ResolvedVariable(UnresolvedMethod(structType.Name, method.Name), 0)); }
public virtual ResolvedVariable ResolveMethodFunction(CStructType structType, CStructMethod method) { return(null); }