mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Model var as a pattern operator (#4720)
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
co-authored by
Richard Smith
parent
6572da7314
commit
13434f0e8a
@@ -25,6 +25,8 @@ var p: Incomplete* = &a[0];
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete [template]
|
||||
// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template]
|
||||
// CHECK:STDOUT: %array_type: type = array_type %int_1, %Incomplete [template]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %Incomplete [template]
|
||||
// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -45,9 +47,26 @@ var p: Incomplete* = &a[0];
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %Incomplete.decl: type = class_decl @Incomplete [template = constants.%Incomplete] {} {}
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %a.patt: <error> = binding_pattern a
|
||||
// CHECK:STDOUT: %.loc20_1: <error> = var_pattern %a.patt
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %a.var: ref <error> = var a
|
||||
// CHECK:STDOUT: %a: ref <error> = bind_name a, %a.var
|
||||
// CHECK:STDOUT: %.loc20_22: type = splice_block %array_type [template = constants.%array_type] {
|
||||
// CHECK:STDOUT: %Incomplete.ref.loc20: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete]
|
||||
// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1]
|
||||
// CHECK:STDOUT: %array_type: type = array_type %int_1, %Incomplete [template = constants.%array_type]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %a: <error> = bind_name a, <error>
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %p.patt: %ptr = binding_pattern p
|
||||
// CHECK:STDOUT: %.loc22_1: %ptr = var_pattern %p.patt
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %p.var: ref %ptr = var p
|
||||
// CHECK:STDOUT: %.loc22_18: type = splice_block %ptr [template = constants.%ptr] {
|
||||
// CHECK:STDOUT: %Incomplete.ref.loc22: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %Incomplete [template = constants.%ptr]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %p: ref %ptr = bind_name p, %p.var
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -55,7 +74,7 @@ var p: Incomplete* = &a[0];
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @__global_init() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %a.ref: ref <error> = name_ref a, file.%a
|
||||
// CHECK:STDOUT: %a.ref: <error> = name_ref a, file.%a
|
||||
// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0]
|
||||
// CHECK:STDOUT: %addr: <error> = addr_of <error> [template = <error>]
|
||||
// CHECK:STDOUT: assign file.%p.var, <error>
|
||||
|
||||
Reference in New Issue
Block a user