Browse Source

[TypeSystem] Added C# style async modifier to methods.

newNRvisualizers
Mike Krüger 13 years ago
parent
commit
eaad50e8be
  1. 2
      ICSharpCode.NRefactory.CSharp/TypeSystem/TypeSystemConvertVisitor.cs
  2. 14
      ICSharpCode.NRefactory/TypeSystem/IMethod.cs
  3. 1
      ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractUnresolvedEntity.cs
  4. 6
      ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultResolvedMethod.cs
  5. 10
      ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultUnresolvedMethod.cs
  6. 4
      ICSharpCode.NRefactory/TypeSystem/Implementation/SpecializedMethod.cs

2
ICSharpCode.NRefactory.CSharp/TypeSystem/TypeSystemConvertVisitor.cs

@ -446,6 +446,8 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem @@ -446,6 +446,8 @@ namespace ICSharpCode.NRefactory.CSharp.TypeSystem
currentTypeDefinition.HasExtensionMethods = true;
}
m.IsPartial = methodDeclaration.HasModifier(Modifiers.Partial);
m.IsAsync = methodDeclaration.HasModifier(Modifiers.Async);
m.HasBody = !methodDeclaration.Body.IsNull;
ConvertParameters(m.Parameters, methodDeclaration.Parameters);

14
ICSharpCode.NRefactory/TypeSystem/IMethod.cs

@ -41,7 +41,12 @@ namespace ICSharpCode.NRefactory.TypeSystem @@ -41,7 +41,12 @@ namespace ICSharpCode.NRefactory.TypeSystem
/// Check <see cref="HasBody"/> to test if it is a partial method declaration or implementation.
/// </summary>
bool IsPartial { get; }
/// <summary>
/// Gets whether the method is a C#-style async method.
/// </summary>
bool IsAsync { get; }
[Obsolete("Use IsPartial && !HasBody instead")]
bool IsPartialMethodDeclaration { get; }
@ -104,7 +109,12 @@ namespace ICSharpCode.NRefactory.TypeSystem @@ -104,7 +109,12 @@ namespace ICSharpCode.NRefactory.TypeSystem
/// </summary>
/// <seealso cref="HasBody"/>
bool IsPartial { get; }
/// <summary>
/// Gets whether the method is a C#-style async method.
/// </summary>
bool IsAsync { get; }
/// <summary>
/// Gets whether the method has a body.
/// This property returns <c>false</c> for <c>abstract</c> or <c>extern</c> methods,

1
ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractUnresolvedEntity.cs

@ -65,6 +65,7 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation @@ -65,6 +65,7 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation
internal const ushort FlagExtensionMethod = 0x1000;
internal const ushort FlagPartialMethod = 0x2000;
internal const ushort FlagHasBody = 0x4000;
internal const ushort FlagAsyncMethod = 0x8000;
public bool IsFrozen {
get { return flags[FlagFrozen]; }

6
ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultResolvedMethod.cs

@ -196,7 +196,11 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation @@ -196,7 +196,11 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation
public bool IsPartial {
get { return ((IUnresolvedMethod)unresolved).IsPartial; }
}
public bool IsAsync {
get { return ((IUnresolvedMethod)unresolved).IsAsync; }
}
public bool HasBody {
get { return ((IUnresolvedMethod)unresolved).HasBody; }
}

10
ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultUnresolvedMethod.cs

@ -121,7 +121,15 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation @@ -121,7 +121,15 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation
flags[FlagPartialMethod] = value;
}
}
public bool IsAsync {
get { return flags[FlagAsyncMethod]; }
set {
ThrowIfFrozen();
flags[FlagAsyncMethod] = value;
}
}
public bool HasBody {
get { return flags[FlagHasBody]; }
set {

4
ICSharpCode.NRefactory/TypeSystem/Implementation/SpecializedMethod.cs

@ -125,6 +125,10 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation @@ -125,6 +125,10 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation
get { return methodDefinition.IsPartial; }
}
public bool IsAsync {
get { return methodDefinition.IsAsync; }
}
public bool HasBody {
get { return methodDefinition.HasBody; }
}

Loading…
Cancel
Save