diff options
author | John Hodge <tpg@ucc.asn.au> | 2019-07-21 14:15:51 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2019-07-21 14:15:51 +0800 |
commit | fa115063f9bbbded2463b0057d5dd4b8d1ab0483 (patch) | |
tree | 061e9096c320ed2f34b2eae646015e0020db613c /src | |
parent | a0f277b39dc1eae29d1734b67240a90eb64dbece (diff) | |
download | mrust-fa115063f9bbbded2463b0057d5dd4b8d1ab0483.tar.gz |
Parse - Handle converting byte string :expr fragments into patterns
Diffstat (limited to 'src')
-rw-r--r-- | src/parse/pattern.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/parse/pattern.cpp b/src/parse/pattern.cpp index 37b78123..cd73c378 100644 --- a/src/parse/pattern.cpp +++ b/src/parse/pattern.cpp @@ -251,9 +251,9 @@ AST::Pattern Parse_PatternReal1(TokenStream& lex, bool is_refutable) if( auto* n = dynamic_cast<AST::ExprNode_String*>(e.get()) ) { return AST::Pattern( AST::Pattern::TagValue(), lex.end_span(ps), AST::Pattern::Value::make_String( mv$(n->m_value) ) ); } - //else if( auto* n = dynamic_cast<AST::ExprNode_ByteString*>(e.get()) ) { - // return AST::Pattern( AST::Pattern::TagValue(), lex.end_span(ps), AST::Pattern::Value::make_ByteString( mv$(n->m_value) ) ); - //} + else if( auto* n = dynamic_cast<AST::ExprNode_ByteString*>(e.get()) ) { + return AST::Pattern( AST::Pattern::TagValue(), lex.end_span(ps), AST::Pattern::Value::make_ByteString({ mv$(n->m_value) }) ); + } else if( auto* n = dynamic_cast<AST::ExprNode_Bool*>(e.get()) ) { return AST::Pattern( AST::Pattern::TagValue(), lex.end_span(ps), AST::Pattern::Value::make_Integer({CORETYPE_BOOL, n->m_value}) ); } |