Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: include/AdblockPlus/JsValue.h

Issue 29393589: Issue 5013 - Make more methods const.- introduced JsConstValuePtr and JsConstValueList- JsValue:… (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Created March 23, 2017, 6:12 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: include/AdblockPlus/JsValue.h
===================================================================
--- a/include/AdblockPlus/JsValue.h
+++ b/include/AdblockPlus/JsValue.h
@@ -37,21 +37,23 @@ namespace AdblockPlus
class JsEngine;
typedef std::shared_ptr<JsEngine> JsEnginePtr;
/**
* Shared smart pointer to a `JsValue` instance.
*/
typedef std::shared_ptr<JsValue> JsValuePtr;
+ typedef std::shared_ptr<const JsValue> JsConstValuePtr;
sergei 2017/03/23 19:46:06 What about ConstJsValuePtr?
/**
* List of JavaScript values.
*/
typedef std::vector<AdblockPlus::JsValuePtr> JsValueList;
+ typedef std::vector<AdblockPlus::JsConstValuePtr> JsConstValueList;
sergei 2017/03/23 19:46:06 What about ConstJsValueList?
hub 2017/03/24 13:45:15 To answer about here and above, I feel like ConstJ
sergei 2017/03/24 13:56:47 Agree. Considering Js as a namespace makes sense h
/**
* Wrapper for JavaScript values.
* See `JsEngine` for creating `JsValue` objects.
*/
class JsValue
{
friend class JsEngine;
@@ -116,17 +118,17 @@ namespace AdblockPlus
std::string GetClass() const;
/**
* Invokes the value as a function (see `IsFunction()`).
* @param params Optional list of parameters.
* @param thisPtr Optional `this` value.
* @return Value returned by the function.
*/
- JsValuePtr Call(const JsValueList& params = JsValueList(),
+ JsValuePtr Call(const JsConstValueList& params = JsConstValueList(),
sergei 2017/03/23 19:46:06 This change is a bit questionable, but I think we
hub 2017/03/24 13:45:15 it is quite essential. The problem boils down to t
sergei 2017/03/24 13:56:47 I rather thought about no replacing the existing m
AdblockPlus::JsValuePtr thisPtr = AdblockPlus::JsValuePtr()) const;
/**
* Invokes the value as a function (see `IsFunction()`) with single
* parameter.
* @param arg A single required parameter.
* @return Value returned by the function.
*/

Powered by Google App Engine
This is Rietveld