public GamaCompiledFunctionRef FindFunction(GamaTypeRef ret, GamaTypeRef[] paramtypes) { foreach (var cb in Callbacks) { if (cb.ParameterTypes.Length != paramtypes.Length) { continue; } if (cb.ReturnType != ret) { continue; } bool found = true; for (int i = 0; i < paramtypes.Length; i++) { if (cb.ParameterTypes[i] != paramtypes[i]) { found = false; break; } } if (found) { return(cb); } } return(null); }
public GamaTypeRef(string name, LLVMTypeRef type, GamaTypeRef parent) { ID = id++; Name = name; Parent = parent; UnderlyingType = type; Meta = new GamaMetaRef(this); }
public GamaFunctionRef(GamaTypeRef ret, GamaParamList parms, GamaTypeRef ty, LLVMValueRef val, bool ismethod) : base(ty, val, true) { Blocks = new List <ObjectGroup <GamaBlockRef> >(); ReturnType = ret; Parameters = parms; Attributes = new GamaAttributeSet(); IsMethod = ismethod; }
public bool Add(string name, GamaTypeRef type) { if (Parameters.Find(p => p.Name == name) != null) { return(false); } Parameters.Add(new GamaParamRef((uint)Parameters.Count, name, type)); return(true); }
public GamaMetaRef(GamaTypeRef parent) { Parent = parent; Operators = new GamaOperatorList(); CompiledOperators = new GamaOperatorListCompiled(); Methods = new List <GamaFunctionList>(); Fields = new List <GamaFieldRef>(); Constructors = new GamaFunctionList(".new"); }
public bool IsSubtypeOf(GamaTypeRef r) { var p = this; while (p != null) { if (p == r) { return(true); } p = p.Parent; } return(false); }
public GamaFunctionRef FindFunction(GamaTypeRef ret, GamaTypeRef[] parms, bool skipHidden = false) { foreach (var cb in Callbacks) { if (cb.Parameters.Count != parms.Length) { continue; } if (cb.ReturnType != ret) { continue; } bool found = true; for (int i = 0; i < parms.Length; i++) { if (cb.Parameters[i].Type != parms[i]) { found = false; break; } } if (found) { // Skipping hidden types are useful for hiding some functions from other namespaces // This won't stop this type from apparing in same namespace tho if (skipHidden && cb.HasAttribute("hide")) { continue; } else { return(cb); } } } return(null); }
public GamaValueRef(GamaTypeRef type, LLVMValueRef value, bool ismodlval) { Type = type; Value = value; IsModifiableLValue = ismodlval; }
public GamaFieldRef(string name, int idx, GamaTypeRef type) { Name = name; Index = idx; Type = type; }
public GamaCompiledFunctionRef(GamaTypeRef ret, GamaTypeRef[] paramtypes, GamaCompiledFunctionDelegate cb) { ReturnType = ret; ParameterTypes = paramtypes; Callback = cb; }
// Overridable compatible definitions // Useful for libraries that don't know each other // And custom compatible implementations public virtual bool Compatible(GamaTypeRef other) { return(this == other); }
public GamaParamRef(string name, GamaTypeRef type) { Name = name; Type = type; }
public GamaParamRef(uint index, string name, GamaTypeRef type) { Index = index; Name = name; Type = type; }