Index: runtime/vm/object.h |
=================================================================== |
--- runtime/vm/object.h (revision 9315) |
+++ runtime/vm/object.h (working copy) |
@@ -92,6 +92,9 @@ |
static object& CheckedZoneHandle(RawObject* raw_ptr) { \ |
return CheckedZoneHandle(Isolate::Current(), raw_ptr); \ |
} \ |
+ /* T::Cast cannot be applied to a null Object, because the object vtable */ \ |
+ /* is not setup for type T, although some methods are supposed to work */ \ |
+ /* with null, for example Instance::Equals(). */ \ |
static const object& Cast(const Object& obj) { \ |
ASSERT(obj.Is##object()); \ |
return reinterpret_cast<const object&>(obj); \ |
@@ -5074,12 +5077,9 @@ |
Token::Kind TokenStream::KindAt(intptr_t index) const { |
const Object& obj = Object::Handle(TokenAt(index)); |
if (obj.IsSmi()) { |
- return static_cast<Token::Kind>( |
- Smi::Value(reinterpret_cast<RawSmi*>(obj.raw()))); |
+ return static_cast<Token::Kind>(Smi::Cast(obj).Value()); |
} else if (obj.IsLiteralToken()) { |
- LiteralToken& token = LiteralToken::Handle(); |
- token ^= obj.raw(); |
- return token.kind(); |
+ return LiteralToken::Cast(obj).kind(); |
} |
ASSERT(obj.IsString()); // Must be an identifier. |
return Token::kIDENT; |