protected void setDefaultValues(IInputValues input) { if (metaValues == null) { metaValues = getMetaValues(getMetaCtor(input)); } Func <string, object, object> _ = delegate(string key, object def) { return(metaValues.ContainsKey(key) ? metaValues[key] : def); }; CallingConvention = (CallingConvention)_("CallingConvention", CallingConvention.Cdecl); ExportName = (string)_("ExportName", null); }
private Stflds getMetaValues(MethodDefinition md) { var ret = new Stflds(); foreach (var inst in md.Body.Instructions) { if (inst.OpCode.Code != Code.Stfld) { continue; } var cv = ctorValues(inst); if (cv.Key != null) { ret[cv.Key] = cv.Value; } } return(ret); }