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

Unified Diff: include/v8.h

Issue 2216123003: Mark Local::As and Persistent::As as const (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index 7776a69e3777bbbadcd3e829cf425b9cecdee695..05fa0cf6fa49862a70e33af8211273ee66bfc413 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -292,8 +292,8 @@ class Local {
return Local<T>(T::Cast(*that));
}
-
- template <class S> V8_INLINE Local<S> As() {
+ template <class S>
+ V8_INLINE Local<S> As() const {
return Local<S>::Cast(*this);
}
@@ -743,17 +743,18 @@ template <class T, class M> class Persistent : public PersistentBase<T> {
// TODO(dcarney): this is pretty useless, fix or remove
template <class S>
- V8_INLINE static Persistent<T>& Cast(Persistent<S>& that) { // NOLINT
+ V8_INLINE static Persistent<T>& Cast(const Persistent<S>& that) { // NOLINT
#ifdef V8_ENABLE_CHECKS
// If we're going to perform the type check then we have to check
// that the handle isn't empty before doing the checked cast.
if (!that.IsEmpty()) T::Cast(*that);
#endif
- return reinterpret_cast<Persistent<T>&>(that);
+ return reinterpret_cast<Persistent<T>&>(const_cast<Persistent<S>&>(that));
}
// TODO(dcarney): this is pretty useless, fix or remove
- template <class S> V8_INLINE Persistent<S>& As() { // NOLINT
+ template <class S>
+ V8_INLINE Persistent<S>& As() const { // NOLINT
return Persistent<S>::Cast(*this);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698