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

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Strehovský <michals@microsoft.com>2015-12-17 05:57:04 +0300
committerMichal Strehovský <michals@microsoft.com>2015-12-17 05:57:04 +0300
commitaf918fb7ef0d81657ba494cdc16f6ab74a0dfd26 (patch)
tree595165ac212fb33d3dad0d9de6e1adb5885b4278 /src/Common
parent6cf6977b884f47d004972910af4a39e07be2df53 (diff)
Initial MetadataTransform commit
This transforms the type system object model into the metadata writer object model. The metadata writer object model can be directly serialized to a binary blob by the MetadataWriter and used by reflection at runtime. Lots of things are not implemented. There are either TODOs or throws in appropriate places. I just want to get a few eyes on this before I continue.
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/src/TypeSystem/Common/PropertySignature.cs38
-rw-r--r--src/Common/src/TypeSystem/Ecma/EcmaGenericParameter.cs16
-rw-r--r--src/Common/src/TypeSystem/Ecma/EcmaSignatureParser.cs30
3 files changed, 84 insertions, 0 deletions
diff --git a/src/Common/src/TypeSystem/Common/PropertySignature.cs b/src/Common/src/TypeSystem/Common/PropertySignature.cs
new file mode 100644
index 000000000..ba19c689c
--- /dev/null
+++ b/src/Common/src/TypeSystem/Common/PropertySignature.cs
@@ -0,0 +1,38 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+namespace Internal.TypeSystem
+{
+ public struct PropertySignature
+ {
+ private TypeDesc[] _parameters;
+
+ public readonly bool IsStatic;
+
+ public readonly TypeDesc ReturnType;
+
+ [System.Runtime.CompilerServices.IndexerName("Parameter")]
+ public TypeDesc this[int index]
+ {
+ get
+ {
+ return _parameters[index];
+ }
+ }
+
+ public int Length
+ {
+ get
+ {
+ return _parameters.Length;
+ }
+ }
+
+ public PropertySignature(bool isStatic, TypeDesc[] parameters, TypeDesc returnType)
+ {
+ IsStatic = isStatic;
+ _parameters = parameters;
+ ReturnType = returnType;
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Common/src/TypeSystem/Ecma/EcmaGenericParameter.cs b/src/Common/src/TypeSystem/Ecma/EcmaGenericParameter.cs
index 7334ca05e..fdb7cebea 100644
--- a/src/Common/src/TypeSystem/Ecma/EcmaGenericParameter.cs
+++ b/src/Common/src/TypeSystem/Ecma/EcmaGenericParameter.cs
@@ -30,6 +30,22 @@ namespace Internal.TypeSystem.Ecma
return TypeHashingAlgorithms.ComputeSignatureVariableHashCode(parameter.Index, parameter.Parent.Kind == HandleKind.MethodDefinition);
}
+ public GenericParameterHandle Handle
+ {
+ get
+ {
+ return _handle;
+ }
+ }
+
+ public MetadataReader MetadataReader
+ {
+ get
+ {
+ return _module.MetadataReader;
+ }
+ }
+
public override TypeSystemContext Context
{
get
diff --git a/src/Common/src/TypeSystem/Ecma/EcmaSignatureParser.cs b/src/Common/src/TypeSystem/Ecma/EcmaSignatureParser.cs
index 899b584d4..aa76675fd 100644
--- a/src/Common/src/TypeSystem/Ecma/EcmaSignatureParser.cs
+++ b/src/Common/src/TypeSystem/Ecma/EcmaSignatureParser.cs
@@ -178,6 +178,36 @@ namespace Internal.TypeSystem.Ecma
return new MethodSignature(flags, arity, returnType, parameters);
}
+ public PropertySignature ParsePropertySignature()
+ {
+ SignatureHeader header = _reader.ReadSignatureHeader();
+ if (header.Kind != SignatureKind.Property)
+ throw new BadImageFormatException();
+
+ bool isStatic = !header.IsInstance;
+
+ int count = _reader.ReadCompressedInteger();
+
+ TypeDesc returnType = ParseType();
+ TypeDesc[] parameters;
+
+ if (count > 0)
+ {
+ // Get all of the parameters.
+ parameters = new TypeDesc[count];
+ for (int i = 0; i < count; i++)
+ {
+ parameters[i] = ParseType();
+ }
+ }
+ else
+ {
+ parameters = TypeDesc.EmptyTypes;
+ }
+
+ return new PropertySignature(isStatic, parameters, returnType);
+ }
+
public TypeDesc ParseFieldSignature()
{
if (_reader.ReadSignatureHeader().Kind != SignatureKind.Field)