mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
Move pattern interpretation to compile time (#904)
Co-authored-by: Jon Meow <46229924+jonmeow@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
co-authored by
Jon Meow
parent
629cfb8c4d
commit
79e3d284b4
@@ -212,7 +212,7 @@ void Value::Print(llvm::raw_ostream& out) const {
|
||||
out << (cast<BoolValue>(*this).value() ? "true" : "false");
|
||||
break;
|
||||
case Value::Kind::FunctionValue:
|
||||
out << "fun<" << cast<FunctionValue>(*this).name() << ">";
|
||||
out << "fun<" << cast<FunctionValue>(*this).declaration().name() << ">";
|
||||
break;
|
||||
case Value::Kind::PointerValue:
|
||||
out << "ptr<" << cast<PointerValue>(*this).value() << ">";
|
||||
@@ -392,9 +392,9 @@ auto ValueEqual(Nonnull<const Value*> v1, Nonnull<const Value*> v2,
|
||||
return cast<PointerValue>(*v1).value() == cast<PointerValue>(*v2).value();
|
||||
case Value::Kind::FunctionValue: {
|
||||
std::optional<Nonnull<const Statement*>> body1 =
|
||||
cast<FunctionValue>(*v1).body();
|
||||
cast<FunctionValue>(*v1).declaration().body();
|
||||
std::optional<Nonnull<const Statement*>> body2 =
|
||||
cast<FunctionValue>(*v2).body();
|
||||
cast<FunctionValue>(*v2).declaration().body();
|
||||
return body1.has_value() == body2.has_value() &&
|
||||
(!body1.has_value() || *body1 == *body2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user