提交 1a2d6388 编写于 作者: V vsadov

fixes after merge

上级 b23943ed
......@@ -2075,21 +2075,25 @@ private AssemblySymbol GetForwardedToAssembly(string fullName, int arity, Diagno
internal static bool CheckFeatureAvailability(SyntaxNode syntax, MessageID feature, DiagnosticBag diagnostics, Location locationOpt = null)
{
CSDiagnosticInfo error = GetFeatureAvailabilityDiagnosticInfo(syntax, feature);
return CheckFeatureAvailability(syntax.SyntaxTree, feature, diagnostics, locationOpt ?? syntax.GetLocation());
}
internal static bool CheckFeatureAvailability(SyntaxTree tree, MessageID feature, DiagnosticBag diagnostics, Location location)
{
CSDiagnosticInfo error = GetFeatureAvailabilityDiagnosticInfo(tree, feature);
if (error is null)
{
return true;
}
var location = locationOpt ?? syntax.GetLocation();
diagnostics.Add(new CSDiagnostic(error, location));
return false;
}
internal static bool CheckFeatureAvailability(SyntaxNode syntax, MessageID feature, ref HashSet<DiagnosticInfo> useSiteDiagnostics)
{
CSDiagnosticInfo error = GetFeatureAvailabilityDiagnosticInfo(syntax, feature);
CSDiagnosticInfo error = GetFeatureAvailabilityDiagnosticInfo(syntax.SyntaxTree, feature);
if (error is null)
{
......@@ -2100,9 +2104,9 @@ internal static bool CheckFeatureAvailability(SyntaxNode syntax, MessageID featu
return false;
}
private static CSDiagnosticInfo GetFeatureAvailabilityDiagnosticInfo(SyntaxNode syntax, MessageID feature)
private static CSDiagnosticInfo GetFeatureAvailabilityDiagnosticInfo(SyntaxTree tree, MessageID feature)
{
CSharpParseOptions options = (CSharpParseOptions)syntax.SyntaxTree.Options;
CSharpParseOptions options = (CSharpParseOptions)tree.Options;
if (options.IsFeatureEnabled(feature))
{
......
......@@ -116,7 +116,7 @@ internal partial class BoundStackAllocArrayCreation
internal partial class BoundConvertedStackAllocExpression
{
protected override ImmutableArray<IOperation> Children => ImmutableArray.Create<IOperation>(this.Count);
protected override ImmutableArray<BoundNode> Children => ImmutableArray.Create<BoundNode>(this.Count);
}
internal partial class BoundDynamicObjectCreationExpression
......
......@@ -23,13 +23,11 @@ protected struct Flags
{
// We currently pack everything into a 32 bit int with the following layout:
//
// | |s|r|q|z|y|xxxxxxxxxxxxxxxxxxxxxx|wwwww|
// | |s|r|q|z|xxxxxxxxxxxxxxxxxxxxxxx|wwwww|
//
// w = method kind. 5 bits.
//
// x = modifiers. 22 bits.
//
// y = returnsVoid. 1 bit.
// x = modifiers. 23 bits.
//
// z = isExtensionMethod. 1 bit.
//
......@@ -43,7 +41,7 @@ protected struct Flags
private const int DeclarationModifiersOffset = 5;
private const int MethodKindMask = 0x1F;
private const int DeclarationModifiersMask = 0x3FFFFF;
private const int DeclarationModifiersMask = 0x7FFFFF;
private const int ReturnsVoidBit = 1 << 27;
private const int IsExtensionMethodBit = 1 << 28;
......@@ -52,11 +50,12 @@ protected struct Flags
private const int IsMetadataVirtualLockedBit = 1 << 31;
private int _flags;
private bool _returnsVoid;
public bool ReturnsVoid
{
get { return (_flags & ReturnsVoidBit) != 0; }
set { _flags = value ? (_flags | ReturnsVoidBit) : (_flags & ~ReturnsVoidBit); }
get { return _returnsVoid; }
set { _returnsVoid = value; }
}
public MethodKind MethodKind
......@@ -115,12 +114,12 @@ private static bool ModifiersRequireMetadataVirtual(DeclarationModifiers modifie
int methodKindInt = ((int)methodKind & MethodKindMask) << MethodKindOffset;
int declarationModifiersInt = ((int)declarationModifiers & DeclarationModifiersMask) << DeclarationModifiersOffset;
int returnsVoidInt = returnsVoid ? ReturnsVoidBit : 0;
int isExtensionMethodInt = isExtensionMethod ? IsExtensionMethodBit : 0;
int isMetadataVirtualIgnoringInterfaceImplementationChangesInt = isMetadataVirtual ? IsMetadataVirtualIgnoringInterfaceChangesBit : 0;
int isMetadataVirtualInt = isMetadataVirtual ? IsMetadataVirtualBit : 0;
_flags = methodKindInt | declarationModifiersInt | returnsVoidInt | isExtensionMethodInt | isMetadataVirtualIgnoringInterfaceImplementationChangesInt | isMetadataVirtualInt;
_flags = methodKindInt | declarationModifiersInt | isExtensionMethodInt | isMetadataVirtualIgnoringInterfaceImplementationChangesInt | isMetadataVirtualInt;
_returnsVoid = returnsVoid;
}
public bool IsMetadataVirtual(bool ignoreInterfaceImplementationChanges = false)
......
......@@ -1264,9 +1264,9 @@ Type Arguments(0)
// file.cs(7,15): error CS1978: Cannot use an expression of type '__arglist' as an argument to a dynamically dispatched operation.
// d.Goo(__arglist(123, 456));
Diagnostic(ErrorCode.ERR_BadDynamicMethodArg, "__arglist(123, 456)").WithArguments("__arglist").WithLocation(7, 15),
// file.cs(8,31): error CS1738: Named argument specifications must appear after all fixed arguments have been specified. Please use language version 7.2 or greater to allow non-trailing named arguments.
// file.cs(8,31): error CS8324: Named argument specifications must appear after all fixed arguments have been specified in a dynamic invocation.
// d.Goo(x: 123, y: 456, 789);
Diagnostic(ErrorCode.ERR_NamedArgumentSpecificationBeforeFixedArgument, "789").WithArguments("7.2").WithLocation(8, 31),
Diagnostic(ErrorCode.ERR_NamedArgumentSpecificationBeforeFixedArgumentInDynamicInvocation, "789").WithLocation(8, 31),
// file.cs(10,25): error CS1978: Cannot use an expression of type 'void' as an argument to a dynamically dispatched operation.
// /*<bind>*/d.Goo(System.Console.WriteLine());/*</bind>*/
Diagnostic(ErrorCode.ERR_BadDynamicMethodArg, "System.Console.WriteLine()").WithArguments("void").WithLocation(10, 25),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册