Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(634)

Unified Diff: runtime/vm/ast.cc

Issue 10693071: Use VM type cast and save handles. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/ast.cc
===================================================================
--- runtime/vm/ast.cc (revision 9306)
+++ runtime/vm/ast.cc (working copy)
@@ -83,15 +83,13 @@
AstNode* LiteralNode::ApplyUnaryOp(Token::Kind unary_op_kind) {
if (unary_op_kind == Token::kSUB) {
if (literal().IsSmi()) {
- Smi& smi = Smi::Handle();
- smi ^= literal().raw();
+ const Smi& smi = Smi::Cast(literal());
const Instance& literal =
Instance::ZoneHandle(Integer::New(-smi.Value()));
return new LiteralNode(this->token_pos(), literal);
}
if (literal().IsDouble()) {
- Double& dbl = Double::Handle();
- dbl ^= literal().raw();
+ const Double& dbl = Double::Cast(literal());
// Preserve negative zero.
double new_value = (dbl.value() == 0.0) ? -0.0 : (0.0 - dbl.value());
Double& double_instance =
@@ -376,9 +374,7 @@
// replumbing all of the EvalConstExpr methods.
return NULL;
}
- Instance& field_value = Instance::ZoneHandle();
- field_value ^= result.raw();
- return &field_value;
+ return &Instance::ZoneHandle(Instance::Cast(result).raw());
}
} // namespace dart
« no previous file with comments | « runtime/vm/ast.h ('k') | runtime/vm/benchmark_test.cc » ('j') | runtime/vm/dart_api_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698