Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use nil<> template over explicit casting of cNil

  • Loading branch information...
commit bdcd473f1a7f364413cec109cf21bfd9895aa178 1 parent a115c60
@dbussink dbussink authored
View
9 vm/call_frame.hpp
@@ -7,6 +7,7 @@
#include "builtin/variable_scope.hpp"
#include "dispatch.hpp"
#include "arguments.hpp"
+#include "builtin/symbol.hpp"
#include <ostream>
@@ -15,8 +16,6 @@
#endif
namespace rubinius {
- class Object;
- class Symbol;
class Module;
class VariableScope;
class NativeMethodFrame;
@@ -87,12 +86,12 @@ namespace rubinius {
if(inline_method_p() && dispatch_data) {
return reinterpret_cast<jit::RuntimeData*>(dispatch_data)->name();
} else if(block_p()) {
- return reinterpret_cast<Symbol*>(cNil);
+ return nil<Symbol>();
} else if(arguments) {
return arguments->name();
}
- return reinterpret_cast<Symbol*>(cNil);
+ return nil<Symbol>();
}
#else
Symbol* name() {
@@ -100,7 +99,7 @@ namespace rubinius {
return arguments->name();
}
- return reinterpret_cast<Symbol*>(cNil);
+ return nil<Symbol>();
}
#endif
View
2  vm/llvm/state.cpp
@@ -551,7 +551,7 @@ namespace rubinius {
}
std::string LLVMState::symbol_debug_str(const Symbol* sym) {
- if(sym == reinterpret_cast<const Symbol*>(cNil)) return "<nil>";
+ if(sym == nil<Symbol>()) return "<nil>";
return symbols_.lookup_debug_string(sym);
}
View
4 vm/test/test_symboltable.hpp
@@ -106,13 +106,13 @@ class TestSymbolTable : public CxxTest::TestSuite, public VMTest {
}
void test_lookup_nil() {
- TS_ASSERT_THROWS_ASSERT(symbols->lookup(state, reinterpret_cast<String*>(cNil)),
+ TS_ASSERT_THROWS_ASSERT(symbols->lookup(state, nil<String>()),
const RubyException &e,
TS_ASSERT(Exception::argument_error_p(state, e.exception)));
}
void test_lookup_string_nil() {
- TS_ASSERT_THROWS_ASSERT(symbols->lookup_string(state, reinterpret_cast<Symbol*>(cNil)),
+ TS_ASSERT_THROWS_ASSERT(symbols->lookup_string(state, nil<Symbol>()),
const RubyException &e,
TS_ASSERT(Exception::argument_error_p(state, e.exception)));
}
Please sign in to comment.
Something went wrong with that request. Please try again.