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); |
} |