summaryrefslogtreecommitdiff
path: root/src/parse
diff options
context:
space:
mode:
Diffstat (limited to 'src/parse')
-rw-r--r--src/parse/expr.cpp2
-rw-r--r--src/parse/paths.cpp10
-rw-r--r--src/parse/root.cpp16
-rw-r--r--src/parse/token.cpp4
-rw-r--r--src/parse/types.cpp8
5 files changed, 20 insertions, 20 deletions
diff --git a/src/parse/expr.cpp b/src/parse/expr.cpp
index 749ffc9f..a45e4384 100644
--- a/src/parse/expr.cpp
+++ b/src/parse/expr.cpp
@@ -532,7 +532,7 @@ ExprNodeP Parse_Stmt_Let(TokenStream& lex)
else {
PUTBACK(tok, lex);
}
- return NEWNODE( AST::ExprNode_LetBinding, ::std::move(pat), ::std::move(type), ::std::move(val) );
+ return NEWNODE( AST::ExprNode_LetBinding, ::std::move(pat), mv$(type), ::std::move(val) );
}
::std::vector<ExprNodeP> Parse_ParenList(TokenStream& lex)
diff --git a/src/parse/paths.cpp b/src/parse/paths.cpp
index c952d977..e7fe1b0b 100644
--- a/src/parse/paths.cpp
+++ b/src/parse/paths.cpp
@@ -57,7 +57,7 @@ AST::Path Parse_Path(TokenStream& lex, eParsePathGenericMode generic_mode)
}
GET_CHECK_TOK(tok, lex, TOK_GT);
GET_CHECK_TOK(tok, lex, TOK_DOUBLE_COLON);
- return AST::Path(AST::Path::TagUfcs(), ty, trait, Parse_PathNodes(lex, generic_mode));
+ return AST::Path(AST::Path::TagUfcs(), mv$(ty), mv$(trait), Parse_PathNodes(lex, generic_mode));
}
else {
PUTBACK(tok, lex);
@@ -65,8 +65,8 @@ AST::Path Parse_Path(TokenStream& lex, eParsePathGenericMode generic_mode)
// TODO: Terminating the "path" here is sometimes valid?
GET_CHECK_TOK(tok, lex, TOK_DOUBLE_COLON);
// NOTE: <Foo>::BAR is actually `<Foo as _>::BAR` (in mrustc parleance)
- //return AST::Path(AST::Path::TagUfcs(), ty, Parse_PathNodes(lex, generic_mode));
- return AST::Path(AST::Path::TagUfcs(), ty, AST::Path(), Parse_PathNodes(lex, generic_mode));
+ //return AST::Path(AST::Path::TagUfcs(), mv$(ty), Parse_PathNodes(lex, generic_mode));
+ return AST::Path(AST::Path::TagUfcs(), mv$(ty), AST::Path(), Parse_PathNodes(lex, generic_mode));
}
throw ""; }
@@ -161,8 +161,8 @@ AST::Path Parse_Path(TokenStream& lex, bool is_abs, eParsePathGenericMode generi
// Encode into path, by converting Fn(A,B)->C into Fn<(A,B),Ret=C>
params = ::AST::PathParams {
{},
- ::std::vector<TypeRef> { TypeRef(TypeRef::TagTuple(), lex.end_span(ps), ::std::move(args)) },
- { ::std::make_pair( ::std::string("Output"), mv$(ret_type) ) }
+ ::make_vec1( TypeRef(TypeRef::TagTuple(), lex.end_span(ps), mv$(args)) ),
+ ::make_vec1( ::std::make_pair( ::std::string("Output"), mv$(ret_type) ) )
};
GET_TOK(tok, lex);
diff --git a/src/parse/root.cpp b/src/parse/root.cpp
index ce3cb5fb..1ea9ea93 100644
--- a/src/parse/root.cpp
+++ b/src/parse/root.cpp
@@ -138,7 +138,7 @@ AST::GenericParams Parse_GenericParams(TokenStream& lex)
auto param_ty = TypeRef(lex.getPosition(), param_name);
if( GET_TOK(tok, lex) == TOK_COLON )
{
- Parse_TypeBound(lex, ret, param_ty);
+ Parse_TypeBound(lex, ret, mv$(param_ty));
GET_TOK(tok, lex);
}
@@ -200,14 +200,14 @@ void Parse_WhereClause(TokenStream& lex, AST::GenericParams& params)
TypeRef type = Parse_Type(lex);
GET_CHECK_TOK(tok, lex, TOK_COLON);
- Parse_TypeBound(lex, params, type, lifetimes);
+ Parse_TypeBound(lex,params, mv$(type), mv$(lifetimes));
}
else
{
PUTBACK(tok, lex);
TypeRef type = Parse_Type(lex);
GET_CHECK_TOK(tok, lex, TOK_COLON);
- Parse_TypeBound(lex, params, type);
+ Parse_TypeBound(lex, params, mv$(type));
}
} while( GET_TOK(tok, lex) == TOK_COMMA );
PUTBACK(tok, lex);
@@ -328,7 +328,7 @@ AST::Function Parse_FunctionDef(TokenStream& lex, ::std::string abi, bool allow_
else {
PUTBACK(tok, lex);
}
- args.push_back( ::std::make_pair( AST::Pattern(AST::Pattern::TagBind(), "self"), ty) );
+ args.push_back( ::std::make_pair( AST::Pattern(AST::Pattern::TagBind(), "self"), mv$(ty)) );
GET_TOK(tok, lex);
}
}
@@ -345,7 +345,7 @@ AST::Function Parse_FunctionDef(TokenStream& lex, ::std::string abi, bool allow_
else {
PUTBACK(tok, lex);
}
- args.push_back( ::std::make_pair( AST::Pattern(AST::Pattern::TagBind(), "self"), ty) );
+ args.push_back( ::std::make_pair( AST::Pattern(AST::Pattern::TagBind(), "self"), mv$(ty)) );
GET_TOK(tok, lex);
}
else
@@ -1149,7 +1149,7 @@ AST::ExternBlock Parse_ExternBlock(TokenStream& lex, ::std::string abi, ::AST::M
auto type = Parse_Type(lex);
GET_CHECK_TOK(tok, lex, TOK_SEMICOLON);
- auto i = ::AST::Item(::AST::Static( (is_mut ? ::AST::Static::MUT : ::AST::Static::STATIC), type, ::AST::Expr() ));
+ auto i = ::AST::Item(::AST::Static( (is_mut ? ::AST::Static::MUT : ::AST::Static::STATIC), mv$(type), ::AST::Expr() ));
i.attrs = mv$(meta_items);
i.span = lex.end_span(ps);
rv.add_item( AST::Named<AST::Item> { mv$(name), mv$(i), is_public } );
@@ -1464,7 +1464,7 @@ void Parse_Use(TokenStream& lex, ::std::function<void(AST::UseStmt, ::std::strin
GET_CHECK_TOK(tok, lex, TOK_EQUAL);
AST::Expr val = Parse_Expr(lex);
GET_CHECK_TOK(tok, lex, TOK_SEMICOLON);
- item_data = ::AST::Item( ::AST::Static(AST::Static::CONST, type, val) );
+ item_data = ::AST::Item( ::AST::Static(AST::Static::CONST, mv$(type), mv$(val)) );
break; }
case TOK_RWORD_UNSAFE:
GET_CHECK_TOK(tok, lex, TOK_RWORD_FN);
@@ -1501,7 +1501,7 @@ void Parse_Use(TokenStream& lex, ::std::function<void(AST::UseStmt, ::std::strin
AST::Expr val = Parse_Expr(lex);
GET_CHECK_TOK(tok, lex, TOK_SEMICOLON);
- item_data = ::AST::Item( ::AST::Static( (is_mut ? AST::Static::MUT : AST::Static::STATIC), type, val) );
+ item_data = ::AST::Item( ::AST::Static( (is_mut ? AST::Static::MUT : AST::Static::STATIC), mv$(type), mv$(val)) );
break; }
// `unsafe fn`
diff --git a/src/parse/token.cpp b/src/parse/token.cpp
index 37515a2e..05ded69f 100644
--- a/src/parse/token.cpp
+++ b/src/parse/token.cpp
@@ -71,7 +71,7 @@ Token::Token(const InterpolatedFragment& frag)
case InterpolatedFragment::TT: throw "";
case InterpolatedFragment::TYPE:
m_type = TOK_INTERPOLATED_TYPE;
- m_data = new TypeRef( *reinterpret_cast<const TypeRef*>(frag.m_ptr) );
+ m_data = new TypeRef( reinterpret_cast<const TypeRef*>(frag.m_ptr)->clone() );
break;
case InterpolatedFragment::PAT:
m_type = TOK_INTERPOLATED_PATTERN;
@@ -179,7 +179,7 @@ Token Token::clone() const
switch(m_type)
{
case TOK_INTERPOLATED_TYPE:
- rv.m_data = new TypeRef( *reinterpret_cast<TypeRef*>(e) );
+ rv.m_data = new TypeRef( reinterpret_cast<TypeRef*>(e)->clone() );
break;
case TOK_INTERPOLATED_PATTERN:
rv.m_data = new AST::Pattern( reinterpret_cast<AST::Pattern*>(e)->clone() );
diff --git a/src/parse/types.cpp b/src/parse/types.cpp
index fabb13bc..1cbcc306 100644
--- a/src/parse/types.cpp
+++ b/src/parse/types.cpp
@@ -146,11 +146,11 @@ TypeRef Parse_Type_Int(TokenStream& lex, bool allow_trait_list)
// Sized array
AST::Expr array_size = Parse_Expr(lex);
GET_CHECK_TOK(tok, lex, TOK_SQUARE_CLOSE);
- return TypeRef(TypeRef::TagSizedArray(), lex.end_span(ps), inner, array_size.take_node());
+ return TypeRef(TypeRef::TagSizedArray(), lex.end_span(ps), mv$(inner), array_size.take_node());
}
else if( tok.type() == TOK_SQUARE_CLOSE )
{
- return TypeRef(TypeRef::TagUnsizedArray(), lex.end_span(ps), inner);
+ return TypeRef(TypeRef::TagUnsizedArray(), lex.end_span(ps), mv$(inner));
}
else {
throw ParseError::Unexpected(lex, tok/*, "; or ]"*/);
@@ -181,7 +181,7 @@ TypeRef Parse_Type_Int(TokenStream& lex, bool allow_trait_list)
break;
else
PUTBACK(tok, lex);
- types.push_back(Parse_Type(lex));
+ types.push_back( Parse_Type(lex) );
}
CHECK_TOK(tok, TOK_PAREN_CLOSE);
return TypeRef(TypeRef::TagTuple(), lex.end_span(ps), mv$(types)); }
@@ -287,7 +287,7 @@ TypeRef Parse_Type_Path(TokenStream& lex, ::std::vector<::std::string> hrls, boo
return TypeRef(lex.end_span(ps), mv$(hrls), ::std::move(traits));
}
else {
- return TypeRef(TypeRef::TagPath(), lex.end_span(ps), traits.at(0));
+ return TypeRef(TypeRef::TagPath(), lex.end_span(ps), mv$(traits.at(0)));
}
}
}