public override void Bind(IntermediateBuilder context) { _op1.Bind(context); _op2.Bind(context); CodeType wideType = _op1.Type.GetWiderType(_op2.Type); if (wideType is UserType) { var user = UserType.ToUserType(wideType); var overload = user.GetOperatorOverload(Op, context); if (overload != null) { _overload = new InterCall(overload, new CodeValue[] { _op1, _op2 }, true); _overload.SetOwner(Owner); _overload.Bind(context); return; } } if (_op1.Type != wideType) { _op1 = new ConvertedValue(_op1, wideType, Owner); _op1.Bind(context); } if (_op2.Type != wideType) { _op2 = new ConvertedValue(_op2, wideType, Owner); _op2.Bind(context); } }
public override void Bind(IntermediateBuilder context) { base.Bind(context); _op1.Bind(context); _op2.Bind(context); _exp.Bind(context); }
public override void Bind(IntermediateBuilder context) { base.Bind(context); if (hasValue) { _exp.Bind(context); } }
public override void Bind(IntermediateBuilder context) { base.Bind(context); if (_rank == null) { foreach (var e in _entries) { e.Bind(context); } _rank = new CodeValue(BasicType.Int32, _entries.Length); } _rank.Bind(context); _typeof = _type == TypeName.Unknown ? new ArrayType(_entries[0].Type) : (ArrayType)context.ResolveType(_type); }
public override void Bind(IntermediateBuilder context) { if (_type != null) { return; } base.Bind(context); _owner.Bind(context); _param.Bind(context); _valType = _param.Type; _type = GenericType.NewGenericType(UserType.ToUserType(context.ResolveType(new BasicTypeName("System.Collections.Generic.IEnumerator`1"))), new CodeType[] { _valType }); CodeType ownerType = GenericType.NewGenericType(UserType.ToUserType(context.ResolveType(new BasicTypeName("System.Collections.Generic.IEnumerable`1"))), new CodeType[] { _valType }); _call = new InterCall("GetEnumerator", new CodeValue[0], true, _owner) { ThisPointerTypeOverride = ownerType }; _call.Bind(context); }
public override void Bind(IntermediateBuilder context) { _source.Bind(context); if (_target == null) { _resolver.SetOwner(Owner); _resolver.CanBeType = false; _resolver.Bind(context); Debug.Assert(_resolver.IsFieldOrProperty); _target = _resolver.GetReferencedFieldOrProperty(); } else { _target.Bind(context); } if (_source.Type.CanAssignTo(_target.Type) != AssignType.CanAssign) { _source = new ConvertedValue(_source, _target.Type, Owner); } }
public override void Bind(IntermediateBuilder context) { base.Bind(context); _val.Bind(context); }
public override void Bind(IntermediateBuilder context) { if (_method == null) { foreach (var p in _parameters) { p.Bind(context); } _thisPtr?.Bind(context); if (_resolver != null) { _resolver.SetOwner(Owner); _resolver.Bind(context); _staticCall = _resolver.IsStatic; if (!_staticCall) { _thisPtr = _resolver.GetReferencedFieldOrProperty(); } } CodeType type; if (_staticCall) { type = _resolver.Type; } else if (_thisPtr == null) { if (!_baseAccess) { type = new InterUserType(Owner.Owner); } else { type = UserType.ToUserType(Owner.Owner.BaseType); } } else { if (!_baseAccess) { type = _thisPtr.Type; } else { type = UserType.ToUserType(_thisPtr.Type).GetBaseType(); } } CodeType searchType; if (ThisPointerTypeOverride != null) { searchType = ThisPointerTypeOverride; } else if (ThisPointerTypeNameOverride != TypeName.Unknown) { searchType = context.ResolveType(ThisPointerTypeNameOverride); } else { searchType = type; } _method = context.FindClosestFunction(_targetName, searchType, _parameters); } _return = _method.ReturnType; for (int i = 0; i < _parameters.Length; i++) { if (_parameters[i].Type.CanAssignTo(_method.Arguments[i].StoredType) == AssignType.CanAssign) { continue; } _parameters[i] = new ConvertedValue(_parameters[i], _method.Arguments[i].StoredType, Owner); _parameters[i].Bind(context); } _valueType = _thisPtr != null && ((_thisPtr.Type is UserType && (_thisPtr.Type as UserType).ValueType) || _thisPtr.IsSymbol() && _thisPtr.Type is BasicType); if (_thisPtr == null) { return; } if (_thisPtr.Type is UserType && (_thisPtr.Type as UserType).ValueType) { _valueType = true; } if (_method.IsInstance && !_thisPtr.IsSymbol() && _thisPtr.Type is BasicType) { if (_thisPtr.ToSymbol() == null) { _valueType = true; LocalSymbol l = new LocalSymbol("locl" + Owner.Locals.Count, _thisPtr.Type, Owner.Locals.Count); Owner.Locals.Add(l); _symbolConversion = new InterCopy(l, _thisPtr); _symbolConversion.SetOwner(Owner); _symbolConversion.Bind(context); _thisPtr = l; } else { _thisPtr = _thisPtr.ToSymbol(); } } }