Inheritance: System.Compiler.ArrayTypeExpression
示例#1
0
        private ZArray VisitArray(ZArray array)
        {
            if (array.IsDynamic)
                WriteStart("array {0}[] ", array.Name.Name);
            else
                WriteStart("array {0}[{1}] ", array.Name.Name, array.Sizes[0]);

            this.VisitTypeReference(array.ElementType);
            WriteFinish(";");

            return array;
        }
示例#2
0
 private ZArray VisitArray(ZArray array)
 {
     array.domainType = this.VisitTypeReference(array.domainType);
     return (ZArray)base.VisitTypeNode((TypeNode)array);
 }
示例#3
0
 private ZArray VisitArray(ZArray array)
 {
     if (array == null) return null;
     ZArray result = (ZArray)base.VisitTypeNode((ArrayType)array);
     result.LowerBounds = (int[])array.LowerBounds.Clone();
     result.Sizes = (int[])array.Sizes.Clone();
     result.domainType = this.VisitTypeNode(array.domainType);
     return result;
 }
示例#4
0
        private ZArray VisitArray(ZArray array)
        {
            array.domainType = this.VisitTypeReference(array.domainType);
            EnumNode en = array.domainType as EnumNode;
            if (en != null)
            {
                array.Sizes = new int[] { en.Members.Count - 1 };
            }

            array.ElementType = this.VisitTypeReference(array.ElementType);
            return (ZArray)base.VisitTypeNode((TypeNode)array);
        }
示例#5
0
        private void GenerateArray(ZArray arrayNode)
        {
            Expression ns = null;
            string arrayStyle = null;

            if (arrayNode == null || arrayNode.domainType == null || arrayNode.ElementType == null)
                return;

            switch (GetTypeClassification(arrayNode.ElementType))
            {
                case TypeClassification.Simple:
                    ns = arrayNode.ElementType.Namespace;
                    arrayStyle = "SimpleArray"; break;
                case TypeClassification.Enum:
                    arrayStyle = "EnumArray"; break;
                case TypeClassification.Struct:
                    arrayStyle = "StructArray"; break;
                case TypeClassification.Heap:
                    if (arrayNode.ElementType == SystemTypes.Object)
                        ns = arrayNode.ElementType.Namespace;
                    arrayStyle = "ComplexArray"; break;
            }
            Class arrayClass = (Class)Templates.GetTypeTemplateByName(arrayStyle);

            if (ns == null)
                ns = new QualifiedIdentifier(new Identifier("Microsoft.Zing"), new Identifier("Application"));

            Replacer.Replace(arrayClass, arrayStyle, arrayNode.Name);
            Replacer.Replace(arrayClass, "_ElementType", new QualifiedIdentifier(ns, arrayNode.ElementType.Name));
            // Replacer.Replace(arrayClass, "_size", new Literal(arrayNode.Sizes[0], SystemTypes.Int32));
            SetTypeId(arrayClass);
            InstallType(arrayClass);
        }
示例#6
0
 private ZArray VisitArray(ZArray array)
 {
     if (array == null) return null;
     ZArray result = (ZArray)base.VisitTypeNode((ArrayType)array);
     return result;
 }