Commit 682a8f71 authored by jochen's avatar jochen Committed by Commit bot

Mark Local::As and Persistent::As as const

Since they are.

R=verwaest@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2216123003
Cr-Commit-Position: refs/heads/master@{#38386}
parent 20c56bdd
...@@ -292,8 +292,8 @@ class Local { ...@@ -292,8 +292,8 @@ class Local {
return Local<T>(T::Cast(*that)); return Local<T>(T::Cast(*that));
} }
template <class S>
template <class S> V8_INLINE Local<S> As() { V8_INLINE Local<S> As() const {
return Local<S>::Cast(*this); return Local<S>::Cast(*this);
} }
...@@ -743,17 +743,18 @@ template <class T, class M> class Persistent : public PersistentBase<T> { ...@@ -743,17 +743,18 @@ template <class T, class M> class Persistent : public PersistentBase<T> {
// TODO(dcarney): this is pretty useless, fix or remove // TODO(dcarney): this is pretty useless, fix or remove
template <class S> 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 #ifdef V8_ENABLE_CHECKS
// If we're going to perform the type check then we have to check // 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. // that the handle isn't empty before doing the checked cast.
if (!that.IsEmpty()) T::Cast(*that); if (!that.IsEmpty()) T::Cast(*that);
#endif #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 // 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); return Persistent<S>::Cast(*this);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment