mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-30 20:15:01 +01:00
Consume the components of the `impl` declaration, and set up scopes for the child elements. We don't yet build a representation for the impl itself. Also, add an interface type value. This is necessary so that we have a value for the expression on the right-hand side of `as` in an `impl`.
51 lines
1.4 KiB
Plaintext
51 lines
1.4 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
|
|
|
|
interface Simple {
|
|
fn F();
|
|
}
|
|
|
|
class C {
|
|
impl as Simple {
|
|
fn F() {}
|
|
}
|
|
}
|
|
|
|
// CHECK:STDOUT: --- impl_as.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %C: type = class_type @C [template]
|
|
// CHECK:STDOUT: %.1: type = interface_type @Simple [template]
|
|
// CHECK:STDOUT: %.2: type = struct_type {} [template]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace {.Simple = %Simple.decl, .C = %C.decl} [template]
|
|
// CHECK:STDOUT: %Simple.decl = interface_decl @Simple, ()
|
|
// CHECK:STDOUT: %C.decl = class_decl @C, ()
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: interface @Simple {
|
|
// CHECK:STDOUT: %F: <function> = fn_decl @F.1 [template]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .F = %F
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @C {
|
|
// CHECK:STDOUT: %F: <function> = fn_decl @F.2 [template]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @F.1();
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @F.2() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|