public static DyTypeInfo GetMixinByCode(int code) { DyTypeInfo mixin = null !; GetMixinByCodeGenerated(code, ref mixin); return(mixin); }
public static DyObject OverloadProhibited(this ExecutionContext ctx, DyTypeInfo typeInfo, string name) { name = Builtins.NameToOperator(name); if (Builtins.IsSetter(name)) { name = $"set {typeInfo.ReflectedTypeName}.{name}"; } else if (name == Builtins.Get) { name = $"{typeInfo.ReflectedTypeName}[]"; } else if (name == Builtins.Set) { name = $"set {typeInfo.ReflectedTypeName}[]"; } else if (name.IndexOfAny(Builtins.OperatorSymbols.ToCharArray()) != -1) { name = $"{typeInfo.ReflectedTypeName} {name}"; } else { name = $"{typeInfo.ReflectedTypeName}.{name}"; } ctx.Error = new(DyError.OverloadProhibited, name); return(Nil); }
protected override DyObject CastOp(ExecutionContext ctx, DyObject self, DyTypeInfo targetType) { if (targetType.ReflectedTypeId == DeclaringUnit.Date.ReflectedTypeId) { return(((DyDateTime)self).GetDate(DeclaringUnit.Date)); } else if (targetType.ReflectedTypeId == DeclaringUnit.Time.ReflectedTypeId) { return(((DyDateTime)self).GetTime(DeclaringUnit.Time)); } return(base.CastOp(ctx, self, targetType)); }
protected override DyObject CastOp(ExecutionContext ctx, DyObject self, DyTypeInfo targetType) { if (targetType.ReflectedTypeId == self.TypeId) { return(self); } var xs = (DyCollection)self; return(targetType.ReflectedTypeId switch { Dy.Tuple => new DyTuple(xs.ToArray()), Dy.Array => new DyArray(xs.ToArray()), Dy.Iterator => DyIterator.Create(xs), Dy.Set => new DySet(new HashSet <DyObject>(xs.ToArray())), _ => base.CastOp(ctx, self, targetType) });
protected override DyObject CastOp(ExecutionContext ctx, DyObject self, DyTypeInfo targetType) => targetType.ReflectedTypeId switch {
internal DyClass(DyTypeInfo type, string ctor, DyTuple fields, DyTuple inits, Unit unit) : base(type.ReflectedTypeId) => (DecType, Constructor, Fields, Inits, DeclaringUnit) = (type, ctor, fields, inits, unit);
static partial void GetMixinByCodeGenerated(int code, ref DyTypeInfo name);
public static DyObject TypeClosed(this ExecutionContext ctx, DyTypeInfo typeInfo) { ctx.Error = new(DyError.TypeClosed, typeInfo.ReflectedTypeName); return(Nil); }
public DyObject Read(ExecutionContext ctx, DyTypeInfo type) => type.ReflectedTypeId switch {