Example #1
0
 public MidVar(
     Identifier name,
     MidType type)
 {
     _name = name;
     _type = type;
 }
Example #2
0
        public MidAttributeDecl CacheAttr(
            MidExp exp,
            MidType type)
        {
            MidAttributeDecl attrDecl = null;

            if (_attrCache.TryGetValue(exp, out attrDecl))
            {
                return(attrDecl);
            }

            if (exp is MidAttributeRef)
            {
                var attrRef = (MidAttributeRef)exp;
                attrDecl = attrRef.Decl;
                if (attrDecl.Element == this && attrDecl.Exp != null)
                {
                    _attrCache[exp] = attrDecl;
                    return(attrDecl);
                }
            }

            attrDecl = new MidAttributeDecl(
                _name.Factory.unique("attr"),
                this,
                type,
                exp);
            _attrCache[exp] = attrDecl;
            AddAttribute(attrDecl);
            return(attrDecl);
        }
Example #3
0
 public MidStructVal(
     SourceRange range,
     MidType type,
     IEnumerable <MidExp> fieldVals)
     : base(range, type)
 {
     _fieldVals = fieldVals.ToArray();
 }
Example #4
0
        public MidLit Lit <T>(SourceRange range, T value, MidType type)
        {
            var lits = (MidLitFactory <T>)_litFactories.Cache(
                typeof(T),
                () => (MidLitFactory) new MidLitFactory <T>());

            return(lits.Lit(range, value, type));
        }
Example #5
0
        public static ISpan Dump(
            this MidType type)
        {
            var span = new Span();

            type.Dump(span);
            return(span);
        }
Example #6
0
 public MidLabelExp(
     SourceRange range,
     MidLabel label,
     MidExp body,
     MidType type)
     : base(range, type)
 {
     _label = label;
     _body  = body;
 }
Example #7
0
        public T MaybeMoveTemp <T>(MidExp exp, MidType type)
            where T : MidExp
        {
            if (exp is T)
            {
                return((T)exp);
            }

            return((T)(MidExp)CreateTemp(exp, type));
        }
Example #8
0
 public MidAttributeRef(
     SourceRange range,
     MidType type,
     ILazy <MidAttributeDecl> decl)
     : base(range, new MidDummyType())
 {
     _type   = Lazy.Value(type);
     _decl   = decl;
     _isLazy = true;
 }
Example #9
0
 private AttributeInfo GenerateInputElementsImpl(
     SourceRange range,
     string name,
     MidType type,
     int vertexStream,
     AttributeInfo index,
     UInt32 baseOffset)
 {
     throw OperationTooComplex(range);
 }
Example #10
0
 public MidExp(
     SourceRange range,
     MidType type)
 {
     if (type == null)
     {
         throw new ArgumentNullException("type");
     }
     _range = range;
     _type  = type;
 }
Example #11
0
 public MidAttributeFetch(
     SourceRange range,
     MidPath obj,
     MidType type,
     ILazy <MidAttributeDecl> attribute)
     : base(range, new MidDummyType())
 {
     _obj       = obj;
     _type      = Lazy.Value(type);
     _attribute = attribute;
 }
Example #12
0
 public MidAttributeDecl(
     Identifier name,
     MidElementDecl element,
     MidType type,
     MidExp exp)
 {
     _name    = name;
     _element = element;
     _type    = type;
     _exp     = exp;
 }
 public MidAttributeFetch(
     SourceRange range,
     MidPath obj,
     MidType type,
     ILazy<MidAttributeDecl> attribute)
     : base(range, new MidDummyType())
 {
     _obj = obj;
     _type = Lazy.Value(type);
     _attribute = attribute;
 }
 public MidAttributeDecl(
     Identifier name,
     MidElementDecl element,
     MidType type,
     MidExp exp )
 {
     _name = name;
     _element = element;
     _type = type;
     _exp = exp;
 }
