From 8a74857d5a6323a46757f12078b46718464a006d Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 4 May 2019 17:36:07 +0800 Subject: Match Ergonomics - Auto-deref in `ref` patterns to get `&T` --- src/hir/pattern.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/hir/pattern.hpp') diff --git a/src/hir/pattern.hpp b/src/hir/pattern.hpp index cd6c7422..d16fd942 100644 --- a/src/hir/pattern.hpp +++ b/src/hir/pattern.hpp @@ -32,19 +32,23 @@ struct PatternBinding ::std::string m_name; unsigned int m_slot; + unsigned m_implicit_deref_count = 0; + bool is_valid() const { return m_name != ""; } PatternBinding(): m_mutable(false), m_type(Type::Move), m_name(""), - m_slot(0) + m_slot(0), + m_implicit_deref_count(0) {} PatternBinding(bool mut, Type type, ::std::string name, unsigned int slot): m_mutable(mut), m_type(type), m_name( mv$(name) ), - m_slot( slot ) + m_slot( slot ), + m_implicit_deref_count(0) {} }; -- cgit v1.2.3