different array literal syntax when inferring the size

old syntax:  []i32{1, 2, 3}
new syntax: [_]i32{1, 2, 3}

closes #1797
This commit is contained in:
Andrew Kelley
2019-06-09 19:24:24 -04:00
parent 10e33b3536
commit b735764898
106 changed files with 87054 additions and 86934 deletions

View File

@@ -239,6 +239,8 @@ static const char *node_type_str(NodeType node_type) {
return "ContainerInitExpr";
case NodeTypeArrayType:
return "ArrayType";
case NodeTypeInferredArrayType:
return "InferredArrayType";
case NodeTypeErrorType:
return "ErrorType";
case NodeTypeIfErrorExpr:
@@ -848,6 +850,12 @@ static void render_node_extra(AstRender *ar, AstNode *node, bool grouped) {
render_node_ungrouped(ar, node->data.array_type.child_type);
break;
}
case NodeTypeInferredArrayType:
{
fprintf(ar->f, "[_]");
render_node_ungrouped(ar, node->data.inferred_array_type.child_type);
break;
}
case NodeTypePromiseType:
{
fprintf(ar->f, "promise");