diff options
author | Michal Strehovský <MichalStrehovsky@users.noreply.github.com> | 2016-10-19 09:17:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-19 09:17:52 +0300 |
commit | 2035d075a9b02f6124e9c930941caa9aaba98955 (patch) | |
tree | 869906e4598c7d8cc0a8a2ce4fba3483cc76075f /src/ILCompiler.MetadataTransform | |
parent | 4d936680e97d6adf695c8660ee91dfe6358ca7e4 (diff) |
Extend ScopeDefinition metadata schema (#2037)
Add support for representing EntryPoint and the global `<Module>` type.
Note: this does not include updates to the Project N metadata writer.
The schedule for that is TBD.
Fixes #1782.
Diffstat (limited to 'src/ILCompiler.MetadataTransform')
-rw-r--r-- | src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/ExplicitScopeAssemblyPolicyMixin.cs | 2 | ||||
-rw-r--r-- | src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/Transform.Scope.cs | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/ExplicitScopeAssemblyPolicyMixin.cs b/src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/ExplicitScopeAssemblyPolicyMixin.cs index 7b08618e5..c70187d77 100644 --- a/src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/ExplicitScopeAssemblyPolicyMixin.cs +++ b/src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/ExplicitScopeAssemblyPolicyMixin.cs @@ -99,7 +99,7 @@ namespace ILCompiler.Metadata return null; } - public override Cts.TypeDesc GetGlobalModuleType() + public override Cts.MetadataType GetGlobalModuleType() { return null; } diff --git a/src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/Transform.Scope.cs b/src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/Transform.Scope.cs index ccb843f4f..815ee1a03 100644 --- a/src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/Transform.Scope.cs +++ b/src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/Transform.Scope.cs @@ -65,6 +65,12 @@ namespace ILCompiler.Metadata scopeDefinition.PublicKey = assemblyName.GetPublicKeyToken(); } + Cts.MetadataType moduleType = module.GetGlobalModuleType(); + if (moduleType != null && _policy.GeneratesMetadata(moduleType)) + { + scopeDefinition.GlobalModuleType = (TypeDefinition)HandleType(moduleType); + } + Cts.Ecma.EcmaAssembly ecmaAssembly = module as Cts.Ecma.EcmaAssembly; if (ecmaAssembly != null) { @@ -73,6 +79,12 @@ namespace ILCompiler.Metadata { scopeDefinition.CustomAttributes = HandleCustomAttributes(ecmaAssembly, customAttributes); } + + Cts.MethodDesc entryPoint = ecmaAssembly.EntryPoint; + if (entryPoint != null && _policy.GeneratesMetadata(entryPoint)) + { + scopeDefinition.EntryPoint = (QualifiedMethod)HandleQualifiedMethod(entryPoint); + } } } else |