mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Emit NameBindingDecl after the initializer (if any) (#7467)
In some cases the pattern block can depend on the initializer, so it must be sequenced after it. See #7469 for a more detailed explanation of why this is necessary.
This commit is contained in:
@@ -129,14 +129,14 @@ fn F() {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %x.patt: <error> = ref_binding_pattern x [concrete = <error>]
|
||||
// CHECK:STDOUT: %x.var_patt: <error> = var_pattern %x.patt [concrete = <error>]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %x.var: ref <error> = var_storage %x.var_patt [concrete = <error>]
|
||||
// CHECK:STDOUT: assign %x.var, <error>
|
||||
// CHECK:STDOUT: %MyStructAlias.ref: type = name_ref MyStructAlias, imports.%Main.MyStructAlias [concrete = <error>]
|
||||
// CHECK:STDOUT: %x: <error> = wrapper_binding x, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %x.patt: <error> = ref_binding_pattern x [concrete = <error>]
|
||||
// CHECK:STDOUT: %x.var_patt: <error> = var_pattern %x.patt [concrete = <error>]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %x.ref: <error> = name_ref x, %x [concrete = <error>]
|
||||
// CHECK:STDOUT: %Foo.ref: <error> = name_ref Foo, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: <elided>
|
||||
|
||||
@@ -278,10 +278,6 @@ fn UseZ() -> Cpp.A.Z {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Use() -> out %return.param: %tuple.type.e55 {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %ax.patt: %pattern_type.88a = ref_binding_pattern ax [concrete = constants.%ax.patt]
|
||||
// CHECK:STDOUT: %ax.var_patt: %pattern_type.88a = var_pattern %ax.patt [concrete = constants.%ax.var_patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %ax.var: ref %X = var_storage %ax.var_patt
|
||||
// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
|
||||
// CHECK:STDOUT: %.loc9_3.1: ref %X = splice_block %ax.var {}
|
||||
@@ -299,6 +295,10 @@ fn UseZ() -> Cpp.A.Z {
|
||||
// CHECK:STDOUT: assign %ax.var, %.loc9_3.3
|
||||
// CHECK:STDOUT: %AX.ref: type = name_ref AX, imports.%Main.AX [concrete = constants.%X]
|
||||
// CHECK:STDOUT: %ax: ref %X = wrapper_binding ax, %ax.var
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %ax.patt: %pattern_type.88a = ref_binding_pattern ax [concrete = constants.%ax.patt]
|
||||
// CHECK:STDOUT: %ax.var_patt: %pattern_type.88a = var_pattern %ax.patt [concrete = constants.%ax.var_patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %ax.ref.loc10_11: ref %X = name_ref ax, %ax
|
||||
// CHECK:STDOUT: %x.ref: %X.elem = name_ref x, @X.%.1 [concrete = @X.%.1]
|
||||
// CHECK:STDOUT: %.loc10_13.1: ref %i32 = class_element_access %ax.ref.loc10_11, element0
|
||||
|
||||
Reference in New Issue
Block a user