提交 662deba9 编写于 作者: N Neal Gafter

Correct diagnostic argument for "wrong number of subpatterns".

Fixes a crash during LDM demo.
上级 4fbf77eb
......@@ -469,7 +469,7 @@ private BoundPattern BindDeconstructionPattern(DeconstructionPatternSyntax node,
if (elementTypes.Length != node.SubPatterns.Count && !hasErrors)
{
var location = new SourceLocation(node.SyntaxTree, new Text.TextSpan(node.OpenParenToken.SpanStart, node.CloseParenToken.Span.End - node.OpenParenToken.SpanStart));
diagnostics.Add(ErrorCode.ERR_WrongNumberOfSubpatterns, location, declType.TupleElementTypes, elementTypes.Length, node.SubPatterns.Count);
diagnostics.Add(ErrorCode.ERR_WrongNumberOfSubpatterns, location, declType, elementTypes.Length, node.SubPatterns.Count);
hasErrors = true;
}
for (int i = 0; i < node.SubPatterns.Count; i++)
......
......@@ -373,7 +373,7 @@ private BoundExpression MakeEqual(BoundExpression loweredLiteral, BoundExpressio
// (though perhaps its component parts are used), then we can save the component parts
// and assign them into temps (or perhaps user variables) to avoid the creation of
// the tuple altogether.
decisionDag = RewriteTupleSwitch(decisionDag, (BoundTupleLiteral)loweredInput, addCode);
decisionDag = RewriteTupleInput(decisionDag, (BoundTupleLiteral)loweredInput, addCode);
}
else
{
......@@ -416,7 +416,7 @@ bool usesOriginalInput(BoundDecisionDagNode node)
/// itself. We also emit assignments of the tuple values into their corresponding temps.
/// </summary>
/// <returns>A new decision dag that does not reference the input directly</returns>
private BoundDecisionDag RewriteTupleSwitch(
private BoundDecisionDag RewriteTupleInput(
BoundDecisionDag decisionDag,
BoundTupleLiteral loweredInput,
Action<BoundExpression> addCode)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册