Skip to content

Commit deb1e49

Browse files
committed
Expression trees: optional arguments
1 parent 4ff7d42 commit deb1e49

File tree

3 files changed

+514
-21
lines changed

3 files changed

+514
-21
lines changed

src/Compilers/CSharp/Portable/CSharpResources.resx

+1
Original file line numberDiff line numberDiff line change
@@ -4062,6 +4062,7 @@ You should consider suppressing the warning only if you're sure that you don't w
40624062
<value>Named argument '{0}' is used out-of-position but is followed by an unnamed argument</value>
40634063
</data>
40644064
<data name="ERR_DefaultValueUsedWithAttributes" xml:space="preserve">
4065+
<!-- PROTOTYPE: Should be "DefaultParameterValueAttribute". -->
40654066
<value>Cannot specify default parameter value in conjunction with DefaultParameterAttribute or OptionalAttribute</value>
40664067
</data>
40674068
<data name="ERR_DefaultValueMustBeConstant" xml:space="preserve">

src/Compilers/CSharp/Portable/Lowering/DiagnosticsPass_ExpressionTrees.cs

-21
Original file line numberDiff line numberDiff line change
@@ -328,14 +328,6 @@ private void VisitCall(
328328
{
329329
Error(ErrorCode.ERR_ExpressionTreeContainsIndexedProperty, node);
330330
}
331-
else if (hasDefaultArgument(arguments, defaultArguments))
332-
{
333-
Error(ErrorCode.ERR_ExpressionTreeContainsOptionalArgument, node);
334-
}
335-
else if (!argumentNamesOpt.IsDefaultOrEmpty)
336-
{
337-
Error(ErrorCode.ERR_ExpressionTreeContainsNamedArgument, node);
338-
}
339331
else if (IsComCallWithRefOmitted(method, arguments, argumentRefKindsOpt))
340332
{
341333
Error(ErrorCode.ERR_ComRefCallInExpressionTree, node);
@@ -353,19 +345,6 @@ private void VisitCall(
353345
Error(ErrorCode.ERR_ExpressionTreeContainsAbstractStaticMemberAccess, node);
354346
}
355347
}
356-
357-
static bool hasDefaultArgument(ImmutableArray<BoundExpression> arguments, BitVector defaultArguments)
358-
{
359-
for (int i = 0; i < arguments.Length; i++)
360-
{
361-
if (defaultArguments[i])
362-
{
363-
return true;
364-
}
365-
}
366-
367-
return false;
368-
}
369348
}
370349

371350
public override BoundNode Visit(BoundNode node)

0 commit comments

Comments
 (0)