Example #15
0
        private MidExp EmitAttrExp(
            MidElementDecl midElement,
            MidType midType,
            IResExp resExp,
            MidEmitEnv env)
        {
            var savedElement = _currentElement;

            _currentElement = midElement;

            var result = EmitLocalExp(resExp, env, midElement);

            _currentElement = savedElement;

            return(result);
        }
Example #16
0
 private AttributeInfo GenerateInputElements(
     SourceRange range,
     string name,
     MidType type,
     int vertexStream,
     AttributeInfo index,
     UInt32 baseOffset)
 {
     return(GenerateInputElementsImpl(
                range,
                name,
                (dynamic)type,
                vertexStream,
                (IndexSourceInfo)index,
                baseOffset,
                vertexStream));
 }
Example #17
0
        public override MidVal CreateTemp(MidExp exp, MidType type)
        {
            if (_element != null)
            {
                var attrDecl = _element.CacheAttr(exp, type);
                return(_exps.AttributeRef(exp.Range, attrDecl));
            }
            else
            {
                MidVar var = new MidVar(_identifiers.unique("temp"), type);

                Func <MidExp, MidExp> wrapper = (body) => new MidLetExp(exp.Range, var, exp, body);

                _wrappers.Insert(0, wrapper);

                return(new MidVarRef(exp.Range, var));
            }
        }
Example #18
0
    public override int GetHashCode()
    {
        int hashcode = 157;

        unchecked {
            if (__isset.id)
            {
                hashcode = (hashcode * 397) + Id.GetHashCode();
            }
            if (__isset.channelId)
            {
                hashcode = (hashcode * 397) + ChannelId.GetHashCode();
            }
            if (__isset.lastSeq)
            {
                hashcode = (hashcode * 397) + LastSeq.GetHashCode();
            }
            if (__isset.unreadCount)
            {
                hashcode = (hashcode * 397) + UnreadCount.GetHashCode();
            }
            if (__isset.lastModifiedTime)
            {
                hashcode = (hashcode * 397) + LastModifiedTime.GetHashCode();
            }
            if (__isset.status)
            {
                hashcode = (hashcode * 397) + Status.GetHashCode();
            }
            if (__isset.midType)
            {
                hashcode = (hashcode * 397) + MidType.GetHashCode();
            }
            if (__isset.lastMessages)
            {
                hashcode = (hashcode * 397) + TCollections.GetHashCode(LastMessages);
            }
        }
        return(hashcode);
    }
Example #19
0
        private string DeterminedMid(string content, MidType type)
        {
            var matches = Regex.Matches(content, RegexContent, RegexOptions.Multiline | RegexOptions.IgnoreCase).Cast <Match>();

            switch (type)
            {
            case MidType.MaxId:
            default:
            {
                var result = matches.LastOrDefault();
                return(result == null ? "" : result.Groups["Mid"].Value);

                break;
            }

            case MidType.EndId:
            {
                var result = matches.FirstOrDefault();
                return(result == null ? "" : result.Groups["Mid"].Value);

                break;
            }
            }
        }
Example #20
0
 public override MidVal CreateTemp(MidExp exp, MidType type)
 {
     throw new NotImplementedException();
 }
Example #21
0
 public override MidVal CreateTemp(MidExp exp, MidType type)
 {
     return(_parent.CreateTemp(exp, type));
 }
Example #22
0
 public MidLit(
     SourceRange range,
     MidType type)
     : base(range, type)
 {
 }
Example #23
0
 public MidPath(
     SourceRange range,
     MidType type)
     : base(range, type)
 {
 }
Example #24
0
 public abstract MidVal CreateTemp(MidExp exp, MidType type);
Example #25
0
 public SizeInfo GetSizeInfo(MidType type)
 {
     return(GetSizeInfoImpl((dynamic)type));
 }
Example #26
0
 public static void Dump(
     this MidType type,
     Span span)
 {
     DumpTypeImpl((dynamic)type, span);
 }
