提交 d100acf5 编写于 作者: N Neal Gafter

Merge pull request #740 from gafter/RoslynMagic

Use C# 6 idioms like => method bodies and string interpolation
......@@ -35,20 +35,11 @@ internal ArityEnumerator(int bitVector, HashSet<int> arities)
}
}
public int Current
{
get { return _current; }
}
public int Current => _current;
public void Dispose()
{
_arities = null;
}
public void Dispose() => _arities = null;
object System.Collections.IEnumerator.Current
{
get { return _current; }
}
object System.Collections.IEnumerator.Current => _current;
public bool MoveNext()
{
......@@ -91,10 +82,7 @@ public bool MoveNext()
return false;
}
public void Reset()
{
_current = resetValue;
}
public void Reset() => _current = resetValue;
}
// TODO: Is the cost of boxing every instance of UniqueSymbolOrArities that we
......@@ -165,13 +153,7 @@ public void AddSymbol(TSymbol symbol, int arity)
AddArity(arity);
}
private bool HasUniqueSymbol
{
get
{
return _uniqueSymbolOrArities != null && !(_uniqueSymbolOrArities is HashSet<int>);
}
}
private bool HasUniqueSymbol => _uniqueSymbolOrArities != null && !(_uniqueSymbolOrArities is HashSet<int>);
private void AddArity(int arity)
{
......@@ -236,13 +218,7 @@ public int Count
}
#if DEBUG
internal TSymbol UniqueSymbol
{
get
{
return _uniqueSymbolOrArities as TSymbol;
}
}
internal TSymbol UniqueSymbol => _uniqueSymbolOrArities as TSymbol;
#endif
}
......@@ -280,13 +256,7 @@ public void AddSymbol(TSymbol symbol, string name, int arity)
#endif
}
public ICollection<String> Names
{
get
{
return _nameMap.Keys;
}
}
public ICollection<String> Names => _nameMap.Keys;
/// <summary>
/// If <paramref name="uniqueSymbol"/> is set, then <paramref name="arities"/> will be null.
......@@ -315,9 +285,6 @@ public ICollection<String> Names
return true;
}
public void Clear()
{
_nameMap.Clear();
}
public void Clear() => _nameMap.Clear();
}
}
......@@ -183,10 +183,7 @@ public override int GetHashCode(string str)
/// <summary>
/// Returns a StringComparer that compares strings according the VB identifier comparison rules.
/// </summary>
public static StringComparer Comparer
{
get { return s_comparer; }
}
public static StringComparer Comparer => s_comparer;
/// <summary>
/// Determines if two VB identifiers are equal according to the VB identifier comparison rules.
......@@ -194,10 +191,7 @@ public static StringComparer Comparer
/// <param name="left">First identifier to compare</param>
/// <param name="right">Second identifier to compare</param>
/// <returns>true if the identifiers should be considered the same.</returns>
public static bool Equals(string left, string right)
{
return s_comparer.Equals(left, right);
}
public static bool Equals(string left, string right) => s_comparer.Equals(left, right);
/// <summary>
/// Determines if the string 'value' end with string 'possibleEnd'.
......@@ -205,10 +199,7 @@ public static bool Equals(string left, string right)
/// <param name="value"></param>
/// <param name="possibleEnd"></param>
/// <returns></returns>
public static bool EndsWith(string value, string possibleEnd)
{
return OneToOneUnicodeComparer.EndsWith(value, possibleEnd);
}
public static bool EndsWith(string value, string possibleEnd) => OneToOneUnicodeComparer.EndsWith(value, possibleEnd);
/// <summary>
/// Compares two VB identifiers according to the VB identifier comparison rules.
......@@ -216,10 +207,7 @@ public static bool EndsWith(string value, string possibleEnd)
/// <param name="left">First identifier to compare</param>
/// <param name="right">Second identifier to compare</param>
/// <returns>-1 if <paramref name="left"/> &lt; <paramref name="right"/>, 1 if <paramref name="left"/> &gt; <paramref name="right"/>, 0 if they are equal.</returns>
public static int Compare(string left, string right)
{
return s_comparer.Compare(left, right);
}
public static int Compare(string left, string right) => s_comparer.Compare(left, right);
/// <summary>
/// Gets a case-insensitive hash code for VB identifiers.
......
......@@ -76,25 +76,19 @@ public ArrayMethod GetArrayConstructor(Cci.IArrayTypeReference arrayType)
/// Acquires an element getter method for a given array type
/// </summary>
public ArrayMethod GetArrayGet(Cci.IArrayTypeReference arrayType)
{
return GetArrayMethod(arrayType, ArrayMethodKind.GET);
}
=> GetArrayMethod(arrayType, ArrayMethodKind.GET);
/// <summary>
/// Acquires an element setter method for a given array type
/// </summary>
public ArrayMethod GetArraySet(Cci.IArrayTypeReference arrayType)
{
return GetArrayMethod(arrayType, ArrayMethodKind.SET);
}
=> GetArrayMethod(arrayType, ArrayMethodKind.SET);
/// <summary>
/// Acquires an element referencer method for a given array type
/// </summary>
public ArrayMethod GetArrayAddress(Cci.IArrayTypeReference arrayType)
{
return GetArrayMethod(arrayType, ArrayMethodKind.ADDRESS);
}
=> GetArrayMethod(arrayType, ArrayMethodKind.ADDRESS);
/// <summary>
/// Maps {array type, method kind} tuples to implementing pseudo-methods.
......@@ -149,15 +143,10 @@ private sealed class ArrayConstructor : ArrayMethod
{
public ArrayConstructor(Cci.IArrayTypeReference arrayType) : base(arrayType) { }
public override string Name
{
get { return ".ctor"; }
}
public override string Name => ".ctor";
public override Cci.ITypeReference GetType(EmitContext context)
{
return context.Module.GetPlatformType(Cci.PlatformType.SystemVoid, context);
}
=> context.Module.GetPlatformType(Cci.PlatformType.SystemVoid, context);
}
/// <summary>
......@@ -168,15 +157,10 @@ private sealed class ArrayGet : ArrayMethod
{
public ArrayGet(Cci.IArrayTypeReference arrayType) : base(arrayType) { }
public override string Name
{
get { return "Get"; }
}
public override string Name => "Get";
public override Cci.ITypeReference GetType(EmitContext context)
{
return arrayType.GetElementType(context);
}
=> arrayType.GetElementType(context);
}
/// <summary>
......@@ -187,20 +171,12 @@ private sealed class ArrayAddress : ArrayMethod
{
public ArrayAddress(Cci.IArrayTypeReference arrayType) : base(arrayType) { }
public override bool ReturnValueIsByRef
{
get { return true; }
}
public override bool ReturnValueIsByRef => true;
public override Cci.ITypeReference GetType(EmitContext context)
{
return arrayType.GetElementType(context);
}
=> arrayType.GetElementType(context);
public override string Name
{
get { return "Address"; }
}
public override string Name => "Address";
}
/// <summary>
......@@ -211,15 +187,10 @@ private sealed class ArraySet : ArrayMethod
{
public ArraySet(Cci.IArrayTypeReference arrayType) : base(arrayType) { }
public override string Name
{
get { return "Set"; }
}
public override string Name => "Set";
public override Cci.ITypeReference GetType(EmitContext context)
{
return context.Module.GetPlatformType(Cci.PlatformType.SystemVoid, context);
}
=> context.Module.GetPlatformType(Cci.PlatformType.SystemVoid, context);
protected override ImmutableArray<ArrayMethodParameterInfo> MakeParameters()
{
......@@ -275,34 +246,18 @@ public static ArrayMethodParameterInfo GetIndexParameter(ushort index)
}
public ImmutableArray<Cci.ICustomModifier> CustomModifiers
{
get { return ImmutableArray<Cci.ICustomModifier>.Empty; }
}
=> ImmutableArray<Cci.ICustomModifier>.Empty;
public bool IsByReference
{
get { return false; }
}
public bool IsByReference => false;
public bool IsModified
{
get { return false; }
}
public bool IsModified => false;
public bool HasByRefBeforeCustomModifiers
{
get { return false; }
}
public bool HasByRefBeforeCustomModifiers => false;
public virtual Cci.ITypeReference GetType(EmitContext context)
{
return context.Module.GetPlatformType(Cci.PlatformType.SystemInt32, context);
}
=> context.Module.GetPlatformType(Cci.PlatformType.SystemInt32, context);
public ushort Index
{
get { return _index; }
}
public ushort Index => _index;
}
/// <summary>
......@@ -322,9 +277,7 @@ internal ArraySetValueParameterInfo(ushort index, Cci.IArrayTypeReference arrayT
}
public override Cci.ITypeReference GetType(EmitContext context)
{
return _arrayType.GetElementType(context);
}
=> _arrayType.GetElementType(context);
}
/// <summary>
......@@ -345,10 +298,7 @@ protected ArrayMethod(Cci.IArrayTypeReference arrayType)
public abstract Cci.ITypeReference GetType(EmitContext context);
// Address overrides this to "true"
public virtual bool ReturnValueIsByRef
{
get { return false; }
}
public virtual bool ReturnValueIsByRef => false;
// Set overrides this to include "value" parameter.
protected virtual ImmutableArray<ArrayMethodParameterInfo> MakeParameters()
......@@ -365,59 +315,29 @@ protected virtual ImmutableArray<ArrayMethodParameterInfo> MakeParameters()
}
public ImmutableArray<Cci.IParameterTypeInformation> GetParameters(EmitContext context)
{
return StaticCast<Cci.IParameterTypeInformation>.From(_parameters);
}
=>StaticCast<Cci.IParameterTypeInformation>.From(_parameters);
public bool AcceptsExtraArguments
{
get { return false; }
}
public bool AcceptsExtraArguments => false;
public ushort GenericParameterCount
{
get { return 0; }
}
public ushort GenericParameterCount => 0;
public bool IsGeneric
{
get { return false; }
}
public bool IsGeneric => false;
public Cci.IMethodDefinition GetResolvedMethod(EmitContext context)
{
return null;
}
public Cci.IMethodDefinition GetResolvedMethod(EmitContext context) => null;
public ImmutableArray<Cci.IParameterTypeInformation> ExtraParameters
{
get { return ImmutableArray<Cci.IParameterTypeInformation>.Empty; }
}
=> ImmutableArray<Cci.IParameterTypeInformation>.Empty;
public Cci.IGenericMethodInstanceReference AsGenericMethodInstanceReference
{
get { return null; }
}
public Cci.IGenericMethodInstanceReference AsGenericMethodInstanceReference => null;
public Cci.ISpecializedMethodReference AsSpecializedMethodReference
{
get { return null; }
}
public Cci.ISpecializedMethodReference AsSpecializedMethodReference => null;
public Cci.CallingConvention CallingConvention
{
get { return Cci.CallingConvention.HasThis; }
}
public Cci.CallingConvention CallingConvention => Cci.CallingConvention.HasThis;
public ushort ParameterCount
{
get { return (ushort)_parameters.Length; }
}
public ushort ParameterCount => (ushort)_parameters.Length;
public ImmutableArray<Cci.ICustomModifier> ReturnValueCustomModifiers
{
get { return ImmutableArray<Cci.ICustomModifier>.Empty; }
}
=> ImmutableArray<Cci.ICustomModifier>.Empty;
public Cci.ITypeReference GetContainingType(EmitContext context)
{
......@@ -427,23 +347,15 @@ public Cci.ITypeReference GetContainingType(EmitContext context)
}
public IEnumerable<Cci.ICustomAttribute> GetAttributes(EmitContext context)
{
return SpecializedCollections.EmptyEnumerable<Cci.ICustomAttribute>();
}
=> SpecializedCollections.EmptyEnumerable<Cci.ICustomAttribute>();
public void Dispatch(Cci.MetadataVisitor visitor)
{
visitor.Visit((Cci.IMethodReference)this);
}
=> visitor.Visit((Cci.IMethodReference)this);
public Cci.IDefinition AsDefinition(EmitContext context)
{
return null;
}
=> null;
public override string ToString()
{
return arrayType.ToString() + "." + Name;
}
=> arrayType.ToString() + "." + Name;
}
}
......@@ -146,10 +146,7 @@ public void RemoveTailILMarker(int marker)
//nearest enclosing exception handler if any
public virtual ExceptionHandlerScope EnclosingHandler
{
get { return null; }
}
public virtual ExceptionHandlerScope EnclosingHandler => null;
internal virtual void Free()
{
......@@ -160,13 +157,7 @@ internal virtual void Free()
}
}
public object BranchLabel
{
get
{
return _branchLabel;
}
}
public object BranchLabel => _branchLabel;
public ILOpCode BranchCode
{
......@@ -250,45 +241,22 @@ public void SetBranch(object newLabel, ILOpCode branchCode)
/// and is not a "nop" branch.
/// </summary>
private bool IsBranchToLabel
{
get { return (this.BranchLabel != null) && (this.BranchCode != ILOpCode.Nop); }
}
=> (this.BranchLabel != null) && (this.BranchCode != ILOpCode.Nop);
public virtual BlockType Type
{
get { return BlockType.Normal; }
}
public virtual BlockType Type => BlockType.Normal;
/// <summary>
/// Instructions that are not branches.
/// </summary>
public Microsoft.Cci.MemoryStream RegularInstructions
{
get
{
return _lazyRegularInstructions;
}
}
public Microsoft.Cci.MemoryStream RegularInstructions => _lazyRegularInstructions;
/// <summary>
/// The block contains only the final branch or nothing at all
/// </summary>
public bool HasNoRegularInstructions
{
get
{
return _lazyRegularInstructions == null;
}
}
public bool HasNoRegularInstructions => _lazyRegularInstructions == null;
public uint RegularInstructionsLength
{
get
{
var li = _lazyRegularInstructions;
return li == null ? 0 : li.Length;
}
}
=> _lazyRegularInstructions?.Length ?? 0;
/// <summary>
/// Updates position of the current block to account for shorter sizes of previous blocks.
......@@ -709,13 +677,7 @@ public BasicBlockWithHandlerScope(ILBuilder builder, ExceptionHandlerScope enclo
this.enclosingHandler = enclosingHandler;
}
public override ExceptionHandlerScope EnclosingHandler
{
get
{
return enclosingHandler;
}
}
public override ExceptionHandlerScope EnclosingHandler => enclosingHandler;
}
internal sealed class ExceptionHandlerLeaderBlock : BasicBlockWithHandlerScope
......@@ -732,15 +694,10 @@ internal sealed class ExceptionHandlerLeaderBlock : BasicBlockWithHandlerScope
// in the same exception handler.
public ExceptionHandlerLeaderBlock NextExceptionHandler;
public override BlockType Type
{
get { return _type; }
}
public override BlockType Type => _type;
public override string ToString()
{
return string.Format("[{0}] {1}", _type, base.ToString());
}
=> $"[{_type}] {base.ToString()}";
}
// Basic block for the virtual switch instruction
......@@ -755,10 +712,7 @@ internal sealed class SwitchBlock : BasicBlockWithHandlerScope
this.SetBranchCode(ILOpCode.Switch);
}
public override BlockType Type
{
get { return BlockType.Switch; }
}
public override BlockType Type => BlockType.Switch;
// destination labels for switch block
public object[] BranchLabels;
......
......@@ -172,15 +172,9 @@ private void ReconcileTrailingMarkers()
}
}
private ExceptionHandlerScope EnclosingExceptionHandler
{
get { return _scopeManager.EnclosingExceptionHandler; }
}
private ExceptionHandlerScope EnclosingExceptionHandler => _scopeManager.EnclosingExceptionHandler;
internal bool InExceptionHandler
{
get { return this.EnclosingExceptionHandler != null; }
}
internal bool InExceptionHandler => this.EnclosingExceptionHandler != null;
/// <summary>
/// Realizes method body.
......@@ -201,10 +195,7 @@ internal void Realize()
/// <summary>
/// Gets all scopes that contain variables.
/// </summary>
internal ImmutableArray<Cci.LocalScope> GetAllScopes()
{
return _scopeManager.GetAllScopesWithLocals();
}
internal ImmutableArray<Cci.LocalScope> GetAllScopes() => _scopeManager.GetAllScopesWithLocals();
/// <summary>
/// Gets all scopes that contain variables.
......@@ -236,13 +227,7 @@ internal void FreeBasicBlocks()
}
}
internal ushort MaxStack
{
get
{
return (ushort)_emitState.MaxStack;
}
}
internal ushort MaxStack => (ushort)_emitState.MaxStack;
/// <summary>
/// IL opcodes emitted by this builder.
......@@ -254,13 +239,7 @@ internal ushort MaxStack
/// Example: a label will not result in any code so when emitting debugging information
/// an extra NOP may be needed if we want to decorate the label with sequence point.
/// </summary>
internal int InstructionsEmitted
{
get
{
return _emitState.InstructionsEmitted;
}
}
internal int InstructionsEmitted => _emitState.InstructionsEmitted;
/// <summary>
/// Marks blocks that are reachable.
......@@ -1161,9 +1140,7 @@ internal void OpenLocalScope(ScopeType scopeType = ScopeType.Variable, Cci.IType
}
internal bool PossiblyDefinedOutsideOfTry(LocalDefinition local)
{
return _scopeManager.PossiblyDefinedOutsideOfTry(local);
}
=> _scopeManager.PossiblyDefinedOutsideOfTry(local);
/// <summary>
/// Marks the end of filter condition and start of the actual filter handler.
......
......@@ -34,84 +34,38 @@ internal sealed class LocalConstantDefinition : Cci.ILocalDefinition
_dynamicTransformFlags = dynamicTransformFlags;
}
public string Name
{
get { return _name; }
}
public string Name => _name;
public Location Location
{
get { return _location; }
}
public Location Location => _location;
public Cci.IMetadataConstant CompileTimeValue
{
get { return _compileTimeValue; }
}
public Cci.IMetadataConstant CompileTimeValue => _compileTimeValue;
public Cci.ITypeReference Type
{
get { return _compileTimeValue.Type; }
}
public Cci.ITypeReference Type => _compileTimeValue.Type;
public bool IsConstant
{
get { return true; }
}
public bool IsConstant => true;
public ImmutableArray<Cci.ICustomModifier> CustomModifiers
{
get { return ImmutableArray<Cci.ICustomModifier>.Empty; }
}
=> ImmutableArray<Cci.ICustomModifier>.Empty;
public bool IsModified
{
get { return false; }
}
public bool IsModified => false;
public bool IsPinned
{
get { return false; }
}
public bool IsPinned => false;
public bool IsReference
{
get { return false; }
}
public bool IsReference => false;
public LocalSlotConstraints Constraints
{
get { return LocalSlotConstraints.None; }
}
public LocalSlotConstraints Constraints => LocalSlotConstraints.None;
public bool IsDynamic
{
get { return _isDynamic; }
}
public bool IsDynamic => _isDynamic;
public uint PdbAttributes
{
get { return Cci.PdbWriter.DefaultLocalAttributesValue; }
}
public uint PdbAttributes => Cci.PdbWriter.DefaultLocalAttributesValue;
public ImmutableArray<TypedConstant> DynamicTransformFlags
{
get { return _dynamicTransformFlags; }
}
public ImmutableArray<TypedConstant> DynamicTransformFlags => _dynamicTransformFlags;
public int SlotIndex
{
get { return -1; }
}
public int SlotIndex => -1;
public byte[] Signature
{
get { return null; }
}
public byte[] Signature => null;
public LocalSlotDebugInfo SlotInfo
{
get { return new LocalSlotDebugInfo(SynthesizedLocalKind.UserDefined, LocalDebugId.None); }
}
=> new LocalSlotDebugInfo(SynthesizedLocalKind.UserDefined, LocalDebugId.None);
}
}
......@@ -80,14 +80,9 @@ internal sealed class LocalDefinition : Cci.ILocalDefinition
}
internal string GetDebuggerDisplay()
{
return string.Format("{0}: {1} ({2})", _slot, _nameOpt ?? "<unnamed>", _type);
}
=> $"{_slot}: {_nameOpt ?? "<unnamed>"} ({_type})";
public ILocalSymbol SymbolOpt
{
get { return _symbolOpt; }
}
public ILocalSymbol SymbolOpt => _symbolOpt;
public Location Location
{
......@@ -106,10 +101,7 @@ public Location Location
}
}
public int SlotIndex
{
get { return _slot; }
}
public int SlotIndex => _slot;
public Cci.IMetadataConstant CompileTimeValue
{
......@@ -117,68 +109,35 @@ public Cci.IMetadataConstant CompileTimeValue
}
public ImmutableArray<Cci.ICustomModifier> CustomModifiers
{
get { return ImmutableArray<Cci.ICustomModifier>.Empty; }
}
=> ImmutableArray<Cci.ICustomModifier>.Empty;
public bool IsConstant
{
get { throw ExceptionUtilities.Unreachable; }
}
public bool IsModified
{
get { return false; }
}
public bool IsModified => false;
public LocalSlotConstraints Constraints
{
get { return _constraints; }
}
public LocalSlotConstraints Constraints => _constraints;
public bool IsPinned
{
get { return (_constraints & LocalSlotConstraints.Pinned) != 0; }
}
=> (_constraints & LocalSlotConstraints.Pinned) != 0;
public bool IsReference
{
get { return (_constraints & LocalSlotConstraints.ByRef) != 0; }
}
=> (_constraints & LocalSlotConstraints.ByRef) != 0;
public bool IsDynamic
{
get { return _isDynamic; }
}
public bool IsDynamic => _isDynamic;
public uint PdbAttributes
{
get { return _pdbAttributes; }
}
public uint PdbAttributes => _pdbAttributes;
public ImmutableArray<TypedConstant> DynamicTransformFlags
{
get { return _dynamicTransformFlags; }
}
public ImmutableArray<TypedConstant> DynamicTransformFlags => _dynamicTransformFlags;
public Cci.ITypeReference Type
{
get { return _type; }
}
public Cci.ITypeReference Type => _type;
public string Name
{
get { return _nameOpt; }
}
public string Name => _nameOpt;
public byte[] Signature
{
get { return null; }
}
public byte[] Signature => null;
public LocalSlotDebugInfo SlotInfo
{
get { return _slotInfo; }
}
public LocalSlotDebugInfo SlotInfo => _slotInfo;
}
}
......@@ -25,13 +25,7 @@ internal LocalScopeManager()
_scopes.Push(_rootScope);
}
private ScopeInfo CurrentScope
{
get
{
return _scopes.Peek();
}
}
private ScopeInfo CurrentScope => _scopes.Peek();
internal ScopeInfo OpenScope(ScopeType scopeType, Microsoft.Cci.ITypeReference exceptionType)
{
......@@ -70,10 +64,7 @@ internal void CloseScope(ILBuilder builder)
Debug.Assert(_enclosingExceptionHandler == GetEnclosingExceptionHandler());
}
internal ExceptionHandlerScope EnclosingExceptionHandler
{
get { return _enclosingExceptionHandler; }
}
internal ExceptionHandlerScope EnclosingExceptionHandler => _enclosingExceptionHandler;
private ExceptionHandlerScope GetEnclosingExceptionHandler()
{
......@@ -304,10 +295,7 @@ protected static ScopeBounds GetHoistedLocalScopes<TScopeInfo>(ArrayBuilder<Cci.
/// </summary>
public abstract void FreeBasicBlocks();
internal virtual bool ContainsLocal(LocalDefinition local)
{
return false;
}
internal virtual bool ContainsLocal(LocalDefinition local) => false;
}
/// <summary>
......@@ -325,10 +313,7 @@ internal class LocalScopeInfo : ScopeInfo
private ImmutableArray<ScopeInfo>.Builder _nestedScopes;
protected ImmutableArray<BasicBlock>.Builder Blocks;
public override ScopeType Type
{
get { return ScopeType.Variable; }
}
public override ScopeType Type => ScopeType.Variable;
public override ScopeInfo OpenScope(
ScopeType scopeType,
......@@ -574,23 +559,11 @@ public ExceptionHandlerScope(ExceptionHandlerContainerScope containingScope, Sco
_exceptionType = exceptionType;
}
public ExceptionHandlerContainerScope ContainingExceptionScope
{
get
{
return _containingScope;
}
}
public ExceptionHandlerContainerScope ContainingExceptionScope => _containingScope;
public override ScopeType Type
{
get { return _type; }
}
public override ScopeType Type => _type;
public Microsoft.Cci.ITypeReference ExceptionType
{
get { return _exceptionType; }
}
public Microsoft.Cci.ITypeReference ExceptionType => _exceptionType;
// pessimistically sets destination for blocked branches.
// called when finally block is inserted in the outer TryFinally scope.
......@@ -604,10 +577,7 @@ public void SetBlockedByFinallyDestination(object label)
// if current finally does not terminate, this is where
// branches going through it should be retargeted.
// Otherwise returns null.
public object BlockedByFinallyDestination
{
get { return _blockedByFinallyDestination; }
}
public object BlockedByFinallyDestination => _blockedByFinallyDestination;
// Called when finally is determined to be non-blocking
public void UnblockFinally()
......@@ -616,12 +586,7 @@ public void UnblockFinally()
}
public int FilterHandlerStart
{
get
{
return _lastFilterConditionBlock.Start + _lastFilterConditionBlock.TotalSize;
}
}
=> _lastFilterConditionBlock.Start + _lastFilterConditionBlock.TotalSize;
public override void FinishFilterCondition(ILBuilder builder)
{
......@@ -669,9 +634,7 @@ public override BasicBlock CreateBlock(ILBuilder builder)
}
public ExceptionHandlerLeaderBlock LeaderBlock
{
get { return (Blocks == null) ? null : (ExceptionHandlerLeaderBlock)Blocks[0]; }
}
=> (Blocks == null) ? null : (ExceptionHandlerLeaderBlock)Blocks[0];
private BlockType GetLeaderBlockType()
{
......@@ -715,23 +678,11 @@ public ExceptionHandlerContainerScope(ExceptionHandlerScope containingHandler)
_endLabel = new object();
}
public ExceptionHandlerScope ContainingHandler
{
get
{
return _containingHandler;
}
}
public ExceptionHandlerScope ContainingHandler => _containingHandler;
public object EndLabel
{
get { return _endLabel; }
}
public object EndLabel => _endLabel;
public override ScopeType Type
{
get { return ScopeType.TryCatchFinally; }
}
public override ScopeType Type => ScopeType.TryCatchFinally;
public override ScopeInfo OpenScope(ScopeType scopeType,
Microsoft.Cci.ITypeReference exceptionType,
......@@ -853,14 +804,10 @@ internal override void GetExceptionHandlerRegions(ArrayBuilder<Cci.ExceptionHand
}
internal override ScopeBounds GetLocalScopes(ArrayBuilder<Cci.LocalScope> scopesWithVariables)
{
return GetLocalScopes(scopesWithVariables, _handlers);
}
=> GetLocalScopes(scopesWithVariables, _handlers);
internal override ScopeBounds GetHoistedLocalScopes(ArrayBuilder<Cci.StateMachineHoistedLocalScope> result)
{
return GetHoistedLocalScopes(result, _handlers);
}
=> GetHoistedLocalScopes(result, _handlers);
private static ScopeBounds GetBounds(ExceptionHandlerScope scope)
{
......
......@@ -20,20 +20,14 @@ public MetadataConstant(Cci.ITypeReference type, object value)
_value = value;
}
object Cci.IMetadataConstant.Value
{
get { return _value; }
}
object Cci.IMetadataConstant.Value => _value;
void Cci.IMetadataExpression.Dispatch(Cci.MetadataVisitor visitor)
{
visitor.Visit(this);
}
Cci.ITypeReference Cci.IMetadataExpression.Type
{
get { return _type; }
}
Cci.ITypeReference Cci.IMetadataExpression.Type => _type;
[Conditional("DEBUG")]
internal static void AssertValidConstant(object value)
......
......@@ -26,41 +26,20 @@ public MetadataCreateArray(Cci.IArrayTypeReference arrayType, Cci.ITypeReference
/// <summary>
/// The element type of the array.
/// </summary>
Cci.ITypeReference Cci.IMetadataCreateArray.ElementType
{
get
{
return _elementType;
}
}
Cci.ITypeReference Cci.IMetadataCreateArray.ElementType => _elementType;
uint Cci.IMetadataCreateArray.ElementCount
{
get
{
return (uint)_initializers.Length;
}
}
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
{
get
{
return _initializers;
}
}
IEnumerable<Cci.IMetadataExpression> Cci.IMetadataCreateArray.Elements => _initializers;
void Cci.IMetadataExpression.Dispatch(Cci.MetadataVisitor visitor)
{
visitor.Visit(this);
}
Cci.ITypeReference Cci.IMetadataExpression.Type
{
get { return _arrayType; }
}
Cci.ITypeReference Cci.IMetadataExpression.Type => _arrayType;
}
}
......@@ -25,44 +25,23 @@ public MetadataNamedArgument(ISymbol entity, Cci.ITypeReference type, Cci.IMetad
/// <summary>
/// The name of the parameter or property or field that corresponds to the argument.
/// </summary>
string Cci.IMetadataNamedArgument.ArgumentName
{
get
{
return _entity.Name;
}
}
string Cci.IMetadataNamedArgument.ArgumentName => _entity.Name;
/// <summary>
/// The value of the argument.
/// </summary>
Cci.IMetadataExpression Cci.IMetadataNamedArgument.ArgumentValue
{
get
{
return _value;
}
}
Cci.IMetadataExpression Cci.IMetadataNamedArgument.ArgumentValue => _value;
/// <summary>
/// True if the named argument provides the value of a field.
/// </summary>
bool Cci.IMetadataNamedArgument.IsField
{
get
{
return _entity is Cci.IFieldDefinition;
}
}
bool Cci.IMetadataNamedArgument.IsField => _entity is Cci.IFieldDefinition;
void Cci.IMetadataExpression.Dispatch(Cci.MetadataVisitor visitor)
{
visitor.Visit(this);
}
Cci.ITypeReference Cci.IMetadataExpression.Type
{
get { return _type; }
}
Cci.ITypeReference Cci.IMetadataExpression.Type => _type;
}
}
......@@ -87,40 +87,19 @@ void Cci.IMethodBody.Dispatch(Cci.MetadataVisitor visitor)
throw ExceptionUtilities.Unreachable;
}
ImmutableArray<Cci.ExceptionHandlerRegion> Cci.IMethodBody.ExceptionRegions
{
get { return _exceptionHandlers; }
}
ImmutableArray<Cci.ExceptionHandlerRegion> Cci.IMethodBody.ExceptionRegions => _exceptionHandlers;
bool Cci.IMethodBody.LocalsAreZeroed
{
get { return true; }
}
bool Cci.IMethodBody.LocalsAreZeroed => true;
ImmutableArray<Cci.ILocalDefinition> Cci.IMethodBody.LocalVariables
{
get { return _locals; }
}
ImmutableArray<Cci.ILocalDefinition> Cci.IMethodBody.LocalVariables => _locals;
Cci.IMethodDefinition Cci.IMethodBody.MethodDefinition
{
get { return _parent; }
}
Cci.IMethodDefinition Cci.IMethodBody.MethodDefinition => _parent;
Cci.AsyncMethodBodyDebugInfo Cci.IMethodBody.AsyncDebugInfo
{
get { return _asyncMethodDebugInfo; }
}
Cci.AsyncMethodBodyDebugInfo Cci.IMethodBody.AsyncDebugInfo => _asyncMethodDebugInfo;
ushort Cci.IMethodBody.MaxStack
{
get { return _maxStack; }
}
ushort Cci.IMethodBody.MaxStack => _maxStack;
public byte[] IL
{
get { return _ilBits; }
}
public byte[] IL => _ilBits;
public ImmutableArray<Cci.SequencePoint> GetSequencePoints()
{
......@@ -130,99 +109,35 @@ public ImmutableArray<Cci.SequencePoint> GetSequencePoints()
}
public bool HasAnySequencePoints
{
get
{
return _sequencePoints != null && !_sequencePoints.IsEmpty;
}
}
=> _sequencePoints != null && !_sequencePoints.IsEmpty;
public ImmutableArray<Cci.SequencePoint> GetLocations()
{
return GetSequencePoints();
}
=> GetSequencePoints();
ImmutableArray<Cci.LocalScope> Cci.IMethodBody.LocalScopes
{
get
{
return _localScopes;
}
}
ImmutableArray<Cci.LocalScope> Cci.IMethodBody.LocalScopes => _localScopes;
/// <summary>
/// This is a list of the using directives that were in scope for this method body.
/// </summary>
Cci.IImportScope Cci.IMethodBody.ImportScope
{
get
{
return _importScopeOpt;
}
}
Cci.IImportScope Cci.IMethodBody.ImportScope => _importScopeOpt;
string Cci.IMethodBody.StateMachineTypeName
{
get
{
return _stateMachineTypeNameOpt;
}
}
string Cci.IMethodBody.StateMachineTypeName => _stateMachineTypeNameOpt;
ImmutableArray<Cci.StateMachineHoistedLocalScope> Cci.IMethodBody.StateMachineHoistedLocalScopes
{
get
{
return _stateMachineHoistedLocalScopes;
}
}
=> _stateMachineHoistedLocalScopes;
ImmutableArray<EncHoistedLocalInfo> Cci.IMethodBody.StateMachineHoistedLocalSlots
{
get
{
return _stateMachineHoistedLocalSlots;
}
}
=> _stateMachineHoistedLocalSlots;
ImmutableArray<Cci.ITypeReference> Cci.IMethodBody.StateMachineAwaiterSlots
{
get
{
return _stateMachineAwaiterSlots;
}
}
=> _stateMachineAwaiterSlots;
bool Cci.IMethodBody.HasDynamicLocalVariables
{
get
{
return _hasDynamicLocalVariables;
}
}
bool Cci.IMethodBody.HasDynamicLocalVariables => _hasDynamicLocalVariables;
public int MethodOrdinal
{
get
{
return _methodOrdinal;
}
}
public int MethodOrdinal => _methodOrdinal;
public ImmutableArray<LambdaDebugInfo> LambdaDebugInfo
{
get
{
return _lambdaDebugInfo;
}
}
public ImmutableArray<LambdaDebugInfo> LambdaDebugInfo => _lambdaDebugInfo;
public ImmutableArray<ClosureDebugInfo> ClosureDebugInfo
{
get
{
return _closureDebugInfo;
}
}
public ImmutableArray<ClosureDebugInfo> ClosureDebugInfo => _closureDebugInfo;
}
}
......@@ -51,9 +51,7 @@ public ImmutableArray<Cci.IMetadataExpression> GetArguments(EmitContext context)
/// A reference to the constructor that will be used to instantiate this custom attribute during execution (if the attribute is inspected via Reflection).
/// </summary>
public Cci.IMethodReference Constructor(EmitContext context)
{
return _sourceAttribute.Constructor(context);
}
=> _sourceAttribute.Constructor(context);
/// <summary>
/// Zero or more named arguments that specify values for fields and properties of the attribute.
......@@ -136,13 +134,7 @@ private static char ConvertHexToChar(int b)
/// <summary>
/// The number of positional arguments.
/// </summary>
public int ArgumentCount
{
get
{
return _sourceAttribute.ArgumentCount;
}
}
public int ArgumentCount => _sourceAttribute.ArgumentCount;
/// <summary>
/// The number of named arguments.
......@@ -159,15 +151,9 @@ public ushort NamedArgumentCount
/// <summary>
/// The type of the attribute. For example System.AttributeUsageAttribute.
/// </summary>
public Cci.ITypeReference GetType(EmitContext context)
{
return _sourceAttribute.GetType(context);
}
public Cci.ITypeReference GetType(EmitContext context) => _sourceAttribute.GetType(context);
public bool AllowMultiple
{
get { return _sourceAttribute.AllowMultiple; }
}
public bool AllowMultiple => _sourceAttribute.AllowMultiple;
private struct HexPropertyMetadataNamedArgument : Cci.IMetadataNamedArgument
{
......@@ -206,14 +192,8 @@ public PermissionSetFileReadException(string message, string file)
_file = file;
}
public string FileName
{
get { return _file; }
}
public string FileName => _file;
public string PropertyName
{
get { return PermissionSetAttributeWithFileReference.FilePropertyName; }
}
public string PropertyName => PermissionSetAttributeWithFileReference.FilePropertyName;
}
}
......@@ -103,10 +103,7 @@ internal void Freeze()
_orderedProxyTypes = _proxyTypes.OrderBy(kvp => kvp.Key).Select(kvp => kvp.Value).AsImmutable();
}
private bool IsFrozen
{
get { return _frozen != 0; }
}
private bool IsFrozen => _frozen != 0;
internal Cci.IFieldReference CreateDataField(ImmutableArray<byte> data)
{
......@@ -171,15 +168,9 @@ public override IEnumerable<Cci.INestedTypeDefinition> GetNestedTypes(EmitContex
return System.Linq.Enumerable.OfType<ExplicitSizeStruct>(_orderedProxyTypes);
}
public override string ToString()
{
return this.Name;
}
public override string ToString() => this.Name;
public override Cci.ITypeReference GetBaseClass(EmitContext context)
{
return _systemObject;
}
public override Cci.ITypeReference GetBaseClass(EmitContext context) => _systemObject;
public override IEnumerable<Cci.ICustomAttribute> GetAttributes(EmitContext context)
{
......@@ -196,25 +187,13 @@ public override void Dispatch(Cci.MetadataVisitor visitor)
visitor.Visit((Cci.INamespaceTypeDefinition)this);
}
public override Cci.INamespaceTypeDefinition AsNamespaceTypeDefinition(EmitContext context)
{
return this;
}
public override Cci.INamespaceTypeDefinition AsNamespaceTypeDefinition(EmitContext context) => this;
public override Cci.INamespaceTypeReference AsNamespaceTypeReference
{
get { return this; }
}
public override Cci.INamespaceTypeReference AsNamespaceTypeReference => this;
public string Name
{
get { return _name; }
}
public string Name => _name;
public bool IsPublic
{
get { return false; }
}
public bool IsPublic => false;
public Cci.IUnitReference GetUnit(EmitContext context)
{
......@@ -222,10 +201,7 @@ public Cci.IUnitReference GetUnit(EmitContext context)
return _module;
}
public string NamespaceName
{
get { return ""; }
}
public string NamespaceName => string.Empty;
internal static string GenerateDataFieldName(ImmutableArray<byte> data)
{
......@@ -242,9 +218,7 @@ internal static string GenerateDataFieldName(ImmutableArray<byte> data)
}
private static char Hexchar(int x)
{
return (char)((x <= 9) ? (x + '0') : (x + ('A' - 10)));
}
=> (char)((x <= 9) ? (x + '0') : (x + ('A' - 10)));
}
/// <summary>
......@@ -264,69 +238,34 @@ internal ExplicitSizeStruct(uint size, PrivateImplementationDetails containingTy
}
public override string ToString()
{
return _containingType.ToString() + "." + this.Name;
}
=> _containingType.ToString() + "." + this.Name;
override public ushort Alignment
{
get { return 1; }
}
override public ushort Alignment => 1;
override public Cci.ITypeReference GetBaseClass(EmitContext context)
{
return _sysValueType;
}
override public Cci.ITypeReference GetBaseClass(EmitContext context) => _sysValueType;
override public LayoutKind Layout
{
get { return LayoutKind.Explicit; }
}
override public LayoutKind Layout => LayoutKind.Explicit;
override public uint SizeOf
{
get { return _size; }
}
override public uint SizeOf => _size;
override public void Dispatch(Cci.MetadataVisitor visitor)
{
visitor.Visit((Cci.INestedTypeDefinition)this);
}
public string Name
{
get { return "__StaticArrayInitTypeSize=" + _size; }
}
public string Name => "__StaticArrayInitTypeSize=" + _size;
public Cci.ITypeDefinition ContainingTypeDefinition
{
get { return _containingType; }
}
public Cci.ITypeDefinition ContainingTypeDefinition => _containingType;
public Cci.TypeMemberVisibility Visibility
{
get { return Cci.TypeMemberVisibility.Private; }
}
public Cci.TypeMemberVisibility Visibility => Cci.TypeMemberVisibility.Private;
public override bool IsValueType
{
get { return true; }
}
public override bool IsValueType => true;
public Cci.ITypeReference GetContainingType(EmitContext context)
{
return _containingType;
}
public Cci.ITypeReference GetContainingType(EmitContext context) => _containingType;
public override Cci.INestedTypeDefinition AsNestedTypeDefinition(EmitContext context)
{
return this;
}
public override Cci.INestedTypeDefinition AsNestedTypeDefinition(EmitContext context) => this;
public override Cci.INestedTypeReference AsNestedTypeReference
{
get { return this; }
}
public override Cci.INestedTypeReference AsNestedTypeReference => this;
}
/// <summary>
......@@ -351,91 +290,44 @@ internal MappedField(string name, Cci.INamedTypeDefinition containingType, Cci.I
_block = block;
_name = name;
}
public override string ToString() => $"{_type} {_containingType}.{this.Name}";
public override string ToString()
{
return string.Format("{0} {1}.{2}", _type, _containingType, this.Name);
}
public Cci.IMetadataConstant GetCompileTimeValue(EmitContext context) => null;
public Cci.IMetadataConstant GetCompileTimeValue(EmitContext context)
{
return null;
}
public ImmutableArray<byte> MappedData => _block;
public ImmutableArray<byte> MappedData
{
get { return _block; }
}
public bool IsCompileTimeConstant => false;
public bool IsCompileTimeConstant
{
get { return false; }
}
public bool IsNotSerialized => false;
public bool IsNotSerialized
{
get { return false; }
}
public bool IsReadOnly => true;
public bool IsReadOnly
{
get { return true; }
}
public bool IsRuntimeSpecial => false;
public bool IsRuntimeSpecial
{
get { return false; }
}
public bool IsSpecialName => false;
public bool IsSpecialName
{
get { return false; }
}
public bool IsStatic => true;
public bool IsStatic
{
get { return true; }
}
public bool IsMarshalledExplicitly => false;
public bool IsMarshalledExplicitly
{
get { return false; }
}
public Cci.IMarshallingInformation MarshallingInformation => null;
public Cci.IMarshallingInformation MarshallingInformation
{
get { return null; }
}
public ImmutableArray<byte> MarshallingDescriptor
{
get { return default(ImmutableArray<byte>); }
}
public ImmutableArray<byte> MarshallingDescriptor => default(ImmutableArray<byte>);
public uint Offset
{
get { throw ExceptionUtilities.Unreachable; }
}
public Cci.ITypeDefinition ContainingTypeDefinition
{
get { return _containingType; }
}
public Cci.ITypeDefinition ContainingTypeDefinition => _containingType;
public Cci.TypeMemberVisibility Visibility
{
get { return Cci.TypeMemberVisibility.Assembly; }
}
public Cci.TypeMemberVisibility Visibility => Cci.TypeMemberVisibility.Assembly;
public Cci.ITypeReference GetContainingType(EmitContext context)
{
return _containingType;
}
public Cci.ITypeReference GetContainingType(EmitContext context) => _containingType;
public IEnumerable<Cci.ICustomAttribute> GetAttributes(EmitContext context)
{
return SpecializedCollections.EmptyEnumerable<Cci.ICustomAttribute>();
}
=> SpecializedCollections.EmptyEnumerable<Cci.ICustomAttribute>();
public void Dispatch(Cci.MetadataVisitor visitor)
{
......@@ -447,30 +339,15 @@ public Cci.IDefinition AsDefinition(EmitContext context)
throw ExceptionUtilities.Unreachable;
}
public string Name
{
get { return _name; }
}
public string Name => _name;
public bool IsContextualNamedEntity
{
get { return false; }
}
public bool IsContextualNamedEntity => false;
public Cci.ITypeReference GetType(EmitContext context)
{
return _type;
}
public Cci.ITypeReference GetType(EmitContext context) => _type;
public Cci.IFieldDefinition GetResolvedField(EmitContext context)
{
return this;
}
public Cci.IFieldDefinition GetResolvedField(EmitContext context) => this;
public Cci.ISpecializedFieldReference AsSpecializedFieldReference
{
get { return null; }
}
public Cci.ISpecializedFieldReference AsSpecializedFieldReference => null;
public Cci.IMetadataConstant Constant
{
......@@ -484,223 +361,110 @@ public Cci.IMetadataConstant Constant
internal abstract class DefaultTypeDef : Cci.ITypeDefinition
{
public IEnumerable<Cci.IEventDefinition> Events
{
get { return SpecializedCollections.EmptyEnumerable<Cci.IEventDefinition>(); }
}
=> SpecializedCollections.EmptyEnumerable<Cci.IEventDefinition>();
public IEnumerable<Cci.MethodImplementation> GetExplicitImplementationOverrides(EmitContext context)
{
return SpecializedCollections.EmptyEnumerable<Cci.MethodImplementation>();
}
=> SpecializedCollections.EmptyEnumerable<Cci.MethodImplementation>();
virtual public IEnumerable<Cci.IFieldDefinition> GetFields(EmitContext context)
{
return SpecializedCollections.EmptyEnumerable<Cci.IFieldDefinition>();
}
=> SpecializedCollections.EmptyEnumerable<Cci.IFieldDefinition>();
public IEnumerable<Cci.IGenericTypeParameter> GenericParameters
{
get { return SpecializedCollections.EmptyEnumerable<Cci.IGenericTypeParameter>(); }
}
=> SpecializedCollections.EmptyEnumerable<Cci.IGenericTypeParameter>();
public ushort GenericParameterCount
{
get { return 0; }
}
public ushort GenericParameterCount => 0;
public bool HasDeclarativeSecurity
{
get { return false; }
}
public bool HasDeclarativeSecurity => false;
public IEnumerable<Cci.ITypeReference> Interfaces(EmitContext context)
{
return SpecializedCollections.EmptyEnumerable<Cci.ITypeReference>();
}
=> SpecializedCollections.EmptyEnumerable<Cci.ITypeReference>();
public bool IsAbstract
{
get { return false; }
}
public bool IsAbstract => false;
public bool IsBeforeFieldInit
{
get { return false; }
}
public bool IsBeforeFieldInit => false;
public bool IsComObject
{
get { return false; }
}
public bool IsComObject => false;
public bool IsGeneric
{
get { return false; }
}
public bool IsGeneric => false;
public bool IsInterface
{
get { return false; }
}
public bool IsInterface => false;
public bool IsRuntimeSpecial
{
get { return false; }
}
public bool IsRuntimeSpecial => false;
public bool IsSerializable
{
get { return false; }
}
public bool IsSerializable => false;
public bool IsSpecialName
{
get { return false; }
}
public bool IsSpecialName => false;
public bool IsWindowsRuntimeImport
{
get { return false; }
}
public bool IsWindowsRuntimeImport => false;
public bool IsSealed
{
get { return true; }
}
public bool IsSealed => true;
public virtual IEnumerable<Cci.IMethodDefinition> GetMethods(EmitContext context)
{
return SpecializedCollections.EmptyEnumerable<Cci.IMethodDefinition>();
}
=> SpecializedCollections.EmptyEnumerable<Cci.IMethodDefinition>();
public virtual IEnumerable<Cci.INestedTypeDefinition> GetNestedTypes(EmitContext context)
{
return SpecializedCollections.EmptyEnumerable<Cci.INestedTypeDefinition>();
}
=> SpecializedCollections.EmptyEnumerable<Cci.INestedTypeDefinition>();
public IEnumerable<Cci.IPropertyDefinition> GetProperties(EmitContext context)
{
return SpecializedCollections.EmptyEnumerable<Cci.IPropertyDefinition>();
}
=> SpecializedCollections.EmptyEnumerable<Cci.IPropertyDefinition>();
public IEnumerable<Cci.SecurityAttribute> SecurityAttributes
{
get { return SpecializedCollections.EmptyEnumerable<Cci.SecurityAttribute>(); }
}
=> SpecializedCollections.EmptyEnumerable<Cci.SecurityAttribute>();
public CharSet StringFormat
{
get { return CharSet.Ansi; }
}
public CharSet StringFormat => CharSet.Ansi;
public virtual IEnumerable<Cci.ICustomAttribute> GetAttributes(EmitContext context)
{
return SpecializedCollections.EmptyEnumerable<Cci.ICustomAttribute>();
}
=> SpecializedCollections.EmptyEnumerable<Cci.ICustomAttribute>();
public Cci.IDefinition AsDefinition(EmitContext context)
{
return this;
}
public Cci.IDefinition AsDefinition(EmitContext context) => this;
public bool IsEnum
{
get { return false; }
}
public bool IsEnum => false;
public Cci.ITypeDefinition GetResolvedType(EmitContext context)
{
return this;
}
public Cci.ITypeDefinition GetResolvedType(EmitContext context) => this;
public Cci.PrimitiveTypeCode TypeCode(EmitContext context)
{
return Cci.PrimitiveTypeCode.NotPrimitive;
}
public Cci.PrimitiveTypeCode TypeCode(EmitContext context) => Cci.PrimitiveTypeCode.NotPrimitive;
public TypeDefinitionHandle TypeDef
{
get { throw ExceptionUtilities.Unreachable; }
}
public Cci.IGenericMethodParameterReference AsGenericMethodParameterReference
{
get { return null; }
}
public Cci.IGenericMethodParameterReference AsGenericMethodParameterReference => null;
public Cci.IGenericTypeInstanceReference AsGenericTypeInstanceReference
{
get { return null; }
}
public Cci.IGenericTypeInstanceReference AsGenericTypeInstanceReference => null;
public Cci.IGenericTypeParameterReference AsGenericTypeParameterReference
{
get { return null; }
}
public Cci.IGenericTypeParameterReference AsGenericTypeParameterReference => null;
public virtual Cci.INamespaceTypeDefinition AsNamespaceTypeDefinition(EmitContext context)
{
return null;
}
public virtual Cci.INamespaceTypeDefinition AsNamespaceTypeDefinition(EmitContext context) => null;
public virtual Cci.INamespaceTypeReference AsNamespaceTypeReference
{
get { return null; }
}
public virtual Cci.INamespaceTypeReference AsNamespaceTypeReference => null;
public Cci.ISpecializedNestedTypeReference AsSpecializedNestedTypeReference
{
get { return null; }
}
public Cci.ISpecializedNestedTypeReference AsSpecializedNestedTypeReference => null;
public virtual Cci.INestedTypeDefinition AsNestedTypeDefinition(EmitContext context)
{
return null;
}
public virtual Cci.INestedTypeDefinition AsNestedTypeDefinition(EmitContext context) => null;
public virtual Cci.INestedTypeReference AsNestedTypeReference
{
get { return null; }
}
public virtual Cci.INestedTypeReference AsNestedTypeReference => null;
public Cci.ITypeDefinition AsTypeDefinition(EmitContext context)
{
return this;
}
public Cci.ITypeDefinition AsTypeDefinition(EmitContext context) => this;
public bool MangleName
{
get { return false; }
}
public bool MangleName => false;
public virtual ushort Alignment
{
get { return 0; }
}
public virtual ushort Alignment => 0;
public virtual Cci.ITypeReference GetBaseClass(EmitContext context)
{
throw ExceptionUtilities.Unreachable;
}
public virtual LayoutKind Layout
{
get { return LayoutKind.Auto; }
}
public virtual LayoutKind Layout => LayoutKind.Auto;
public virtual uint SizeOf
{
get { return 0; }
}
public virtual uint SizeOf => 0;
public virtual void Dispatch(Cci.MetadataVisitor visitor)
{
throw ExceptionUtilities.Unreachable;
}
public virtual bool IsValueType
{
get { return false; }
}
public virtual bool IsValueType => false;
}
}
......@@ -43,15 +43,9 @@ public ImmutableArray<TypedConstant> DynamicTransformFlags
/// This temp is not interesting to the expression compiler. However, it
/// may be replaced by an interesting local in a later stage.
/// </remarks>
public uint PdbAttributes
{
get { return Cci.PdbWriter.HiddenLocalAttributesValue; }
}
public uint PdbAttributes => Cci.PdbWriter.HiddenLocalAttributesValue;
public bool IsDynamic
{
get { return false; }
}
public bool IsDynamic => false;
public bool IsPinned
{
......@@ -68,34 +62,20 @@ public LocalSlotConstraints Constraints
get { throw ExceptionUtilities.Unreachable; }
}
public Location Location
{
get { return Location.None; }
}
public Location Location => Location.None;
public string Name
{
get { return null; }
}
public string Name => null;
public int SlotIndex
{
get { return _slot; }
}
public int SlotIndex => _slot;
public Cci.ITypeReference Type
{
get { throw ExceptionUtilities.Unreachable; }
}
public byte[] Signature
{
get { return _signature; }
}
public byte[] Signature => _signature;
public LocalSlotDebugInfo SlotInfo
{
get { return new LocalSlotDebugInfo(SynthesizedLocalKind.EmitterTemp, LocalDebugId.None); }
}
=> new LocalSlotDebugInfo(SynthesizedLocalKind.EmitterTemp, LocalDebugId.None);
}
}
......@@ -35,39 +35,18 @@ internal class Win32Resource : Cci.IWin32Resource
_typeName = typeName;
}
public string TypeName
{
get { return _typeName; }
}
public string TypeName => _typeName;
public int TypeId
{
get { return _typeId; }
}
public int TypeId => _typeId;
public string Name
{
get { return _name; }
}
public string Name => _name;
public int Id
{
get { return _id; }
}
public int Id => _id;
public DWORD LanguageId
{
get { return _languageId; }
}
public DWORD LanguageId => _languageId;
public DWORD CodePage
{
get { return _codePage; }
}
public DWORD CodePage => _codePage;
public IEnumerable<byte> Data
{
get { return _data; }
}
public IEnumerable<byte> Data => _data;
}
}
......@@ -47,10 +47,7 @@ public int Count
}
}
public bool IsReadOnly
{
get { return true; }
}
public bool IsReadOnly => true;
public IEnumerator<string> GetEnumerator()
{
......@@ -100,10 +97,7 @@ public CaseSensitiveCollection(IdentifierCollection identifierCollection) : base
{
}
public override bool Contains(string item)
{
return IdentifierCollection.CaseSensitiveContains(item);
}
public override bool Contains(string item) => IdentifierCollection.CaseSensitiveContains(item);
}
private sealed class CaseInsensitiveCollection : CollectionBase
......@@ -112,10 +106,7 @@ public CaseInsensitiveCollection(IdentifierCollection identifierCollection) : ba
{
}
public override bool Contains(string item)
{
return IdentifierCollection.CaseInsensitiveContains(item);
}
public override bool Contains(string item) => IdentifierCollection.CaseInsensitiveContains(item);
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册