mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 08:31:04 +01:00
Change struct literal parsing to use placeholders. (#3850)
This is achieving a similar goal as #3849, using placeholders instead of an ambiguous start node to clarify structure and incrementally simplify checking. The benefit isn't quite as big here because both paths are structs, and so checking is more consistent than paren exprs versus tuples. But I think this removes the only other multi-purpose parse node. This uses StructLiteral/StructTypeLiteral naming, reflecting equivalent SemIR naming. Note, I would lean towards renaming StructLiteral to StructValueLiteral, but I think consistency in naming takes precedence. Any renames of StructLiteral might be better in a separate PR. StructFieldType/StructFieldValue -> StructTypeField/StructField is trying to making the reading more consistent with StructTypeLiteral/StructLiteral. SemIR has StructTypeField but not a value equivalent.
This commit is contained in:
+2
-2
@@ -14,13 +14,13 @@ var x: {,} = {};
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: ',', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'StructComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', has_error: yes, subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 11},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
@@ -14,18 +14,18 @@ var x: {.a: i32,,} = {};
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldType', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeField', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: ',', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'StructComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteral', text: '}', has_error: yes, subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 11},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 16},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
@@ -14,18 +14,18 @@ var x: {.a = 0,,} = {};
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '0'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldValue', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructField', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: ',', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'StructComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', has_error: yes, subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 11},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 16},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
+2
-2
@@ -14,14 +14,14 @@ var x: {.} = {};
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: '}', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: '.', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', has_error: yes, subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 12},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ var x: {.(a) = 1};
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: '(', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '1'},
|
||||
|
||||
@@ -14,7 +14,7 @@ var x: {."hello": i32, .y: i32} = {};
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: '"hello"', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
@@ -23,11 +23,11 @@ var x: {."hello": i32, .y: i32} = {};
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'y'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldType', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeField', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteral', text: '}', has_error: yes, subtree_size: 11},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 13},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 18},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
@@ -14,7 +14,7 @@ var x: {."hello" = 0, .y = 4} = {};
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: '"hello"', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '0'},
|
||||
@@ -23,11 +23,11 @@ var x: {."hello" = 0, .y = 4} = {};
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'y'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '4'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldValue', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructField', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', has_error: yes, subtree_size: 11},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 13},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 18},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
@@ -14,19 +14,19 @@ var x: {.a: i32 banana} = {.a = 0};
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldType', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeField', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteral', text: '}', has_error: yes, subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '0'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldValue', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructField', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 17},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
@@ -14,19 +14,19 @@ var x: {.a: i32} = {.a = 0 banana};
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldType', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeField', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteral', text: '}', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '0'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldValue', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructField', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', has_error: yes, subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 17},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
@@ -14,12 +14,12 @@ var x: {a:} = {};
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: 'a', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 10},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
@@ -14,12 +14,12 @@ var x: {a=} = {};
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: 'a', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 10},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
@@ -14,12 +14,12 @@ var x: {a} = {};
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: 'a', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 10},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
@@ -14,7 +14,7 @@ var x: {.a:} = {};
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: '}', has_error: yes},
|
||||
@@ -22,7 +22,7 @@ var x: {.a:} = {};
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteral', text: '}', has_error: yes, subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 13},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
@@ -14,7 +14,7 @@ var x: {.a=} = {};
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: '}', has_error: yes},
|
||||
@@ -22,7 +22,7 @@ var x: {.a=} = {};
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', has_error: yes, subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 13},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
@@ -14,11 +14,11 @@ var x: {.a: i32, .b = 0} = {};
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldType', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeField', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
@@ -26,7 +26,7 @@ var x: {.a: i32, .b = 0} = {};
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteral', text: '}', has_error: yes, subtree_size: 10},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 12},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 17},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
@@ -14,17 +14,17 @@ var x: {.a = 0, b: i32} = {};
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '0'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldValue', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructField', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: 'b', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', has_error: yes, subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 10},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 15},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
@@ -31,11 +31,11 @@ var x: i32 = {.a: i32, .b, .c = 1};
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '1'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldValue', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructField', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
@@ -51,11 +51,11 @@ var x: i32 = {.a: i32, .b, .c = 1};
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldType', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeField', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
|
||||
@@ -14,14 +14,14 @@ var x: {.a} = {};
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: '.', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', has_error: yes, subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 12},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
@@ -14,12 +14,12 @@ var x: {i32} = {};
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: 'i32', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 10},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
+2
-2
@@ -11,11 +11,11 @@ var y: {} = {};
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'y'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
@@ -11,19 +11,19 @@ var z: {.n: i32} = {.n = 4};
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'z'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldType', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeField', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteral', text: '}', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '4'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldValue', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructField', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 17},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
@@ -11,20 +11,20 @@ var z: {.n: i32,} = {.n = 4,};
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'z'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldType', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeField', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteral', text: '}', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '4'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldValue', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructField', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 19},
|
||||
|
||||
+6
-6
@@ -11,29 +11,29 @@ var x: {.a: i32, .b: i32} = {.a = 1, .b = 2};
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldType', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeField', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldType', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeField', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteral', text: '}', subtree_size: 11},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 13},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '1'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldValue', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructField', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '2'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldValue', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructField', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 11},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 27},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
|
||||
Reference in New Issue
Block a user