Files
carbon-lang/toolchain/check/testdata/function/call/i32.carbon
T
Richard Smith 7f2f4bec4f Add a Field node for fields in a class. (#3332)
This replaces the use of `VarStorage` in this case.

Add an `UnboundFieldType` type as the type of a field, in cases where
it's referenced without an accompanying object.

Add a `BindName` node to describe the name binding performed for both
variables and fields so that we can handle them more uniformly.
2023-10-25 18:49:36 +00:00

36 lines
1.1 KiB
Plaintext

// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
fn Echo(a: i32) -> i32 {
return a;
}
fn Main() {
var b: i32 = Echo(1);
}
// CHECK:STDOUT: file "i32.carbon" {
// CHECK:STDOUT: %Echo: <function> = fn_decl @Echo
// CHECK:STDOUT: %Main: <function> = fn_decl @Main
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Echo(%a: i32) -> i32 {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %a.ref: i32 = name_reference "a", %a
// CHECK:STDOUT: return %a.ref
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Main() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %b.var: ref i32 = var "b"
// CHECK:STDOUT: %b: ref i32 = bind_name "b", %b.var
// CHECK:STDOUT: %Echo.ref: <function> = name_reference "Echo", file.%Echo
// CHECK:STDOUT: %.loc12_21: i32 = int_literal 1
// CHECK:STDOUT: %.loc12_20: init i32 = call %Echo.ref(%.loc12_21)
// CHECK:STDOUT: assign %b.var, %.loc12_20
// CHECK:STDOUT: return
// CHECK:STDOUT: }