summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ast/expr.cpp22
-rw-r--r--src/parse/token.cpp10
2 files changed, 25 insertions, 7 deletions
diff --git a/src/ast/expr.cpp b/src/ast/expr.cpp
index 65048183..c35700e7 100644
--- a/src/ast/expr.cpp
+++ b/src/ast/expr.cpp
@@ -266,7 +266,16 @@ NODE(ExprNode_ByteString, {
})
NODE(ExprNode_Closure, {
- os << "/* todo: closure */";
+ if( m_is_move )
+ os << "move ";
+ os << "|";
+ for(const auto& a : m_args)
+ {
+ os << a.first << ": " << a.second << ",";
+ }
+ os << "|";
+ os << "->" << m_return;
+ os << " " << *m_code;
},{
ExprNode_Closure::args_t args;
for(const auto& a : m_args) {
@@ -276,7 +285,16 @@ NODE(ExprNode_Closure, {
});
NODE(ExprNode_StructLiteral, {
- os << "/* todo: sl */";
+ os << m_path << " { ";
+ for(const auto& v : m_values)
+ {
+ os << v.first << ": " << *v.second << ", ";
+ }
+ if(m_base_value)
+ {
+ os << ".." << *m_base_value;
+ }
+ os << "}";
},{
ExprNode_StructLiteral::t_values vals;
diff --git a/src/parse/token.cpp b/src/parse/token.cpp
index 69b952cc..84838207 100644
--- a/src/parse/token.cpp
+++ b/src/parse/token.cpp
@@ -290,16 +290,16 @@ struct EscapedString {
case TOK_NEWLINE: return "\n";
case TOK_WHITESPACE: return " ";
case TOK_COMMENT: return "/*" + m_data.as_String() + "*/";
- case TOK_INTERPOLATED_TYPE: return "/*:ty*/";
- case TOK_INTERPOLATED_PATH: return "/*:path*/";
- case TOK_INTERPOLATED_PATTERN: return "/*:pat*/";
+ case TOK_INTERPOLATED_TYPE: return FMT( *reinterpret_cast<const ::TypeRef*>(m_data.as_Fragment()) );
+ case TOK_INTERPOLATED_PATH: return FMT( *reinterpret_cast<const ::AST::Path*>(m_data.as_Fragment()) );
+ case TOK_INTERPOLATED_PATTERN: return FMT( *reinterpret_cast<const ::AST::Pattern*>(m_data.as_Fragment()) );
+ case TOK_INTERPOLATED_STMT:
+ case TOK_INTERPOLATED_BLOCK:
case TOK_INTERPOLATED_EXPR: {
::std::stringstream ss;
reinterpret_cast<const ::AST::ExprNode*>(m_data.as_Fragment())->print(ss);
return ss.str();
}
- case TOK_INTERPOLATED_STMT: return "/*:stmt*/";
- case TOK_INTERPOLATED_BLOCK: return "/*:block*/";
case TOK_INTERPOLATED_META: return "/*:meta*/";
case TOK_INTERPOLATED_ITEM: return "/*:item*/";
case TOK_INTERPOLATED_IDENT: return "/*:ident*/";