public MetaDataTreeNode(RefType refType, string filePath)
            : base()
        {
            this.RefType = refType;
            this.FilePath = filePath;
            this.FileName = System.IO.Path.GetFileName(filePath);

        }
Ejemplo n.º 2
0
 /// <summary>
 /// Defines how the reference is printed and the order.
 /// </summary>
 /// <param name="refType"></param>
 /// <param name="parts"></param>
 public void AddRefStylePart(RefType refType, Dictionary<RefPart, List<References.RefPartStyle>> parts)
 {
     if (!RefStyle.ContainsKey(refType))
     {
         RefStyle.Add(refType, new Dictionary<RefPart, List<RefPartStyle>>());
     }
     else
     {
         RefStyle[refType] = new Dictionary<RefPart, List<RefPartStyle>>();
     }
     foreach (RefPart s in parts.Keys)
     {
         RefStyle[refType].Add(s, new List<RefPartStyle>());
         foreach (RefPartStyle p in parts[s])
         {
             RefStyle[refType][s].Add(p);
         }
     }
 }
Ejemplo n.º 3
0
        private void TestWeakKeyComparerForRefImplement(RefType leftRefType, RefType rightRefType)
        {
            KeyObject obj = new KeyObject(1);
            var left = CreateObj(obj, leftRefType);
            var right = CreateObj(obj, rightRefType);

            if (leftRefType != RefType.DeadWeak && rightRefType != RefType.DeadWeak)
            {
                Assert.IsTrue(this.comparer.Equals(left, right));
            }
            else
            {
                GC.Collect();
                if (GC.WaitForFullGCComplete() == GCNotificationStatus.Succeeded)
                {
                    Assert.IsFalse(this.comparer.Equals(left, right));
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>Implements the visitor pattern for the type.</summary>
        /// <returns>The implemented visitor pattern.</returns>
        /// <param name="type">The type.</param>
        protected override EdmType VisitType(EdmType type)
        {
            var retType = type;

            if (BuiltInTypeKind.RefType
                == type.BuiltInTypeKind)
            {
                var refType          = (RefType)type;
                var mappedEntityType = (EntityType)VisitType(refType.ElementType);
                if (!ReferenceEquals(refType.ElementType, mappedEntityType))
                {
                    retType = new RefType(mappedEntityType);
                }
            }
            else if (BuiltInTypeKind.CollectionType
                     == type.BuiltInTypeKind)
            {
                var collectionType    = (CollectionType)type;
                var mappedElementType = VisitTypeUsage(collectionType.TypeUsage);
                if (!ReferenceEquals(collectionType.TypeUsage, mappedElementType))
                {
                    retType = new CollectionType(mappedElementType);
                }
            }
            else if (BuiltInTypeKind.RowType
                     == type.BuiltInTypeKind)
            {
                var rowType = (RowType)type;
                List <KeyValuePair <string, TypeUsage> > mappedPropInfo = null;
                for (var idx = 0; idx < rowType.Properties.Count; idx++)
                {
                    var originalProp   = rowType.Properties[idx];
                    var mappedPropType = VisitTypeUsage(originalProp.TypeUsage);
                    if (!ReferenceEquals(originalProp.TypeUsage, mappedPropType))
                    {
                        if (mappedPropInfo == null)
                        {
                            mappedPropInfo = new List <KeyValuePair <string, TypeUsage> >(
                                rowType.Properties.Select(
                                    prop => new KeyValuePair <string, TypeUsage>(prop.Name, prop.TypeUsage)
                                    ));
                        }
                        mappedPropInfo[idx] = new KeyValuePair <string, TypeUsage>(originalProp.Name, mappedPropType);
                    }
                }
                if (mappedPropInfo != null)
                {
                    var mappedProps = mappedPropInfo.Select(propInfo => new EdmProperty(propInfo.Key, propInfo.Value));
                    retType = new RowType(mappedProps, rowType.InitializerMetadata);
                }
            }
            else
            {
                if (!_metadata.TryGetType(type.Name, type.NamespaceName, type.DataSpace, out retType) ||
                    null == retType)
                {
                    throw new ArgumentException(Strings.Cqt_Copier_TypeNotFound(TypeHelpers.GetFullName(type.NamespaceName, type.Name)));
                }
            }

            return(retType);
        }
Ejemplo n.º 5
0
        public bool CheckType(string typeName)
        {
            RefType entity = this.Context.RefType.Where(x => x.Key == typeName).FirstOrDefault();

            return(entity == null ? false : true);
        }
Ejemplo n.º 6
0
        private static void Main(string[] args)
        {
            // https://forms.gle/HNBT2KP2N94dJMTR6 // 실력 확인을 위한 설문조사

            // 변수 생명 주기 : 선언된 괄호 안에서 살아 있다
            {
                int x = 0; // 변수(x)는 괄호가 끝나기 전까지 살아 있다.
            }

            {
                // 선언되기 전에 사용할순 없다.
                //Console.Write(x);

                int x = 0; // 위에 있는 x와 변수 이름이 같지만 에러가 아니다. 괄호 내에 살아 있는 x가 없기 때문이다.
            }// 괄호가 닫힐때 사라진다.

            {
                //함수사용법.
                Method1(1, 2);
                Method1(1, 2, 3);
                Method1(param2: 1, param1: 2);
            }

            {
                //함수 사용법 2 : 반환하고 싶은게 2개 이상일때?
                // 방법1:반환하기 위한 임시 클래스(구조체 생성)
                // 방법2: out파라미터 사용
                int int1 = 2;
                int int2;

                Method2(in int1, out int2, out int int3);
                Console.WriteLine($"int1:{int1}, int2:{int2}, int3:{int3}"); //int1:2, int2:3, int3:4
            }

            //형 변환double 타입의 변수 x를 int타입의 변수 a에 캐스팅하시오
            {
                float f1 = 1.3f;
                int   i1 = (int)f1;
                float f2 = 1.6f;
                int   i2 = (int)f2;

                float f3 = -1.3f;
                int   i3 = (int)f3;
                float f4 = -1.6f;
                int   i4 = (int)f4;
                Console.WriteLine($"i1:{i1}, i2:{i2}, i3:{i3}, i4:{i4}"); // 형변한하면 반올림 되는게 아니라 값이 짤림
            }

            // 문제1
            {
                int answer = (13 % 3) * 3 - 9;
                CountCorrectAnswer("여기답적기", answer);
            }

            // 문제2
            {
                int    x      = 1;
                string answer = $"{x++}, {x}, {++x}, {x}";
                CountCorrectAnswer(" , , , ", answer);
            }

            // 문제3
            {
                int answer = (int)Weekend.Wednesday;
                CountCorrectAnswer("여기답적기", answer);
            }

            // 문제4. || && 사용
            {
                CountCorrectAnswer("여기답적기", Question());

                bool Question()
                {
                    bool isA = true;
                    bool isB = false;
                    bool isC = true;
                    bool isD = false;

                    return(!(((isA && isC) || isB) && ((isA && isB) == isD) == true));
                }
            }

            // 문제 5
            {
            }

            // 문제 6 값타입에서의 대입과 참조타입에서의 대입.
            {
                ValueType v1, v2;
                v1.x = 1;
                v2   = v1;
                v1.x = 2;
                CountCorrectAnswer("여기답적기", v2.x);
                // 값 타입에서의 대입은 값을 복사한다.

                RefType r1 = new RefType(), r2 = new RefType();
                r1.x = 1;
                r2   = r1;
                r1.x = 2;
                CountCorrectAnswer("여기답적기", r2.x);
                // 참조 타입에서의 대입은 주소를 넘겨준다. -> 값을 바꾸면 같은 주소를 보고 있기에 모두 변한다.
            }

            // 문제 7. 함수 기본값 사용, 자식 부모관계에서 형 변환
            {
                Point   a = new Point(10, 20);
                Point   b = new Point3D(10, 20, 30); // 부모 클래스는 자식 클래스를 담을 수 있다.(자식 클래스에 있는 변수는 사용할 수 없다.
                Point3D c = (Point3D)b;
                CountCorrectAnswer("여기답적기", c.z);
            }

            // 문자열 포멧 사용.
            {
                int score = 1000;
                Console.WriteLine($"{score:N}");

                Console.WriteLine(string.Format("{0:N}", score));
            }

            // static을 이해하고 있는가?
            // static(정적) <-> dynamic(동적)
            // static 프로그램 실행시바로 초기화 되어 언제든지 사용할 수 있다
            // dynamic은 프로그램 실행중에 코드가 실행되면 초기화되어 사용된다
            {
                // static 변수 사용.
                {
                    StaticVariableInclude staticVariableInclude = new StaticVariableInclude();
                    staticVariableInclude.normalInt = 1;
                    StaticVariableInclude.staticInt = 2;
                }

                {
                    StaticVariableInclude staticVariableInclude = new StaticVariableInclude();

                    CountCorrectAnswer("여기답적기", staticVariableInclude.normalInt, "일반 변수 생존 주기");
                    CountCorrectAnswer("여기답적기", StaticVariableInclude.staticInt, "Static 변수 생존 주기");
                }
            }

            // static 함수 사용
            {
                StaticMethodInclude staticMethodInclude = new StaticMethodInclude();
                staticMethodInclude.MyNotStaticMethod();

                StaticMethodInclude.MyStaticMethod();
            }

            // 확장 함수 사용
            {
                int score = 1000;
                Console.WriteLine(score.ToNumber());
            }

            // 형식 매개 변수
            {
                //List는 어떻게 모든 타입을 사용할 수 있을까?
                List <int>    intList    = new List <int>();
                List <string> stringList = new List <string>();

                // 우리도 모든 타입을 담는 클래스를 만들어보자.
                AllType <int> intVariable = new AllType <int>();
                intVariable.value = 1;

                AllType <string> stringVariable = new AllType <string>();
                stringVariable.value = "string";
            }

            Console.WriteLine($"맞힌 정답수는 : {correctAnswer}개({correctAnswer / (float)qustionCount * 100})%입니다");
            Console.WriteLine(sb.ToString());
        }
 private object CreateTupleObj(KeyObject obj, RefType RefType)
 {
     switch (RefType)
     {
         case RefType.StrongRef:
             return new Tuple<object, MemberInfo>(obj, this.memberInfo);
         case RefType.AliveWeak:
             return this.comparer.CreateKey(new Tuple<object, MemberInfo>(obj, this.memberInfo));
         default:
             return this.comparer.CreateKey(new Tuple<object, MemberInfo>(this.CreateKeyObj(obj.ID), this.memberInfo));
     }
 }
Ejemplo n.º 8
0
 public override int GetHashCode()
 {
     return(UserId.GetHashCode() ^ GroupId.GetHashCode() ^ Tenant.GetHashCode() ^ RefType.GetHashCode());
 }
Ejemplo n.º 9
0
 private static void AssertRef(Ref r, string id, bool isPacked, string name, string remoteName, Repository repository, RefType refType, string relativePath)
 {
     Assert.AreEqual(id, r.Id);
     Assert.AreEqual(isPacked, r.IsPacked);
     Assert.AreEqual(name, r.Name);
     Assert.AreEqual(remoteName, r.RemoteName);
     Assert.AreEqual(refType, r.Type);
     Assert.AreEqual(relativePath, r.RelativePath);
 }
Ejemplo n.º 10
0
 public RefType RefRefLocal(RefType rt) {
     return m_rt;
 }
Ejemplo n.º 11
0
 public RefType RefRef(RefType rt) {
     return rt;
 }
Ejemplo n.º 12
0
 public void VRef(RefType rt) {
     // do nothing
 }
Ejemplo n.º 13
0
 void CallRemoteLocalRefRef()
 {
     RefType rt = m_testService.RefRefLocal(m_remoteRT);
 }
Ejemplo n.º 14
0
        public static void Main(string[] args)
        {
            // Ну куда же без Hello world
            Console.WriteLine("Hello world!");

            #region Про числа
            // Разные численные типы имеют разные суффиксы:
            int   a1 = 1;
            uint  a2 = 1U;
            long  a3 = 1L;
            ulong a4 = 1UL;

            double  b1 = 1.1;
            float   b2 = 1.1f; // 1.1F
            decimal b3 = 1.1m; // 1.1M

            // Отличия double от decimal
            double a = 0.1;
            double b = 0.2;

            decimal c = 0.1m;
            decimal d = 0.2m;
            Console.WriteLine($"a + b == 0.3? {a + b == 0.3}");
            Console.WriteLine($"c + d == 0.3? {c + d == 0.3m}");
            #endregion

            #region Про типы
            var x1 = new RefType {
                n = 1
            };
            var x2 = new ValueType {
                n = 1
            };
            RefMethod(x1);
            ValueMethod(x2);
            Console.WriteLine($"x1:{x1.n} x2:{x2.n}");
            // В итоге у x1 поменялось значение, а у x2 - нет.
            #endregion

            #region ref и out
            ValueType x3 = x2;
            ValueMethodRef(ref x3);
            ValueMethodOut(out ValueType x4);
            Console.WriteLine($"x3:{x3.n} x4:{x4.n}");

            // Что будет, есть в качестве ref-параметра передать ссылочный тип?
            RefMethodRef(x1);
            Console.WriteLine($"x1:{x1.n}");
            RefMethodRef(ref x1);
            Console.WriteLine($"x1:{x1.n}");
            #endregion

            #region is/as
            int a_is = 5;
            Console.WriteLine($"a is int: {a_is is int}; a is short: {a_is is short}; a is double: {a_is is double}; a is object: {a_is is object}");
            object o    = 5;
            int?   a_as = o as int?;
            if (a_as != null)
            {
                Console.WriteLine($"a as int");
            }
            else
            {
                Console.WriteLine($"a not as int");
            }
            #endregion

            #region Pattern matching
            object ptn = 5;
            switch (ptn)
            {
            case int as_int:
                Console.WriteLine("As int");
                break;

            case string as_string:
                Console.WriteLine("As string");
                break;

            case object as_object:
                Console.WriteLine("As Object");
                break;
                // Попробуем поменять кейсы местами
            }
            #endregion

            #region Контроль переполнения
            byte byteA = 200;
            byte byteB;
            try
            {
                byteB = checked ((byte)(2 * byteA));
                //byteB = unchecked((byte)(2 * byteA));
                //byteB = (byte)checked(2 * byteA);
                Console.WriteLine(byteB);
            } catch (Exception e) {
                Console.WriteLine(e.Message);
            }

            try
            {
                checked
                {
                    byteB = checked ((byte)(2 * byteA));
                    Console.WriteLine(byteB);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            #endregion

            #region Про Nullable
            int?nullable_a = 42;
            Console.WriteLine(nullable_a?.ToString());   // Метод применяется, если объект не null
            int?null_a      = null;
            int x_from_null = null_a ?? nullable_a ?? 5; // как тренарный оператор только про null
            Console.WriteLine($"x={x_from_null}");
            #endregion

            #region Про перечисления
            Color color = Color.Blue;
            Console.WriteLine(color);
            color = (Color)Enum.Parse(typeof(Color), "Red");
            Console.WriteLine(color);
            color = (Color)Enum.Parse(typeof(Color), "0");
            Console.WriteLine(color);

            Permission permission = Permission.Move | Permission.Write;
            Console.WriteLine(permission.ToString());
            #endregion
        }
Ejemplo n.º 15
0
 static void RefMethodRef(RefType x)
 {
     x = new RefType {
         n = 5
     };
 }
Ejemplo n.º 16
0
 static void RefMethod(RefType x)
 {
     x.n += 1;
 }
Ejemplo n.º 17
0
 public static RefType Map(ReferenceTypes.ReferenceType source, RefType target)
 {
     target.Id   = source.RefTypeId;
     target.Name = source.RefTypeName;
     return(target);
 }
Ejemplo n.º 18
0
        public clsMyProperty(PropertyInfo p)
        {
            this.Name = p.Name;

            var attribWmiProp = p.GetCustomAttribute <WmiPropertyNameAttribute>();

            if (attribWmiProp != null)
            {
                this.WmiName      = attribWmiProp.WmiPropertyName;
                this.CustomFormat = attribWmiProp.DateTimeFormat;
            }
            else
            {
                this.WmiName = p.Name;
            }



            this.RefType = p.PropertyType;

            var typename = RefType.Name;

            if (RefType.IsArray)
            {
                this.IsArray  = true;
                this.BaseType = RefType.GetElementType();
                //TODO: get wmi datatype here to enable direct array setting.

                typename = this.BaseType.Name;
            }
            else if (RefType.IsGenericType)
            {
                var g = RefType.GetGenericTypeDefinition();

                if (g.Equals(typeof(Nullable <>)))
                {
                    this.IsNullable = true;
                    this.BaseType   = this.RefType.UnderlyingSystemType;
                    typename        = this.BaseType.Name;
                }
                else if (g.Equals(typeof(List <>)))
                {
                    this.IsList   = true;
                    this.BaseType = RefType.GetGenericArguments().First();
                    typename      = this.BaseType.Name;
                }
                else
                {
                    typename = "INVALID";
                }
            }

            if (RefType.IsEnum)
            {
                this.IsEnum = true;
                //if(this.IsList || this.IsArray)
                //    typename =
                typename = "Enum"; //How handle enum arrays or lists???
            }



            this.CimType = CimType.None;

            switch (typename)
            {
            case "String":
                this.DetailInfo = MyTypeInfoEnum.String;
                this.CimType    = CimType.String;
                break;

            case "Guid":
                this.DetailInfo = MyTypeInfoEnum.Guid;
                break;

            case "DateTime":
                this.DetailInfo = MyTypeInfoEnum.DateTime;
                this.CimType    = CimType.DateTime;
                break;

            case "TimeSpan":
                this.DetailInfo = MyTypeInfoEnum.TimeSpan;
                break;

            case "Version":
                this.DetailInfo = MyTypeInfoEnum.Version;
                break;

            case "Enum":
                this.DetailInfo = MyTypeInfoEnum.Enum;
                break;

            case "UInt16":
                this.DetailInfo = MyTypeInfoEnum.UInt16;
                this.CimType    = CimType.UInt16;
                break;

            case "UInt32":
                this.DetailInfo = MyTypeInfoEnum.UInt32;
                this.CimType    = CimType.UInt32;
                break;

            case "UInt64":
                this.DetailInfo = MyTypeInfoEnum.UInt64;
                this.CimType    = CimType.UInt64;
                break;

            case "Boolean":
                this.DetailInfo = MyTypeInfoEnum.Bool;
                this.CimType    = CimType.Boolean;
                break;

            case "Int16":
                this.DetailInfo = MyTypeInfoEnum.Int16;
                this.CimType    = CimType.SInt16;
                break;

            case "Int32":
                this.DetailInfo = MyTypeInfoEnum.Int32;
                this.CimType    = CimType.SInt32;
                break;

            case "Int64":
                this.DetailInfo = MyTypeInfoEnum.Int64;
                this.CimType    = CimType.SInt64;
                break;

            case "Char":
                this.DetailInfo = MyTypeInfoEnum.Char;
                this.CimType    = CimType.Char16;
                break;

            case "Single":
                this.DetailInfo = MyTypeInfoEnum.Float;
                this.CimType    = CimType.Real32;
                break;

            case "Double":
                this.DetailInfo = MyTypeInfoEnum.Double;
                this.CimType    = CimType.Real64;
                break;

            case "Byte":
                this.DetailInfo = MyTypeInfoEnum.UInt8;
                this.CimType    = CimType.UInt8;
                break;

            case "SByte":
                this.DetailInfo = MyTypeInfoEnum.Int8;
                this.CimType    = CimType.SInt8;
                break;

            default:
                this.DetailInfo = MyTypeInfoEnum.Invalid;
                break;
            }

            this.GenericSetter = Reflection.CompileGenericSetMethod(p.DeclaringType, p);
        }
 private object CreateObj(KeyObject obj, RefType RefType, bool isTupleObject)
 {
     return isTupleObject ? CreateTupleObj(obj, RefType) : CreateKeyObj(obj, RefType);
 }
Ejemplo n.º 20
0
 private static string NameFromType(RefType type)
 {
     switch (type)
     {
         case RefType.Head:
             return Heads;
         case RefType.Remote:
             return Remotes;
         case RefType.Tag:
             return Tags;
         default:
             throw new InvalidOperationException("Invalid RefType specified: " + type);
     }
 }
Ejemplo n.º 21
0
 public RefObj(StackFrame frame, int pos, RefType type)
 {
     this.frame = frame;
     this.pos   = pos;
     this.type  = type;
 }
Ejemplo n.º 22
0
        private static bool UpdateIfType(Ref newRef, string relPath, RefType refType)
        {
            var type = NameFromType(refType);

            if (!relPath.StartsWith(type))
                return false;

            newRef.Type = refType;
            var temp = relPath.Substring(type.Length + 1).Split(new[] { '/', '\\' }, 2);

            newRef.RemoteName = temp[0];
            newRef.Name = relPath.Substring(type.Length + 1);

            return true;
        }
Ejemplo n.º 23
0
 public RefType AddRefType(RefType refType)
 {
     this.Context.RefType.Add(refType);
     this.Context.SaveChanges();
     return(refType);
 }
Ejemplo n.º 24
0
 public override void FromXML(XmlNode node)
 {
     this._guid = node.Attributes["Guid"].Value;
     this._refProjName = node.Attributes["RefProjName"].Value;
     this._refrenceType = (RefType)Enum.Parse(typeof(RefType), node.Attributes["RefrenceType"].Value);
     if (node.Attributes["RefFilePath"] != null)
     {
         this._refFilePath = node.Attributes["RefFilePath"].Value;
     }
     if (string.IsNullOrEmpty(this._refFilePath))
     {
         this._refFilePath = "..\\MetaData\\" + this.RefProjName;
     }
     string fullPath = AppDomain.CurrentDomain.BaseDirectory + this._refFilePath;
     if (File.Exists(fullPath))
     {
         XmlDocument xmlReadDoc = new XmlDocument();
         xmlReadDoc.Load(fullPath);
         string ns = xmlReadDoc.FirstChild.Attributes["namespace"].Value;
         SetDisplayName(ns);
     }
     else
     {
         Exception ex = new Exception("程序集引用元数据文件“" + this._refFilePath + "”不存在");
         OutPut.OutPutMsg(ex.Message);
     }
     this.DataState = Base.DataState.Update;
 }
Ejemplo n.º 25
0
 protected virtual void Visit(RefType refType)
 {
     Visit(refType.BaseType);
     Visit(refType.ElementType);
 }
 private object CreateObj(KeyObject obj, RefType RefType, bool isTupleObject)
 {
     return(isTupleObject ? CreateTupleObj(obj, RefType) : CreateKeyObj(obj, RefType));
 }
Ejemplo n.º 27
0
 public RefType RefRef(RefType rt)
 {
     return(rt);
 }
Ejemplo n.º 28
0
        /// <summary>
        /// Returns an array of size <see cref="TotalSlots"/> which indicates the slots that are needed to constuct value at <paramref name="caseMemberPath"/>,
        /// e.g., CPerson may need pid and name (say slots 2 and 5 - then bools[2] and bools[5] will be true.
        /// </summary>
        /// <param name="caseMemberPath">must be part of <see cref="m_caseStatements"/></param>
        private void GetRequiredSlotsForCaseMember(MemberPath caseMemberPath, bool[] requiredSlots)
        {
            Debug.Assert(true == m_caseStatements.ContainsKey(caseMemberPath), "Constructing case for regular field?");
            Debug.Assert(requiredSlots.Length == TotalSlots, "Invalid array size for populating required slots");

            CaseStatement statement = m_caseStatements[caseMemberPath];

            // Find the required slots from the when then clause conditions
            // and values
            bool requireThisSlot = false;

            foreach (CaseStatement.WhenThen clause in statement.Clauses)
            {
                clause.Condition.GetRequiredSlots(m_projectedSlotMap, requiredSlots);
                ProjectedSlot slot = clause.Value;
                if (!(slot is ConstantProjectedSlot))
                {
                    // If this slot is a scalar and a non-constant,
                    // we need the lower down blocks to generate it for us
                    requireThisSlot = true;
                }
            }

            EdmType edmType = caseMemberPath.EdmType;

            if (Helper.IsEntityType(edmType) || Helper.IsComplexType(edmType))
            {
                foreach (EdmType instantiatedType in statement.InstantiatedTypes)
                {
                    foreach (EdmMember childMember in Helper.GetAllStructuralMembers(instantiatedType))
                    {
                        int slotNum = GetSlotIndex(caseMemberPath, childMember);
                        requiredSlots[slotNum] = true;
                    }
                }
            }
            else if (caseMemberPath.IsScalarType())
            {
                // A scalar does not need anything per se to be constructed
                // unless it is referring to a field in the tree below, i.e., the THEN
                // slot is not a constant slot
                if (requireThisSlot)
                {
                    int caseMemberSlotNum = m_projectedSlotMap.IndexOf(caseMemberPath);
                    requiredSlots[caseMemberSlotNum] = true;
                }
            }
            else if (Helper.IsAssociationType(edmType))
            {
                // For an association, get the indices of the ends, e.g.,
                // CProduct and CCategory in CProductCategory1
                // Need just it's ends
                AssociationSet  associationSet  = (AssociationSet)caseMemberPath.Extent;
                AssociationType associationType = associationSet.ElementType;
                foreach (AssociationEndMember endMember in associationType.AssociationEndMembers)
                {
                    int slotNum = GetSlotIndex(caseMemberPath, endMember);
                    requiredSlots[slotNum] = true;
                }
            }
            else
            {
                // For a reference, all we need are the keys
                RefType refType = edmType as RefType;
                Debug.Assert(refType != null, "What other non scalars do we have? Relation end must be a reference type");

                EntityTypeBase refElementType = refType.ElementType;
                // Go through all the members of elementType and get the key properties

                EntitySet entitySet = MetadataHelper.GetEntitySetAtEnd((AssociationSet)caseMemberPath.Extent,
                                                                       (AssociationEndMember)caseMemberPath.LeafEdmMember);
                foreach (EdmMember entityMember in refElementType.KeyMembers)
                {
                    int slotNum = GetSlotIndex(caseMemberPath, entityMember);
                    requiredSlots[slotNum] = true;
                }
            }
        }
Ejemplo n.º 29
0
 private object CreateObj(KeyObject obj, RefType valueType)
 {
     switch (valueType)
     {
         case RefType.StrongRef:
             return obj;
         case RefType.AliveWeak:
             return new WeakKeyReference<KeyObject>(obj, this.comparer);
         default:
             return new WeakKeyReference<KeyObject>(this.CreateObj(obj.ID), this.comparer);
     }
 }
Ejemplo n.º 30
0
 private static void EmitRefLabel(Token t, RefType type)
 {
     if(t.type==TokenType.Global) {
         EmitByte(0x47);
     } else {
         switch(type) {
         case RefType.Standard: Emit(0x1c); break;
         case RefType.Expression: EmitByte(0x72); break;
         case RefType.Standalone: EmitByte(0x5a); break;
         }
     }
     if(t.type==TokenType.Local) {
         LocalVar var=locals[t.token];
         if(var.refid==0) AddError("Variable was not of type ref");
         else Emit((ushort)var.refid);
     } else if(t.type==TokenType.edid||t.type==TokenType.Global) {
         if(!edidRefs.ContainsKey(t.token)) {
             SubRecord sr=new SubRecord();
             sr.Name="SCRO";
             if(t.type==TokenType.edid) sr.SetData(TypeConverter.i2h(edidList[t.token].Key));
             else sr.SetData(TypeConverter.i2h(globals[t.token]));
             r.AddRecord(sr);
             refcount++;
             edidRefs[t.token]=(ushort)refcount;
         }
         Emit(edidRefs[t.token]);
     } else {
         AddError("Expected ref variable or edid");
     }
 }
Ejemplo n.º 31
0
        private string GetRefText(string refKey, out RefType type)
        {
            string text = GetRefText(refKey);

            string t = Regex.Match(text, @"@(?<t>[^\{\}]+)\{").Groups["t"].Captures[0].Value;

            type = (RefType)Enum.Parse(typeof(RefType), t.ToString());

            return text;
        }
Ejemplo n.º 32
0
        public static Doc Print(SyntaxNode syntaxNode)
        {
            if (syntaxNode == null)
            {
                return(Doc.Null);
            }

            // TODO 0 kill? runtime repo has files that will fail on deep recursion
            if (depth > 200)
            {
                throw new InTooDeepException();
            }

            depth++;
            try
            {
                switch (syntaxNode)
                {
                case AliasQualifiedNameSyntax aliasQualifiedNameSyntax:
                    return(AliasQualifiedName.Print(aliasQualifiedNameSyntax));

                case AnonymousMethodExpressionSyntax anonymousMethodExpressionSyntax:
                    return(AnonymousMethodExpression.Print(anonymousMethodExpressionSyntax));

                case AnonymousObjectCreationExpressionSyntax anonymousObjectCreationExpressionSyntax:
                    return(AnonymousObjectCreationExpression.Print(
                               anonymousObjectCreationExpressionSyntax
                               ));

                case AnonymousObjectMemberDeclaratorSyntax anonymousObjectMemberDeclaratorSyntax:
                    return(AnonymousObjectMemberDeclarator.Print(
                               anonymousObjectMemberDeclaratorSyntax
                               ));

                case ArgumentListSyntax argumentListSyntax:
                    return(ArgumentList.Print(argumentListSyntax));

                case ArgumentSyntax argumentSyntax:
                    return(Argument.Print(argumentSyntax));

                case ArrayCreationExpressionSyntax arrayCreationExpressionSyntax:
                    return(ArrayCreationExpression.Print(arrayCreationExpressionSyntax));

                case ArrayRankSpecifierSyntax arrayRankSpecifierSyntax:
                    return(ArrayRankSpecifier.Print(arrayRankSpecifierSyntax));

                case ArrayTypeSyntax arrayTypeSyntax:
                    return(ArrayType.Print(arrayTypeSyntax));

                case ArrowExpressionClauseSyntax arrowExpressionClauseSyntax:
                    return(ArrowExpressionClause.Print(arrowExpressionClauseSyntax));

                case AssignmentExpressionSyntax assignmentExpressionSyntax:
                    return(AssignmentExpression.Print(assignmentExpressionSyntax));

                case AttributeListSyntax attributeListSyntax:
                    return(AttributeList.Print(attributeListSyntax));

                case AwaitExpressionSyntax awaitExpressionSyntax:
                    return(AwaitExpression.Print(awaitExpressionSyntax));

                case BaseExpressionSyntax baseExpressionSyntax:
                    return(BaseExpression.Print(baseExpressionSyntax));

                case BaseFieldDeclarationSyntax baseFieldDeclarationSyntax:
                    return(BaseFieldDeclaration.Print(baseFieldDeclarationSyntax));

                case BaseListSyntax baseListSyntax:
                    return(BaseList.Print(baseListSyntax));

                case BaseMethodDeclarationSyntax baseMethodDeclarationSyntax:
                    return(BaseMethodDeclaration.Print(baseMethodDeclarationSyntax));

                case BasePropertyDeclarationSyntax basePropertyDeclarationSyntax:
                    return(BasePropertyDeclaration.Print(basePropertyDeclarationSyntax));

                case BaseTypeDeclarationSyntax baseTypeDeclarationSyntax:
                    return(BaseTypeDeclaration.Print(baseTypeDeclarationSyntax));

                case BinaryExpressionSyntax binaryExpressionSyntax:
                    return(BinaryExpression.Print(binaryExpressionSyntax));

                case BinaryPatternSyntax binaryPatternSyntax:
                    return(BinaryPattern.Print(binaryPatternSyntax));

                case BlockSyntax blockSyntax:
                    return(Block.Print(blockSyntax));

                case BracketedArgumentListSyntax bracketedArgumentListSyntax:
                    return(BracketedArgumentList.Print(bracketedArgumentListSyntax));

                case BracketedParameterListSyntax bracketedParameterListSyntax:
                    return(BracketedParameterList.Print(bracketedParameterListSyntax));

                case BreakStatementSyntax breakStatementSyntax:
                    return(BreakStatement.Print(breakStatementSyntax));

                case CasePatternSwitchLabelSyntax casePatternSwitchLabelSyntax:
                    return(CasePatternSwitchLabel.Print(casePatternSwitchLabelSyntax));

                case CaseSwitchLabelSyntax caseSwitchLabelSyntax:
                    return(CaseSwitchLabel.Print(caseSwitchLabelSyntax));

                case CastExpressionSyntax castExpressionSyntax:
                    return(CastExpression.Print(castExpressionSyntax));

                case CatchClauseSyntax catchClauseSyntax:
                    return(CatchClause.Print(catchClauseSyntax));

                case CheckedExpressionSyntax checkedExpressionSyntax:
                    return(CheckedExpression.Print(checkedExpressionSyntax));

                case CheckedStatementSyntax checkedStatementSyntax:
                    return(CheckedStatement.Print(checkedStatementSyntax));

                case ClassOrStructConstraintSyntax classOrStructConstraintSyntax:
                    return(ClassOrStructConstraint.Print(classOrStructConstraintSyntax));

                case CompilationUnitSyntax compilationUnitSyntax:
                    return(CompilationUnit.Print(compilationUnitSyntax));

                case ConditionalAccessExpressionSyntax conditionalAccessExpressionSyntax:
                    return(ConditionalAccessExpression.Print(conditionalAccessExpressionSyntax));

                case ConditionalExpressionSyntax conditionalExpressionSyntax:
                    return(ConditionalExpression.Print(conditionalExpressionSyntax));

                case ConstantPatternSyntax constantPatternSyntax:
                    return(ConstantPattern.Print(constantPatternSyntax));

                case ConstructorConstraintSyntax constructorConstraintSyntax:
                    return(ConstructorConstraint.Print(constructorConstraintSyntax));

                case ConstructorInitializerSyntax constructorInitializerSyntax:
                    return(ConstructorInitializer.Print(constructorInitializerSyntax));

                case ContinueStatementSyntax continueStatementSyntax:
                    return(ContinueStatement.Print(continueStatementSyntax));

                case DeclarationExpressionSyntax declarationExpressionSyntax:
                    return(DeclarationExpression.Print(declarationExpressionSyntax));

                case DeclarationPatternSyntax declarationPatternSyntax:
                    return(DeclarationPattern.Print(declarationPatternSyntax));

                case DefaultConstraintSyntax defaultConstraintSyntax:
                    return(DefaultConstraint.Print(defaultConstraintSyntax));

                case DefaultExpressionSyntax defaultExpressionSyntax:
                    return(DefaultExpression.Print(defaultExpressionSyntax));

                case DefaultSwitchLabelSyntax defaultSwitchLabelSyntax:
                    return(DefaultSwitchLabel.Print(defaultSwitchLabelSyntax));

                case DelegateDeclarationSyntax delegateDeclarationSyntax:
                    return(DelegateDeclaration.Print(delegateDeclarationSyntax));

                case DiscardDesignationSyntax discardDesignationSyntax:
                    return(DiscardDesignation.Print(discardDesignationSyntax));

                case DiscardPatternSyntax discardPatternSyntax:
                    return(DiscardPattern.Print(discardPatternSyntax));

                case DoStatementSyntax doStatementSyntax:
                    return(DoStatement.Print(doStatementSyntax));

                case ElementAccessExpressionSyntax elementAccessExpressionSyntax:
                    return(ElementAccessExpression.Print(elementAccessExpressionSyntax));

                case ElementBindingExpressionSyntax elementBindingExpressionSyntax:
                    return(ElementBindingExpression.Print(elementBindingExpressionSyntax));

                case ElseClauseSyntax elseClauseSyntax:
                    return(ElseClause.Print(elseClauseSyntax));

                case EmptyStatementSyntax emptyStatementSyntax:
                    return(EmptyStatement.Print(emptyStatementSyntax));

                case EnumMemberDeclarationSyntax enumMemberDeclarationSyntax:
                    return(EnumMemberDeclaration.Print(enumMemberDeclarationSyntax));

                case EqualsValueClauseSyntax equalsValueClauseSyntax:
                    return(EqualsValueClause.Print(equalsValueClauseSyntax));

                case ExpressionStatementSyntax expressionStatementSyntax:
                    return(ExpressionStatement.Print(expressionStatementSyntax));

                case ExternAliasDirectiveSyntax externAliasDirectiveSyntax:
                    return(ExternAliasDirective.Print(externAliasDirectiveSyntax));

                case FinallyClauseSyntax finallyClauseSyntax:
                    return(FinallyClause.Print(finallyClauseSyntax));

                case FixedStatementSyntax fixedStatementSyntax:
                    return(FixedStatement.Print(fixedStatementSyntax));

                case ForEachStatementSyntax forEachStatementSyntax:
                    return(ForEachStatement.Print(forEachStatementSyntax));

                case ForEachVariableStatementSyntax forEachVariableStatementSyntax:
                    return(ForEachVariableStatement.Print(forEachVariableStatementSyntax));

                case ForStatementSyntax forStatementSyntax:
                    return(ForStatement.Print(forStatementSyntax));

                case FromClauseSyntax fromClauseSyntax:
                    return(FromClause.Print(fromClauseSyntax));

                case FunctionPointerTypeSyntax functionPointerTypeSyntax:
                    return(FunctionPointerType.Print(functionPointerTypeSyntax));

                case GenericNameSyntax genericNameSyntax:
                    return(GenericName.Print(genericNameSyntax));

                case GlobalStatementSyntax globalStatementSyntax:
                    return(GlobalStatement.Print(globalStatementSyntax));

                case GotoStatementSyntax gotoStatementSyntax:
                    return(GotoStatement.Print(gotoStatementSyntax));

                case GroupClauseSyntax groupClauseSyntax:
                    return(GroupClause.Print(groupClauseSyntax));

                case IdentifierNameSyntax identifierNameSyntax:
                    return(IdentifierName.Print(identifierNameSyntax));

                case IfStatementSyntax ifStatementSyntax:
                    return(IfStatement.Print(ifStatementSyntax));

                case ImplicitArrayCreationExpressionSyntax implicitArrayCreationExpressionSyntax:
                    return(ImplicitArrayCreationExpression.Print(
                               implicitArrayCreationExpressionSyntax
                               ));

                case ImplicitElementAccessSyntax implicitElementAccessSyntax:
                    return(ImplicitElementAccess.Print(implicitElementAccessSyntax));

                case ImplicitObjectCreationExpressionSyntax implicitObjectCreationExpressionSyntax:
                    return(ImplicitObjectCreationExpression.Print(
                               implicitObjectCreationExpressionSyntax
                               ));

                case ImplicitStackAllocArrayCreationExpressionSyntax implicitStackAllocArrayCreationExpressionSyntax:
                    return(ImplicitStackAllocArrayCreationExpression.Print(
                               implicitStackAllocArrayCreationExpressionSyntax
                               ));

                case IncompleteMemberSyntax incompleteMemberSyntax:
                    return(IncompleteMember.Print(incompleteMemberSyntax));

                case InitializerExpressionSyntax initializerExpressionSyntax:
                    return(InitializerExpression.Print(initializerExpressionSyntax));

                case InterpolatedStringExpressionSyntax interpolatedStringExpressionSyntax:
                    return(InterpolatedStringExpression.Print(
                               interpolatedStringExpressionSyntax
                               ));

                case InterpolatedStringTextSyntax interpolatedStringTextSyntax:
                    return(InterpolatedStringText.Print(interpolatedStringTextSyntax));

                case InterpolationSyntax interpolationSyntax:
                    return(Interpolation.Print(interpolationSyntax));

                case InvocationExpressionSyntax invocationExpressionSyntax:
                    return(InvocationExpression.Print(invocationExpressionSyntax));

                case IsPatternExpressionSyntax isPatternExpressionSyntax:
                    return(IsPatternExpression.Print(isPatternExpressionSyntax));

                case JoinClauseSyntax joinClauseSyntax:
                    return(JoinClause.Print(joinClauseSyntax));

                case LabeledStatementSyntax labeledStatementSyntax:
                    return(LabeledStatement.Print(labeledStatementSyntax));

                case LetClauseSyntax letClauseSyntax:
                    return(LetClause.Print(letClauseSyntax));

                case LiteralExpressionSyntax literalExpressionSyntax:
                    return(LiteralExpression.Print(literalExpressionSyntax));

                case LocalDeclarationStatementSyntax localDeclarationStatementSyntax:
                    return(LocalDeclarationStatement.Print(localDeclarationStatementSyntax));

                case LocalFunctionStatementSyntax localFunctionStatementSyntax:
                    return(LocalFunctionStatement.Print(localFunctionStatementSyntax));

                case LockStatementSyntax lockStatementSyntax:
                    return(LockStatement.Print(lockStatementSyntax));

                case MakeRefExpressionSyntax makeRefExpressionSyntax:
                    return(MakeRefExpression.Print(makeRefExpressionSyntax));

                case MemberAccessExpressionSyntax memberAccessExpressionSyntax:
                    return(MemberAccessExpression.Print(memberAccessExpressionSyntax));

                case MemberBindingExpressionSyntax memberBindingExpressionSyntax:
                    return(MemberBindingExpression.Print(memberBindingExpressionSyntax));

                case NameColonSyntax nameColonSyntax:
                    return(NameColon.Print(nameColonSyntax));

                case NameEqualsSyntax nameEqualsSyntax:
                    return(NameEquals.Print(nameEqualsSyntax));

                case NamespaceDeclarationSyntax namespaceDeclarationSyntax:
                    return(NamespaceDeclaration.Print(namespaceDeclarationSyntax));

                case NullableTypeSyntax nullableTypeSyntax:
                    return(NullableType.Print(nullableTypeSyntax));

                case ObjectCreationExpressionSyntax objectCreationExpressionSyntax:
                    return(ObjectCreationExpression.Print(objectCreationExpressionSyntax));

                case OmittedArraySizeExpressionSyntax omittedArraySizeExpressionSyntax:
                    return(OmittedArraySizeExpression.Print(omittedArraySizeExpressionSyntax));

                case OmittedTypeArgumentSyntax omittedTypeArgumentSyntax:
                    return(OmittedTypeArgument.Print(omittedTypeArgumentSyntax));

                case OrderByClauseSyntax orderByClauseSyntax:
                    return(OrderByClause.Print(orderByClauseSyntax));

                case ParameterListSyntax parameterListSyntax:
                    return(ParameterList.Print(parameterListSyntax));

                case ParameterSyntax parameterSyntax:
                    return(Parameter.Print(parameterSyntax));

                case ParenthesizedExpressionSyntax parenthesizedExpressionSyntax:
                    return(ParenthesizedExpression.Print(parenthesizedExpressionSyntax));

                case ParenthesizedLambdaExpressionSyntax parenthesizedLambdaExpressionSyntax:
                    return(ParenthesizedLambdaExpression.Print(
                               parenthesizedLambdaExpressionSyntax
                               ));

                case ParenthesizedPatternSyntax parenthesizedPatternSyntax:
                    return(ParenthesizedPattern.Print(parenthesizedPatternSyntax));

                case ParenthesizedVariableDesignationSyntax parenthesizedVariableDesignationSyntax:
                    return(ParenthesizedVariableDesignation.Print(
                               parenthesizedVariableDesignationSyntax
                               ));

                case PointerTypeSyntax pointerTypeSyntax:
                    return(PointerType.Print(pointerTypeSyntax));

                case PostfixUnaryExpressionSyntax postfixUnaryExpressionSyntax:
                    return(PostfixUnaryExpression.Print(postfixUnaryExpressionSyntax));

                case PredefinedTypeSyntax predefinedTypeSyntax:
                    return(PredefinedType.Print(predefinedTypeSyntax));

                case PrefixUnaryExpressionSyntax prefixUnaryExpressionSyntax:
                    return(PrefixUnaryExpression.Print(prefixUnaryExpressionSyntax));

                case PrimaryConstructorBaseTypeSyntax primaryConstructorBaseTypeSyntax:
                    return(PrimaryConstructorBaseType.Print(primaryConstructorBaseTypeSyntax));

                case QualifiedNameSyntax qualifiedNameSyntax:
                    return(QualifiedName.Print(qualifiedNameSyntax));

                case QueryBodySyntax queryBodySyntax:
                    return(QueryBody.Print(queryBodySyntax));

                case QueryContinuationSyntax queryContinuationSyntax:
                    return(QueryContinuation.Print(queryContinuationSyntax));

                case QueryExpressionSyntax queryExpressionSyntax:
                    return(QueryExpression.Print(queryExpressionSyntax));

                case RangeExpressionSyntax rangeExpressionSyntax:
                    return(RangeExpression.Print(rangeExpressionSyntax));

                case RecursivePatternSyntax recursivePatternSyntax:
                    return(RecursivePattern.Print(recursivePatternSyntax));

                case RefExpressionSyntax refExpressionSyntax:
                    return(RefExpression.Print(refExpressionSyntax));

                case RefTypeExpressionSyntax refTypeExpressionSyntax:
                    return(RefTypeExpression.Print(refTypeExpressionSyntax));

                case RefTypeSyntax refTypeSyntax:
                    return(RefType.Print(refTypeSyntax));

                case RefValueExpressionSyntax refValueExpressionSyntax:
                    return(RefValueExpression.Print(refValueExpressionSyntax));

                case RelationalPatternSyntax relationalPatternSyntax:
                    return(RelationalPattern.Print(relationalPatternSyntax));

                case ReturnStatementSyntax returnStatementSyntax:
                    return(ReturnStatement.Print(returnStatementSyntax));

                case SelectClauseSyntax selectClauseSyntax:
                    return(SelectClause.Print(selectClauseSyntax));

                case SimpleBaseTypeSyntax simpleBaseTypeSyntax:
                    return(SimpleBaseType.Print(simpleBaseTypeSyntax));

                case SimpleLambdaExpressionSyntax simpleLambdaExpressionSyntax:
                    return(SimpleLambdaExpression.Print(simpleLambdaExpressionSyntax));

                case SingleVariableDesignationSyntax singleVariableDesignationSyntax:
                    return(SingleVariableDesignation.Print(singleVariableDesignationSyntax));

                case SizeOfExpressionSyntax sizeOfExpressionSyntax:
                    return(SizeOfExpression.Print(sizeOfExpressionSyntax));

                case StackAllocArrayCreationExpressionSyntax stackAllocArrayCreationExpressionSyntax:
                    return(StackAllocArrayCreationExpression.Print(
                               stackAllocArrayCreationExpressionSyntax
                               ));

                case SwitchExpressionSyntax switchExpressionSyntax:
                    return(SwitchExpression.Print(switchExpressionSyntax));

                case SwitchSectionSyntax switchSectionSyntax:
                    return(SwitchSection.Print(switchSectionSyntax));

                case SwitchStatementSyntax switchStatementSyntax:
                    return(SwitchStatement.Print(switchStatementSyntax));

                case ThisExpressionSyntax thisExpressionSyntax:
                    return(ThisExpression.Print(thisExpressionSyntax));

                case ThrowExpressionSyntax throwExpressionSyntax:
                    return(ThrowExpression.Print(throwExpressionSyntax));

                case ThrowStatementSyntax throwStatementSyntax:
                    return(ThrowStatement.Print(throwStatementSyntax));

                case TryStatementSyntax tryStatementSyntax:
                    return(TryStatement.Print(tryStatementSyntax));

                case TupleElementSyntax tupleElementSyntax:
                    return(TupleElement.Print(tupleElementSyntax));

                case TupleExpressionSyntax tupleExpressionSyntax:
                    return(TupleExpression.Print(tupleExpressionSyntax));

                case TupleTypeSyntax tupleTypeSyntax:
                    return(TupleType.Print(tupleTypeSyntax));

                case TypeArgumentListSyntax typeArgumentListSyntax:
                    return(TypeArgumentList.Print(typeArgumentListSyntax));

                case TypeConstraintSyntax typeConstraintSyntax:
                    return(TypeConstraint.Print(typeConstraintSyntax));

                case TypeOfExpressionSyntax typeOfExpressionSyntax:
                    return(TypeOfExpression.Print(typeOfExpressionSyntax));

                case TypeParameterConstraintClauseSyntax typeParameterConstraintClauseSyntax:
                    return(TypeParameterConstraintClause.Print(
                               typeParameterConstraintClauseSyntax
                               ));

                case TypeParameterListSyntax typeParameterListSyntax:
                    return(TypeParameterList.Print(typeParameterListSyntax));

                case TypeParameterSyntax typeParameterSyntax:
                    return(TypeParameter.Print(typeParameterSyntax));

                case TypePatternSyntax typePatternSyntax:
                    return(TypePattern.Print(typePatternSyntax));

                case UnaryPatternSyntax unaryPatternSyntax:
                    return(UnaryPattern.Print(unaryPatternSyntax));

                case UnsafeStatementSyntax unsafeStatementSyntax:
                    return(UnsafeStatement.Print(unsafeStatementSyntax));

                case UsingDirectiveSyntax usingDirectiveSyntax:
                    return(UsingDirective.Print(usingDirectiveSyntax));

                case UsingStatementSyntax usingStatementSyntax:
                    return(UsingStatement.Print(usingStatementSyntax));

                case VariableDeclarationSyntax variableDeclarationSyntax:
                    return(VariableDeclaration.Print(variableDeclarationSyntax));

                case VariableDeclaratorSyntax variableDeclaratorSyntax:
                    return(VariableDeclarator.Print(variableDeclaratorSyntax));

                case VarPatternSyntax varPatternSyntax:
                    return(VarPattern.Print(varPatternSyntax));

                case WhenClauseSyntax whenClauseSyntax:
                    return(WhenClause.Print(whenClauseSyntax));

                case WhereClauseSyntax whereClauseSyntax:
                    return(WhereClause.Print(whereClauseSyntax));

                case WhileStatementSyntax whileStatementSyntax:
                    return(WhileStatement.Print(whileStatementSyntax));

                case WithExpressionSyntax withExpressionSyntax:
                    return(WithExpression.Print(withExpressionSyntax));

                case YieldStatementSyntax yieldStatementSyntax:
                    return(YieldStatement.Print(yieldStatementSyntax));

                default:
                    throw new Exception("Can't handle " + syntaxNode.GetType().Name);
                }
            }

            finally
            {
                depth--;
            }
        }