Example #27
0
 public void Insert(IResTypeParamDecl key, MidType value)
 {
     _types[key] = value;
 }
        public MidAttributeDecl CacheAttr(
            MidExp exp,
            MidType type )
        {
            MidAttributeDecl attrDecl = null;
            if( _attrCache.TryGetValue( exp, out attrDecl ) )
                return attrDecl;

            if( exp is MidAttributeRef )
            {
                var attrRef = (MidAttributeRef) exp;
                attrDecl = attrRef.Decl;
                if( attrDecl.Element == this && attrDecl.Exp != null )
                {
                    _attrCache[ exp ] = attrDecl;
                    return attrDecl;
                }
            }

            attrDecl = new MidAttributeDecl(
                _name.Factory.unique( "attr" ),
                this,
                type,
                exp );
            _attrCache[ exp ] = attrDecl;
            AddAttribute( attrDecl );
            return attrDecl;
        }
Example #29
0
 public MidLabelExp(
     SourceRange range,
     MidLabel label,
     MidExp body,
     MidType type)
     : base(range, type)
 {
     _label = label;
     _body = body;
 }
Example #30
0
 protected UInt32 GetSizeOf(MidType type)
 {
     return(GetSizeInfo(type).Size);
 }
 private AttributeInfo GenerateInputElements(
     SourceRange range,
     string name,
     MidType type,
     int vertexStream,
     AttributeInfo index,
     UInt32 baseOffset)
 {
     return GenerateInputElementsImpl(
         range,
         name,
         (dynamic)type,
         vertexStream,
         (IndexSourceInfo)index,
         baseOffset,
         vertexStream);
 }
Example #32
0
    public override string ToString()
    {
        var  sb      = new StringBuilder("TMessageBox(");
        bool __first = true;

        if (Id != null && __isset.id)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Id: ");
            Id.ToString(sb);
        }
        if (ChannelId != null && __isset.channelId)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("ChannelId: ");
            ChannelId.ToString(sb);
        }
        if (__isset.lastSeq)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("LastSeq: ");
            LastSeq.ToString(sb);
        }
        if (__isset.unreadCount)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("UnreadCount: ");
            UnreadCount.ToString(sb);
        }
        if (__isset.lastModifiedTime)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("LastModifiedTime: ");
            LastModifiedTime.ToString(sb);
        }
        if (__isset.status)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Status: ");
            Status.ToString(sb);
        }
        if (__isset.midType)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("MidType: ");
            MidType.ToString(sb);
        }
        if (LastMessages != null && __isset.lastMessages)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("LastMessages: ");
            LastMessages.ToString(sb);
        }
        sb.Append(")");
        return(sb.ToString());
    }
 private int CountSlots(MidType type)
 {
     return CountSlotsImpl((dynamic)type);
 }
 private AttributeInfo GenerateInputElementsImpl(
     SourceRange range,
     string name,
     MidType type,
     int vertexStream,
     AttributeInfo index,
     UInt32 baseOffset)
 {
     throw OperationTooComplex(range);
 }
 // Emit types
 public ITypeHLSL EmitType(MidType type)
 {
     return EmitTypeImpl((dynamic)type);
 }
 public SizeInfo GetSizeInfo(MidType type)
 {
     return GetSizeInfoImpl((dynamic)type);
 }
Example #37
0
 protected UInt32 GetSizeOfImpl(MidType type)
 {
     return(EmitContext.EmitType(type, null).Size);
 }
Example #38
0
 public MidVar(
     Identifier name,
     MidType type)
 {
     _name = name;
     _type = type;
 }
 protected UInt32 GetSizeOf(MidType type)
 {
     return GetSizeInfo(type).Size;
 }
 protected UInt32 GetSizeOfImpl(MidType type)
 {
     return EmitContext.EmitType(type, null).Size;
 }
Example #41
0
 public IEmitType EmitType(
     MidType midType,
     EmitEnv env)
 {
     return(EmitTypeImpl((dynamic)midType, env));
 }