summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2016-10-31 13:35:22 +0800
committerJohn Hodge <tpg@ucc.asn.au>2016-10-31 13:44:33 +0800
commit8b945178e8fd15cccab02c621a1616daddcace16 (patch)
tree026109b50003c7d2c1561f0fb0253094dc6f6350 /src
parentfc7239e7271e879102272ea4d7e98f87f027ee84 (diff)
downloadmrust-8b945178e8fd15cccab02c621a1616daddcace16.tar.gz
AST - Delete some dead code, remove some warnings on GCC6
Diffstat (limited to 'src')
-rw-r--r--src/ast/expr.cpp10
-rw-r--r--src/ast/path.cpp28
-rw-r--r--src/ast/path.hpp10
-rw-r--r--src/expand/derive.cpp2
-rw-r--r--src/hir/serialise_lowlevel.cpp6
-rw-r--r--src/mir/mir_builder.cpp9
6 files changed, 17 insertions, 48 deletions
diff --git a/src/ast/expr.cpp b/src/ast/expr.cpp
index e6374f25..bfe3ad98 100644
--- a/src/ast/expr.cpp
+++ b/src/ast/expr.cpp
@@ -55,12 +55,12 @@ Expr Expr::clone() const
::std::ostream& operator<<(::std::ostream& os, const ExprNode& node)
{
- if( static_cast<const void*>(&node) != nullptr ) {
+ //if( static_cast<const void*>(&node) != nullptr ) {
node.print(os);
- }
- else {
- os << "/* NULLPTR */";
- }
+ //}
+ //else {
+ // os << "/* NULLPTR */";
+ //}
return os;
}
ExprNode::~ExprNode() {
diff --git a/src/ast/path.cpp b/src/ast/path.cpp
index 583c3396..d1781e1f 100644
--- a/src/ast/path.cpp
+++ b/src/ast/path.cpp
@@ -188,14 +188,6 @@ void Path::bind_variable(unsigned int slot)
{
m_binding = PathBinding::make_Variable({slot});
}
-void Path::bind_module(const Module& mod) {
- m_binding = PathBinding::make_Module({&mod});
-}
-void Path::bind_enum(const Enum& ent, const ::std::vector<TypeRef>& /*args*/)
-{
- DEBUG("Bound to enum");
- m_binding = PathBinding::make_Enum({&ent});
-}
void Path::bind_enum_var(const Enum& ent, const ::std::string& name, const ::std::vector<TypeRef>& /*args*/)
{
unsigned int idx = 0;
@@ -209,25 +201,7 @@ void Path::bind_enum_var(const Enum& ent, const ::std::string& name, const ::std
throw ParseError::Generic("Enum variant not found");
DEBUG("Bound to enum variant '" << name << "' (#" << idx << ")");
- m_binding = PathBinding::make_EnumVar({&ent, idx});
-}
-void Path::bind_struct(const Struct& ent, const ::std::vector<TypeRef>& /*args*/)
-{
- DEBUG("Bound to struct");
- m_binding = PathBinding::make_Struct({&ent});
-}
-void Path::bind_struct_member(const Struct& ent, const ::std::vector<TypeRef>& /*args*/, const PathNode& member_node)
-{
- DEBUG("Binding to struct item. This needs to be deferred");
- m_binding = PathBinding::make_StructMethod({&ent, member_node.name()});
-}
-void Path::bind_static(const Static& ent)
-{
- m_binding = PathBinding::make_Static({&ent});
-}
-void Path::bind_trait(const Trait& ent, const ::std::vector<TypeRef>& /*args*/)
-{
- m_binding = PathBinding::make_Trait({&ent});
+ m_binding = PathBinding::make_EnumVar({ &ent, idx });
}
Path& Path::operator+=(const Path& other)
diff --git a/src/ast/path.hpp b/src/ast/path.hpp
index 479b26b8..c47f37ca 100644
--- a/src/ast/path.hpp
+++ b/src/ast/path.hpp
@@ -341,21 +341,11 @@ private:
void check_param_counts(const GenericParams& params, bool expect_params, PathNode& node);
public:
- void bind_module(const Module& mod);
- void bind_enum(const Enum& ent, const ::std::vector<TypeRef>& args={});
void bind_enum_var(const Enum& ent, const ::std::string& name, const ::std::vector<TypeRef>& args={});
- void bind_struct(const Struct& ent, const ::std::vector<TypeRef>& args={});
- void bind_struct_member(const Struct& ent, const ::std::vector<TypeRef>& args, const PathNode& member_node);
- void bind_static(const Static& ent);
- void bind_trait(const Trait& ent, const ::std::vector<TypeRef>& args={});
void bind_function(const Function& ent, const ::std::vector<TypeRef>& args={}) {
(void)args;
m_binding = PathBinding::make_Function({&ent});
}
- void bind_type_alias(const TypeAlias& ent, const ::std::vector<TypeRef>& args={}) {
- (void)args;
- m_binding = PathBinding::make_TypeAlias({&ent});
- }
void bind(::AST::PathBinding pb) {
m_binding = mv$(pb);
diff --git a/src/expand/derive.cpp b/src/expand/derive.cpp
index fc3210b5..55fb662d 100644
--- a/src/expand/derive.cpp
+++ b/src/expand/derive.cpp
@@ -272,8 +272,6 @@ class Deriver_Debug:
TypeRef(sp, AST::Path(core_name, {AST::PathNode("fmt",{}), AST::PathNode("Formatter", {})}))
);
- DEBUG("node = " << *node);
-
AST::Function fcn(
sp,
AST::GenericParams(),
diff --git a/src/hir/serialise_lowlevel.cpp b/src/hir/serialise_lowlevel.cpp
index 706adaee..05335633 100644
--- a/src/hir/serialise_lowlevel.cpp
+++ b/src/hir/serialise_lowlevel.cpp
@@ -69,8 +69,10 @@ WriterInner::~WriterInner()
do
{
ret = deflate(&m_zstream, Z_FINISH);
- if(ret == Z_STREAM_ERROR)
- throw ::std::runtime_error("zlib deflate stream error (cleanup)");
+ if(ret == Z_STREAM_ERROR) {
+ ::std::cerr << "ERROR: zlib deflate stream error (cleanup)";
+ abort();
+ }
if( m_zstream.avail_out != m_buffer.size() )
{
size_t rem = m_buffer.size() - m_zstream.avail_out;
diff --git a/src/mir/mir_builder.cpp b/src/mir/mir_builder.cpp
index 93abe229..f0cb8f27 100644
--- a/src/mir/mir_builder.cpp
+++ b/src/mir/mir_builder.cpp
@@ -1092,8 +1092,13 @@ ScopeHandle::~ScopeHandle()
{
if( idx != ~0u )
{
- ASSERT_BUG(Span(), m_builder.m_scopes.size() > idx, "Scope invalid");
- ASSERT_BUG(Span(), m_builder.m_scopes.at(idx).complete, "Scope " << idx << " not completed");
+ try {
+ ASSERT_BUG(Span(), m_builder.m_scopes.size() > idx, "Scope invalid");
+ ASSERT_BUG(Span(), m_builder.m_scopes.at(idx).complete, "Scope " << idx << " not completed");
+ }
+ catch(...) {
+ abort();
+ }
}
}