public override Slot CreateSlot(Slot instance) { Debug.Assert(instance != null && typeof(CodeContext).IsAssignableFrom(instance.Type)); Slot slot = new LocalNamedFrameSlot(instance, _name); if (_type != slot.Type) { slot = new CastSlot(slot, _type); } return slot; }
public override Slot CreateSlot(Slot instance) { var sym = SymbolTable.IdToString(_name); Slot s = new FieldSlot(instance, _storageType.GetField(sym)); if (_type != s.Type) { s = new CastSlot(s, _type); } return s; }
public override Slot CreateSlot(Slot instance) { Debug.Assert(instance != null && typeof(CodeContext).IsAssignableFrom(instance.Type)); Slot slot = new LocalNamedFrameSlot(instance, _name); if (_type != slot.Type) { slot = new CastSlot(slot, _type); } return(slot); }
public override Slot CreateSlot(Slot instance) { var sym = SymbolTable.IdToString(_name); Slot s = new FieldSlot(instance, _storageType.GetField(sym)); if (_type != s.Type) { s = new CastSlot(s, _type); } return(s); }
public override Slot CreateSlot(Slot instance) { Slot slot = instance; Type curType = null; foreach (PropertyInfo pi in Tuple.GetAccessPath(_tupleType, _index)) { slot = new PropertySlot(slot, pi); curType = pi.PropertyType; } if (_type != curType) { slot = new CastSlot(slot, _type); } return(slot); }
public Slot AddData(object data, Type type) { Slot result; if (IsBound) { _data.Add(data); _types.Add(type); result = new IndexSlot(_dataSlot, _data.Count - 1); if (type != typeof(object)) { // Use a CastSlot around an IndexSlot since we just want a cast and not a full conversion result = new CastSlot(result, type); } } else { int index = AddStaticData(data); result = _cg.TypeGen.AddStaticField(type, "#SlotStorage" + index.ToString()); } return(result); }
public Slot AddData(object data, Type type) { Slot result; if (IsBound) { _data.Add(data); _types.Add(type); result = new IndexSlot(_dataSlot, _data.Count - 1); if (type != typeof(object)) { // Use a CastSlot around an IndexSlot since we just want a cast and not a full conversion result = new CastSlot(result, type); } } else { int index = AddStaticData(data); result = _cg.TypeGen.AddStaticField(type, "#SlotStorage" + index.ToString()); } return result; }
public override Slot CreateSlot(Slot instance) { Slot slot = instance; Type curType = null; foreach (PropertyInfo pi in Tuple.GetAccessPath(_tupleType, _index)) { slot = new PropertySlot(slot, pi); curType = pi.PropertyType; } if (_type != curType) { slot = new CastSlot(slot, _type); } return slot; }
private Slot GetArgumentSlot(CodeGen cg) { Slot arg; if (_block != null && _block.ParameterArray) { // If not part of parameter array, get the normal parameter slot if (!_parameterArray) { arg = cg.GetArgumentSlot(_parameter); } else { Debug.Assert(cg.ParamsSlot != null); Debug.Assert(cg.ParamsSlot.Type == typeof(object[])); arg = new IndexSlot(cg.ParamsSlot, _parameter); if (_type != typeof(object)) { arg = new CastSlot(arg, _type); } } } else { arg = cg.GetArgumentSlot(_parameter); } return arg; }