Adjust how invalid declarations pass errors. (#2413)

When there's no semicolon for an invalid EmptyDeclaration, rather than producing nothing, produce an EmptyDeclaration with the original location that led to the error.

Note this removes a direct edit (the only one) of the parse tree's error state. Elsewhere it's an indirection from adding an error node.
This commit is contained in:
Jon Ross-Perkins
2022-11-18 08:02:07 -08:00
committed by GitHub
parent 4c8fdf5124
commit d9ce1827c8
3 changed files with 8 additions and 5 deletions
@@ -5,6 +5,7 @@
// AUTOUPDATE
// RUN: %{not} %{carbon-run-parser}
// CHECK:STDOUT: [
// CHECK:STDOUT: {kind: 'EmptyDeclaration', text: 'struct', has_error: yes},
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'F'},
// CHECK:STDOUT: {kind: 'ParameterListStart', text: '('},