Add support for _ placeholder. (#661)

Co-authored-by: Jon Meow <46229924+jonmeow@users.noreply.github.com>
This commit is contained in:
Geoff Romer
2021-07-19 10:33:06 -07:00
committed by GitHub
co-authored by Jon Meow
parent c3c89a77a4
commit def98d1182
15 changed files with 88 additions and 20 deletions
+4 -3
View File
@@ -110,7 +110,8 @@ struct TupleValue {
struct BindingPlaceholderValue {
static constexpr ValKind Kind = ValKind::BindingPlaceholderValue;
std::string name;
// nullopt represents the `_` placeholder
std::optional<std::string> name;
const Value* type;
};
@@ -183,8 +184,8 @@ struct Value {
static auto MakeAlternativeConstructorValue(std::string alt_name,
std::string choice_name)
-> const Value*;
static auto MakeBindingPlaceholderValue(std::string name, const Value* type)
-> const Value*;
static auto MakeBindingPlaceholderValue(std::optional<std::string> name,
const Value* type) -> const Value*;
static auto MakeIntType() -> const Value*;
static auto MakeContinuationType() -> const Value*;
static auto MakeAutoType() -> const Value*;