mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 08:54:47 +01:00
Factor out a Pattern sum type from Expression (#685)
`Pattern` is intended to pilot some changes I would like to apply to all our sum types: - The alternatives are expressed as derived classes rather than members of a `std::variant`. - The alternatives are classes in the [style guide sense](https://google.github.io/styleguide/cppguide.html#Structs_vs._Classes), meaning they can have invariants, but can't have public data members. - Creating an object is expressed using a constructor rather than a factory function. - Accessing an alternative is expressed as a cast (using LLVM's RTTI system) rather than `std::get` or a `Get` method. 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
b08f6bb0f1
commit
6ac3adfa53
@@ -42,23 +42,7 @@ cc_library(
|
||||
|
||||
cc_library(
|
||||
name = "paren_contents",
|
||||
srcs = ["paren_contents.cpp"],
|
||||
hdrs = ["paren_contents.h"],
|
||||
deps = ["//executable_semantics/ast:expression"],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "paren_contents_test",
|
||||
srcs = ["paren_contents_test.cpp"],
|
||||
env = {
|
||||
# TODO(#580): Remove this when leaks are fixed.
|
||||
"ASAN_OPTIONS": "detect_leaks=0",
|
||||
},
|
||||
deps = [
|
||||
":paren_contents",
|
||||
"@llvm-project//llvm:gtest",
|
||||
"@llvm-project//llvm:gtest_main",
|
||||
],
|
||||
)
|
||||
|
||||
genrule(
|
||||
|
||||
Reference in New Issue
Block a user