Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ArrayType.Canon.cs « Canon « TypeSystem « Common « tools « coreclr « src - github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7deba06d193c273e9b21eaf8312ef248ce953790 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace Internal.TypeSystem
{
    // Implements canonicalization for arrays
    partial class ArrayType
    {
        protected override TypeDesc ConvertToCanonFormImpl(CanonicalFormKind kind)
        {
            TypeDesc paramTypeConverted = Context.ConvertToCanon(ParameterType, kind);
            if (paramTypeConverted != ParameterType)
            {
                // Note: don't use the Rank property here, as that hides the difference
                // between a single dimensional MD array and an SZArray.
                return Context.GetArrayType(paramTypeConverted, _rank);
            }

            return this;
        }
    }

    // Implements canonicalization for array methods
    partial class ArrayMethod
    {
        public override bool IsCanonicalMethod(CanonicalFormKind policy)
        {
            return _owningType.IsCanonicalSubtype(policy);
        }

        public override MethodDesc GetCanonMethodTarget(CanonicalFormKind kind)
        {
            TypeDesc canonicalizedTypeOfTargetMethod = _owningType.ConvertToCanonForm(kind);
            if (canonicalizedTypeOfTargetMethod == _owningType)
                return this;

            return ((ArrayType)canonicalizedTypeOfTargetMethod).GetArrayMethod(_kind);
        }
    }
}