mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 07:54:41 +01:00
Switch VariableInitializer order to accommodate GlobalInit (#3708)
This undoes parts of #3515 in order to allow PushGlobalInit to be called when the initializer is called, instead of at the end of the binding pattern. The current approach is fragile because supported patterns will become more complex. We also will likely want similar support in `let`, which puts the initializer first, so this offers a consistent approach for both. [Looking back](https://discord.com/channels/655572317891461132/655578254970716160/1184237511766179840), this is more or less the second option in that message, but using the PeekNextIs to avoid vagueness about what's being popped first. Note I'm putting in PeekNextIs for what I'm hoping will be a pretty narrow use-case. I could've added depth arguments to the Peek functions, but that would've rippled through a number of APIs and it's not clear to me that this has generic utility. I mean, right now it could just be PeekNextIsVariableInitializer, since it's only optional in that case.
This commit is contained in:
+3
-3
@@ -19,9 +19,9 @@ var x: {,} = {};
|
||||
// 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: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 11},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -24,9 +24,9 @@ var x: {.a: i32,,} = {};
|
||||
// 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: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 16},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -24,9 +24,9 @@ var x: {.a = 0,,} = {};
|
||||
// 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: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 16},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
+3
-3
@@ -20,9 +20,9 @@ var x: {.} = {};
|
||||
// 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: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 12},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -26,9 +26,9 @@ var x: {."hello": i32, .y: i32} = {};
|
||||
// CHECK:STDOUT: {kind: 'StructFieldType', 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: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 18},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -26,9 +26,9 @@ var x: {."hello" = 0, .y = 4} = {};
|
||||
// CHECK:STDOUT: {kind: 'StructFieldValue', 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: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 18},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -21,13 +21,13 @@ var x: {.a: i32 banana} = {.a = 0};
|
||||
// CHECK:STDOUT: {kind: 'StructFieldType', 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: 'StructLiteralOrStructTypeLiteralStart', 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: 'StructLiteral', text: '}', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', 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: 'StructLiteral', text: '}', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 17},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -21,13 +21,13 @@ var x: {.a: i32} = {.a = 0 banana};
|
||||
// CHECK:STDOUT: {kind: 'StructFieldType', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteral', text: '}', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', 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: 'StructLiteral', text: '}', has_error: yes, subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', 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: 'StructLiteral', text: '}', has_error: yes, subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 17},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -18,9 +18,9 @@ var x: {a:} = {};
|
||||
// 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: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 10},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -18,9 +18,9 @@ var x: {a=} = {};
|
||||
// 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: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 10},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -18,9 +18,9 @@ var x: {a} = {};
|
||||
// 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: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 10},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -21,9 +21,9 @@ var x: {.a:} = {};
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: ':', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteral', text: '}', has_error: yes, subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 13},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -21,9 +21,9 @@ var x: {.a=} = {};
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: '=', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', has_error: yes, subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 13},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -25,9 +25,9 @@ var x: {.a: i32, .b = 0} = {};
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: '.', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteral', text: '}', has_error: yes, subtree_size: 10},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 12},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 17},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -23,9 +23,9 @@ var x: {.a = 0, b: i32} = {};
|
||||
// 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: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 15},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
+28
-28
@@ -27,41 +27,41 @@ var x: i32 = {.a: i32, .b, .c = 1};
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', 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: 'StructComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', 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: 'StructComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'c'},
|
||||
// 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: 14},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 15},
|
||||
// CHECK:STDOUT: {kind: 'IntLiteral', text: '1'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldValue', 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: 'InvalidParse', text: '.', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'StructComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'c'},
|
||||
// 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: 14},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 20},
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', 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: 'StructComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', 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: 'StructComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'c'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: '.', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteral', text: '}', has_error: yes, subtree_size: 14},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 15},
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldType', 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: 'InvalidParse', text: '.', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'StructComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'c'},
|
||||
// CHECK:STDOUT: {kind: 'StructFieldDesignator', text: '.', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: '.', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteral', text: '}', has_error: yes, subtree_size: 14},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 20},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -20,9 +20,9 @@ var x: {.a} = {};
|
||||
// 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: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 12},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -18,9 +18,9 @@ var x: {i32} = {};
|
||||
// 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: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 10},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
+3
-3
@@ -14,9 +14,9 @@ var y: {} = {};
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -18,13 +18,13 @@ var z: {.n: i32} = {.n = 4};
|
||||
// CHECK:STDOUT: {kind: 'StructFieldType', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteral', text: '}', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', 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: 'StructLiteral', text: '}', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', 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: 'StructLiteral', text: '}', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 17},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -19,14 +19,14 @@ var z: {.n: i32,} = {.n = 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: 'StructLiteralOrStructTypeLiteralStart', 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: 'StructComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', 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: 'StructComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 19},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
+12
-12
@@ -23,18 +23,18 @@ var x: {.a: i32, .b: i32} = {.a = 1, .b = 2};
|
||||
// CHECK:STDOUT: {kind: 'StructFieldType', text: ':', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'StructTypeLiteral', text: '}', subtree_size: 11},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 13},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', 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: '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: 'StructLiteral', text: '}', subtree_size: 11},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 12},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
|
||||
// CHECK:STDOUT: {kind: 'StructLiteralOrStructTypeLiteralStart', 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: '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: 'StructLiteral', text: '}', subtree_size: 11},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ';', subtree_size: 27},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
Reference in New Issue
Block a user