Files
carbon-lang/executable_semantics/ast/member.cpp
T
Geoff Romer 7a5b8434c8 Define a base class for all AST nodes. (#947)
Also implement code-generation to manage the resulting boilerplate.
2021-11-16 11:54:47 -08:00

26 lines
639 B
C++

// 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
#include "executable_semantics/ast/member.h"
#include "executable_semantics/common/arena.h"
#include "llvm/Support/Casting.h"
namespace Carbon {
using llvm::cast;
Member::~Member() = default;
void Member::Print(llvm::raw_ostream& out) const {
switch (kind()) {
case MemberKind::FieldMember:
const auto& field = cast<FieldMember>(*this);
out << "var " << field.binding() << ";\n";
break;
}
}
} // namespace Carbon