提交 91ee2744 编写于 作者: T Tomáš Matoušek 提交者: GitHub

Merge pull request #17315 from tmat/RemoveIMC

Remove a few unnecessary CCI interfaces
......@@ -127,14 +127,14 @@ bool Cci.IFieldReference.IsContextualNamedEntity
}
}
Cci.IMetadataConstant Cci.IFieldDefinition.GetCompileTimeValue(EmitContext context)
MetadataConstant Cci.IFieldDefinition.GetCompileTimeValue(EmitContext context)
{
CheckDefinitionInvariant();
return GetMetadataConstantValue(context);
}
internal Cci.IMetadataConstant GetMetadataConstantValue(EmitContext context)
internal MetadataConstant GetMetadataConstantValue(EmitContext context)
{
// A constant field of type decimal is not treated as a compile time value in CLR,
// so check if it is a metadata constant, not just a constant to exclude decimals.
......
......@@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using Microsoft.CodeAnalysis.CodeGen;
using Microsoft.CodeAnalysis.CSharp.Emit;
using Microsoft.CodeAnalysis.Emit;
using Roslyn.Utilities;
......@@ -55,13 +56,13 @@ ushort Cci.IParameterListEntry.Index
/// <summary>
/// Gets constant value to be stored in metadata Constant table.
/// </summary>
Cci.IMetadataConstant Cci.IParameterDefinition.GetDefaultValue(EmitContext context)
MetadataConstant Cci.IParameterDefinition.GetDefaultValue(EmitContext context)
{
CheckDefinitionInvariant();
return this.GetMetadataConstantValue(context);
}
internal Cci.IMetadataConstant GetMetadataConstantValue(EmitContext context)
internal MetadataConstant GetMetadataConstantValue(EmitContext context)
{
if (!HasMetadataConstantValue)
{
......
......@@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using Microsoft.CodeAnalysis.CodeGen;
using Microsoft.CodeAnalysis.CSharp.Emit;
using Microsoft.CodeAnalysis.Emit;
......@@ -43,7 +44,7 @@ IEnumerable<Cci.IMethodReference> Cci.IPropertyDefinition.Accessors
}
}
Cci.IMetadataConstant Cci.IPropertyDefinition.DefaultValue
MetadataConstant Cci.IPropertyDefinition.DefaultValue
{
get
{
......
......@@ -4,6 +4,7 @@
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.Emit;
using System.Collections.Generic;
using Microsoft.CodeAnalysis.CodeGen;
namespace Microsoft.CodeAnalysis.CSharp.Emit.NoPia
{
......@@ -27,7 +28,7 @@ protected override IEnumerable<CSharpAttributeData> GetCustomAttributesToEmit(Mo
return UnderlyingField.GetCustomAttributesToEmit(compilationState);
}
protected override Cci.IMetadataConstant GetCompileTimeValue(EmitContext context)
protected override MetadataConstant GetCompileTimeValue(EmitContext context)
{
return UnderlyingField.GetMetadataConstantValue(context);
}
......
......@@ -7,6 +7,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using Cci = Microsoft.Cci;
using Microsoft.CodeAnalysis.CodeGen;
namespace Microsoft.CodeAnalysis.CSharp.Emit.NoPia
{
......@@ -31,7 +32,7 @@ protected override IEnumerable<CSharpAttributeData> GetCustomAttributesToEmit(Mo
return UnderlyingParameter.GetCustomAttributesToEmit(compilationState);
}
protected override Cci.IMetadataConstant GetDefaultValue(EmitContext context)
protected override MetadataConstant GetDefaultValue(EmitContext context)
{
return UnderlyingParameter.GetMetadataConstantValue(context);
}
......
......@@ -16,7 +16,7 @@ internal sealed class LocalConstantDefinition : Cci.ILocalDefinition
public LocalConstantDefinition(
string name,
Location location,
Cci.IMetadataConstant compileTimeValue,
MetadataConstant compileTimeValue,
ImmutableArray<TypedConstant> dynamicTransformFlags,
ImmutableArray<TypedConstant> tupleElementNames)
{
......@@ -34,7 +34,7 @@ internal sealed class LocalConstantDefinition : Cci.ILocalDefinition
public Location Location { get; }
public Cci.IMetadataConstant CompileTimeValue { get; }
public MetadataConstant CompileTimeValue { get; }
public Cci.ITypeReference Type => CompileTimeValue.Type;
......
......@@ -102,7 +102,7 @@ public Location Location
public int SlotIndex => _slot;
public Cci.IMetadataConstant CompileTimeValue
public MetadataConstant CompileTimeValue
{
get { throw ExceptionUtilities.Unreachable; }
}
......
......@@ -6,29 +6,25 @@
namespace Microsoft.CodeAnalysis.CodeGen
{
internal sealed class MetadataConstant : Cci.IMetadataConstant
internal sealed class MetadataConstant : Cci.IMetadataExpression
{
private readonly Cci.ITypeReference _type;
private readonly object _value;
public Cci.ITypeReference Type { get; }
public object Value { get; }
public MetadataConstant(Cci.ITypeReference type, object value)
{
Debug.Assert(type != null);
AssertValidConstant(value);
_type = type;
_value = value;
Type = type;
Value = value;
}
object Cci.IMetadataConstant.Value => _value;
void Cci.IMetadataExpression.Dispatch(Cci.MetadataVisitor visitor)
{
visitor.Visit(this);
}
Cci.ITypeReference Cci.IMetadataExpression.Type => _type;
[Conditional("DEBUG")]
internal static void AssertValidConstant(object value)
{
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.Text;
......@@ -10,36 +11,20 @@ namespace Microsoft.CodeAnalysis.CodeGen
/// <summary>
/// An expression that creates an array instance in metadata. Only for use in custom attributes.
/// </summary>
internal sealed class MetadataCreateArray : Cci.IMetadataCreateArray
internal sealed class MetadataCreateArray : Cci.IMetadataExpression
{
private readonly Cci.IArrayTypeReference _arrayType;
private readonly Cci.ITypeReference _elementType;
private ImmutableArray<Cci.IMetadataExpression> _initializers;
public Cci.IArrayTypeReference ArrayType { get; }
public Cci.ITypeReference ElementType { get; }
public ImmutableArray<Cci.IMetadataExpression> Elements { get; }
public MetadataCreateArray(Cci.IArrayTypeReference arrayType, Cci.ITypeReference elementType, ImmutableArray<Cci.IMetadataExpression> initializers)
{
_arrayType = arrayType;
_elementType = elementType;
_initializers = initializers;
ArrayType = arrayType;
ElementType = elementType;
Elements = initializers;
}
/// <summary>
/// The element type of the array.
/// </summary>
Cci.ITypeReference Cci.IMetadataCreateArray.ElementType => _elementType;
uint Cci.IMetadataCreateArray.ElementCount => (uint)_initializers.Length;
/// <summary>
/// The initial values of the array elements. May be empty.
/// </summary>
IEnumerable<Cci.IMetadataExpression> Cci.IMetadataCreateArray.Elements => _initializers;
void Cci.IMetadataExpression.Dispatch(Cci.MetadataVisitor visitor)
{
visitor.Visit(this);
}
Cci.ITypeReference Cci.IMetadataExpression.Type => _arrayType;
Cci.ITypeReference Cci.IMetadataExpression.Type => ArrayType;
void Cci.IMetadataExpression.Dispatch(Cci.MetadataVisitor visitor) => visitor.Visit(this);
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.CodeAnalysis.Text;
using Cci = Microsoft.Cci;
namespace Microsoft.CodeAnalysis.CodeGen
{
/// <summary>
/// An expression that results in a System.Type instance.
/// </summary>
internal sealed class MetadataTypeOf : Cci.IMetadataTypeOf
internal sealed class MetadataTypeOf : Cci.IMetadataExpression
{
private readonly Cci.ITypeReference _typeToGet;
private readonly Cci.ITypeReference _systemType;
......
......@@ -72,8 +72,8 @@ public ImmutableArray<Cci.IMetadataNamedArgument> GetNamedArguments(EmitContext
Debug.Assert(context.Module.IsPlatformType(fileArg.Type, Cci.PlatformType.SystemString));
// Named argument value must be a non-empty string
Debug.Assert(fileArg.ArgumentValue is Cci.IMetadataConstant);
var fileName = (string)((Cci.IMetadataConstant)fileArg.ArgumentValue).Value;
Debug.Assert(fileArg.ArgumentValue is MetadataConstant);
var fileName = (string)((MetadataConstant)fileArg.ArgumentValue).Value;
Debug.Assert(!String.IsNullOrEmpty(fileName));
// PermissionSetAttribute type must have a writable public string type property member 'Hex'
......
......@@ -362,7 +362,7 @@ internal SynthesizedStaticField(string name, Cci.INamedTypeDefinition containing
public override string ToString() => $"{_type} {_containingType}.{this.Name}";
public Cci.IMetadataConstant GetCompileTimeValue(EmitContext context) => null;
public MetadataConstant GetCompileTimeValue(EmitContext context) => null;
public abstract ImmutableArray<byte> MappedData { get; }
......@@ -420,7 +420,7 @@ public Cci.IDefinition AsDefinition(EmitContext context)
public Cci.ISpecializedFieldReference AsSpecializedFieldReference => null;
public Cci.IMetadataConstant Constant
public MetadataConstant Constant
{
get { throw ExceptionUtilities.Unreachable; }
}
......
......@@ -24,7 +24,7 @@ internal SignatureOnlyLocalDefinition(byte[] signature, int slot)
_slot = slot;
}
public Cci.IMetadataConstant CompileTimeValue
public MetadataConstant CompileTimeValue
{
get { throw ExceptionUtilities.Unreachable; }
}
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.CodeGen;
namespace Microsoft.CodeAnalysis.Emit.NoPia
{
......@@ -45,7 +46,7 @@ public TFieldSymbol UnderlyingField
}
}
protected abstract Cci.IMetadataConstant GetCompileTimeValue(EmitContext context);
protected abstract MetadataConstant GetCompileTimeValue(EmitContext context);
protected abstract bool IsCompileTimeConstant { get; }
protected abstract bool IsNotSerialized { get; }
protected abstract bool IsReadOnly { get; }
......@@ -59,7 +60,7 @@ public TFieldSymbol UnderlyingField
protected abstract Cci.TypeMemberVisibility Visibility { get; }
protected abstract string Name { get; }
Cci.IMetadataConstant Cci.IFieldDefinition.GetCompileTimeValue(EmitContext context)
MetadataConstant Cci.IFieldDefinition.GetCompileTimeValue(EmitContext context)
{
return GetCompileTimeValue(context);
}
......
......@@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using Microsoft.CodeAnalysis.CodeGen;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Emit.NoPia
......@@ -51,7 +52,7 @@ protected TEmbeddedTypesManager TypeManager
}
protected abstract bool HasDefaultValue { get; }
protected abstract Cci.IMetadataConstant GetDefaultValue(EmitContext context);
protected abstract MetadataConstant GetDefaultValue(EmitContext context);
protected abstract bool IsIn { get; }
protected abstract bool IsOut { get; }
protected abstract bool IsOptional { get; }
......@@ -130,7 +131,7 @@ bool Cci.IParameterDefinition.HasDefaultValue
}
}
Cci.IMetadataConstant Cci.IParameterDefinition.GetDefaultValue(EmitContext context)
MetadataConstant Cci.IParameterDefinition.GetDefaultValue(EmitContext context)
{
return GetDefaultValue(context);
}
......
......@@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using Microsoft.CodeAnalysis.CodeGen;
using Cci = Microsoft.Cci;
namespace Microsoft.CodeAnalysis.Emit.NoPia
......@@ -101,7 +102,7 @@ bool Cci.IPropertyDefinition.HasDefaultValue
get { return false; }
}
Cci.IMetadataConstant Cci.IPropertyDefinition.DefaultValue
MetadataConstant Cci.IPropertyDefinition.DefaultValue
{
get { return null; }
}
......
......@@ -717,7 +717,7 @@ private void DefineScopeLocals(LocalScope currentScope, StandaloneSignatureHandl
var signatureHandle = _metadataWriter.SerializeLocalConstantStandAloneSignature(scopeConstant);
if (!_metadataWriter.IsLocalNameTooLong(scopeConstant))
{
DefineLocalConstant(scopeConstant.Name, scopeConstant.CompileTimeValue.Value, _metadataWriter.GetConstantTypeCode(scopeConstant), signatureHandle);
DefineLocalConstant(scopeConstant.Name, scopeConstant.CompileTimeValue.Value, scopeConstant.CompileTimeValue.Type.TypeCode, signatureHandle);
}
}
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
// ^ using Microsoft.Contracts;
namespace Microsoft.Cci
{
/// <summary>
/// An expression that does not change its value at runtime and can be evaluated at compile time.
/// </summary>
internal interface IMetadataConstant : IMetadataExpression
{
/// <summary>
/// The compile time value of the expression. Null to represent a null object reference or a null array.
/// </summary>
object Value { get; }
}
/// <summary>
/// An expression that creates an array instance in metadata. Only for use in custom attributes.
/// </summary>
internal interface IMetadataCreateArray : IMetadataExpression
{
/// <summary>
/// The element type of the array.
/// </summary>
ITypeReference ElementType { get; }
/// <summary>
/// The values of the array elements. May be empty to represent an empty array.
/// </summary>
IEnumerable<IMetadataExpression> Elements
{
get;
}
/// <summary>
/// The number of elements in the array.
/// </summary>
uint ElementCount
{
get;
}
}
/// <summary>
/// An expression that can be represented directly in metadata.
/// </summary>
......@@ -82,15 +40,4 @@ internal interface IMetadataNamedArgument : IMetadataExpression
/// </summary>
bool IsField { get; }
}
/// <summary>
/// An expression that results in a System.Type instance.
/// </summary>
internal interface IMetadataTypeOf : IMetadataExpression
{
/// <summary>
/// The type that will be represented by the System.Type instance.
/// </summary>
ITypeReference TypeToGet { get; }
}
}
......@@ -119,7 +119,7 @@ internal interface IFieldDefinition : ITypeDefinitionMember, IFieldReference
/// The compile time value of the field. This value should be used directly in IL, rather than a reference to the field.
/// If the field does not have a valid compile time value, Dummy.Constant is returned.
/// </summary>
IMetadataConstant GetCompileTimeValue(EmitContext context);
MetadataConstant GetCompileTimeValue(EmitContext context);
/// <summary>
/// Mapped field data, or null if the field is not mapped.
......@@ -229,7 +229,7 @@ internal interface ILocalDefinition : INamedEntity
/// <summary>
/// The compile time value of the definition, if it is a local constant.
/// </summary>
IMetadataConstant CompileTimeValue
MetadataConstant CompileTimeValue
{
get;
}
......@@ -654,7 +654,7 @@ internal interface IParameterDefinition : IDefinition, INamedEntity, IParameterT
/// A compile time constant value that should be supplied as the corresponding argument value by callers that do not explicitly specify an argument value for this parameter.
/// Null if the parameter doesn't have default value.
/// </summary>
IMetadataConstant GetDefaultValue(EmitContext context);
MetadataConstant GetDefaultValue(EmitContext context);
/// <summary>
/// True if the parameter has a default value that should be supplied as the argument value by a caller for which the argument value has not been explicitly specified.
......@@ -718,7 +718,7 @@ internal interface IPropertyDefinition : ISignature, ITypeDefinitionMember
/// <summary>
/// A compile time constant value that provides the default value for the property. (Who uses this and why?)
/// </summary>
IMetadataConstant DefaultValue
MetadataConstant DefaultValue
{
get;
// ^ requires this.HasDefaultValue;
......
......@@ -5,6 +5,7 @@
using Roslyn.Utilities;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.Emit;
using Microsoft.CodeAnalysis.CodeGen;
namespace Microsoft.Cci
{
......@@ -203,11 +204,11 @@ public virtual void Visit(IMarshallingInformation marshallingInformation)
throw ExceptionUtilities.Unreachable;
}
public virtual void Visit(IMetadataConstant constant)
public virtual void Visit(MetadataConstant constant)
{
}
public virtual void Visit(IMetadataCreateArray createArray)
public virtual void Visit(MetadataCreateArray createArray)
{
this.Visit(createArray.ElementType);
this.Visit(createArray.Elements);
......@@ -240,7 +241,7 @@ public virtual void Visit(IMetadataNamedArgument namedArgument)
this.Visit(namedArgument.ArgumentValue);
}
public virtual void Visit(IMetadataTypeOf typeOf)
public virtual void Visit(MetadataTypeOf typeOf)
{
if (typeOf.TypeToGet != null)
{
......@@ -413,7 +414,7 @@ public virtual void Visit(IParameterDefinition parameterDefinition)
this.Visit(parameterDefinition.GetAttributes(Context));
this.Visit(parameterDefinition.CustomModifiers);
IMetadataConstant defaultValue = parameterDefinition.GetDefaultValue(Context);
MetadataConstant defaultValue = parameterDefinition.GetDefaultValue(Context);
if (defaultValue != null)
{
this.Visit((IMetadataExpression)defaultValue);
......
......@@ -1233,11 +1233,6 @@ public static ParameterAttributes GetParameterAttributes(IParameterDefinition pa
return result;
}
internal PrimitiveTypeCode GetConstantTypeCode(ILocalDefinition constant)
{
return constant.CompileTimeValue.Type.TypeCode;
}
private BlobHandle GetPermissionSetBlobHandle(ImmutableArray<ICustomAttribute> permissionSet)
{
var writer = PooledBlobBuilder.GetInstance();
......@@ -3341,7 +3336,7 @@ private void SerializeNamedArgumentType(NamedArgumentTypeEncoder encoder, ITypeR
private void SerializeMetadataExpression(LiteralEncoder encoder, IMetadataExpression expression, ITypeReference targetType)
{
IMetadataCreateArray a = expression as IMetadataCreateArray;
var a = expression as MetadataCreateArray;
if (a != null)
{
ITypeReference targetElementType;
......@@ -3355,7 +3350,7 @@ private void SerializeMetadataExpression(LiteralEncoder encoder, IMetadataExpres
CustomAttributeArrayTypeEncoder arrayTypeEncoder;
encoder.TaggedVector(out arrayTypeEncoder, out vectorEncoder);
SerializeCustomAttributeArrayType(arrayTypeEncoder, (IArrayTypeReference)a.Type);
SerializeCustomAttributeArrayType(arrayTypeEncoder, a.ArrayType);
targetElementType = a.ElementType;
}
......@@ -3369,7 +3364,7 @@ private void SerializeMetadataExpression(LiteralEncoder encoder, IMetadataExpres
targetElementType = targetArrayType.GetElementType(this.Context);
}
var literalsEncoder = vectorEncoder.Count((int)a.ElementCount);
var literalsEncoder = vectorEncoder.Count(a.Elements.Length);
foreach (IMetadataExpression elemValue in a.Elements)
{
......@@ -3379,7 +3374,7 @@ private void SerializeMetadataExpression(LiteralEncoder encoder, IMetadataExpres
else
{
ScalarEncoder scalarEncoder;
IMetadataConstant c = expression as IMetadataConstant;
MetadataConstant c = expression as MetadataConstant;
if (this.module.IsPlatformType(targetType, PlatformType.SystemObject))
{
......@@ -3416,7 +3411,7 @@ private void SerializeMetadataExpression(LiteralEncoder encoder, IMetadataExpres
}
else
{
scalarEncoder.SystemType(((IMetadataTypeOf)expression).TypeToGet.GetSerializedTypeName(Context));
scalarEncoder.SystemType(((MetadataTypeOf)expression).TypeToGet.GetSerializedTypeName(Context));
}
}
}
......
......@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.CodeGen;
using EmitContext = Microsoft.CodeAnalysis.Emit.EmitContext;
namespace Microsoft.Cci
......@@ -25,7 +26,7 @@ public ISignature ContainingSignature
private readonly IMethodDefinition _containingMethod;
public IMetadataConstant Constant
public MetadataConstant Constant
{
get { return null; }
}
......@@ -40,7 +41,7 @@ public ImmutableArray<Cci.ICustomModifier> CustomModifiers
get { return _containingMethod.ReturnValueCustomModifiers; }
}
public IMetadataConstant GetDefaultValue(EmitContext context)
public MetadataConstant GetDefaultValue(EmitContext context)
{
return null;
}
......
......@@ -2,6 +2,7 @@
Imports System.Collections.Immutable
Imports Microsoft.Cci
Imports Microsoft.CodeAnalysis.CodeGen
Imports Microsoft.CodeAnalysis.Emit
Imports Microsoft.CodeAnalysis.VisualBasic.Emit
......@@ -93,13 +94,13 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
End Get
End Property
Private Function IFieldDefinition_GetCompileTimeValue(context As EmitContext) As IMetadataConstant Implements IFieldDefinition.GetCompileTimeValue
Private Function IFieldDefinition_GetCompileTimeValue(context As EmitContext) As MetadataConstant Implements IFieldDefinition.GetCompileTimeValue
CheckDefinitionInvariant()
Return GetMetadataConstantValue(context)
End Function
Friend Function GetMetadataConstantValue(context As EmitContext) As IMetadataConstant
Friend Function GetMetadataConstantValue(context As EmitContext) As MetadataConstant
' do not return a compile time value for const fields of types DateTime or Decimal because they
' are only const from a VB point of view
If Me.IsMetadataConstant Then
......
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Immutable
Imports Microsoft.CodeAnalysis.CodeGen
Imports Microsoft.CodeAnalysis.Emit
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
......@@ -23,7 +24,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Emit.NoPia
Return UnderlyingField.GetCustomAttributesToEmit(compilationState)
End Function
Protected Overrides Function GetCompileTimeValue(context As EmitContext) As Cci.IMetadataConstant
Protected Overrides Function GetCompileTimeValue(context As EmitContext) As MetadataConstant
Return UnderlyingField.GetMetadataConstantValue(context)
End Function
......
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Immutable
Imports Microsoft.CodeAnalysis.CodeGen
Imports Microsoft.CodeAnalysis.Emit
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
......@@ -24,7 +25,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Emit.NoPia
End Get
End Property
Protected Overrides Function GetDefaultValue(context As EmitContext) As Cci.IMetadataConstant
Protected Overrides Function GetDefaultValue(context As EmitContext) As MetadataConstant
Return UnderlyingParameter.GetMetadataConstantValue(context)
End Function
......
......@@ -2,6 +2,7 @@
Imports System.Collections.Immutable
Imports Microsoft.Cci
Imports Microsoft.CodeAnalysis.CodeGen
Imports Microsoft.CodeAnalysis.Emit
Imports Microsoft.CodeAnalysis.VisualBasic.Emit
......@@ -41,12 +42,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
End Get
End Property
Private Function IParameterDefinition_GetDefaultValue(context As EmitContext) As IMetadataConstant Implements IParameterDefinition.GetDefaultValue
Private Function IParameterDefinition_GetDefaultValue(context As EmitContext) As MetadataConstant Implements IParameterDefinition.GetDefaultValue
CheckDefinitionInvariant()
Return Me.GetMetadataConstantValue(context)
End Function
Friend Function GetMetadataConstantValue(context As EmitContext) As IMetadataConstant
Friend Function GetMetadataConstantValue(context As EmitContext) As MetadataConstant
If Me.HasMetadataConstantValue Then
Return DirectCast(context.Module, PEModuleBuilder).CreateConstant(Me.Type, Me.ExplicitDefaultConstantValue.Value, syntaxNodeOpt:=DirectCast(context.SyntaxNodeOpt, VisualBasicSyntaxNode), diagnostics:=context.Diagnostics)
Else
......
......@@ -2,6 +2,7 @@
Imports System.Collections.Immutable
Imports Microsoft.Cci
Imports Microsoft.CodeAnalysis.CodeGen
Imports Microsoft.CodeAnalysis.Emit
Imports Microsoft.CodeAnalysis.VisualBasic.Emit
......@@ -26,7 +27,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
End Get
End Property
Private ReadOnly Property IPropertyDefinitionDefaultValue As IMetadataConstant Implements IPropertyDefinition.DefaultValue
Private ReadOnly Property IPropertyDefinitionDefaultValue As MetadataConstant Implements IPropertyDefinition.DefaultValue
Get
CheckDefinitionInvariant()
Return Nothing
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册