diff --git a/modules/juce_core/containers/juce_NamedValueSet.cpp b/modules/juce_core/containers/juce_NamedValueSet.cpp index 2c153e1f19..8955b126d4 100644 --- a/modules/juce_core/containers/juce_NamedValueSet.cpp +++ b/modules/juce_core/containers/juce_NamedValueSet.cpp @@ -140,7 +140,7 @@ var* NamedValueSet::getVarPointer (const Identifier& name) const noexcept } #if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS -bool NamedValueSet::set (Identifier name, var&& newValue) +bool NamedValueSet::set (const Identifier& name, var&& newValue) { if (var* const v = getVarPointer (name)) { @@ -156,7 +156,7 @@ bool NamedValueSet::set (Identifier name, var&& newValue) } #endif -bool NamedValueSet::set (Identifier name, const var& newValue) +bool NamedValueSet::set (const Identifier& name, const var& newValue) { if (var* const v = getVarPointer (name)) { diff --git a/modules/juce_core/containers/juce_NamedValueSet.h b/modules/juce_core/containers/juce_NamedValueSet.h index e4a98edc67..09ad68ee7c 100644 --- a/modules/juce_core/containers/juce_NamedValueSet.h +++ b/modules/juce_core/containers/juce_NamedValueSet.h @@ -78,14 +78,14 @@ public: @returns true if a value was changed or added; false if the value was already set the value passed-in. */ - bool set (Identifier name, const var& newValue); + bool set (const Identifier& name, const var& newValue); #if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS /** Changes or adds a named value. @returns true if a value was changed or added; false if the value was already set the value passed-in. */ - bool set (Identifier name, var&& newValue); + bool set (const Identifier& name, var&& newValue); #endif /** Returns true if the set contains an item with the specified name. */ diff --git a/modules/juce_core/javascript/juce_Javascript.cpp b/modules/juce_core/javascript/juce_Javascript.cpp index 1d7fcf45dc..9e5fe3d9d0 100644 --- a/modules/juce_core/javascript/juce_Javascript.cpp +++ b/modules/juce_core/javascript/juce_Javascript.cpp @@ -102,7 +102,7 @@ struct JavascriptEngine::RootObject : public DynamicObject static bool isNumericOrUndefined (const var& v) { return v.isInt() || v.isDouble() || v.isInt64() || v.isBool() || v.isUndefined(); } static int64 getOctalValue (const String& s) { BigInteger b; b.parseString (s, 8); return b.toInt64(); } static Identifier getPrototypeIdentifier() { static const Identifier i ("prototype"); return i; } - static var* getPropertyPointer (DynamicObject* o, Identifier i) { return o->getProperties().getVarPointer (i); } + static var* getPropertyPointer (DynamicObject* o, const Identifier& i) { return o->getProperties().getVarPointer (i); } //============================================================================== struct CodeLocation @@ -136,7 +136,7 @@ struct JavascriptEngine::RootObject : public DynamicObject ReferenceCountedObjectPtr root; DynamicObject::Ptr scope; - var findFunctionCall (const CodeLocation& location, const var& targetObject, Identifier functionName) const + var findFunctionCall (const CodeLocation& location, const var& targetObject, const Identifier& functionName) const { if (DynamicObject* o = targetObject.getDynamicObject()) { @@ -170,7 +170,7 @@ struct JavascriptEngine::RootObject : public DynamicObject return var(); } - var* findRootClassProperty (Identifier className, Identifier propName) const + var* findRootClassProperty (const Identifier& className, const Identifier& propName) const { if (DynamicObject* cls = root->getProperty (className).getDynamicObject()) return getPropertyPointer (cls, propName); @@ -178,7 +178,7 @@ struct JavascriptEngine::RootObject : public DynamicObject return nullptr; } - var findSymbolInParentScopes (Identifier name) const + var findSymbolInParentScopes (const Identifier& name) const { if (const var* v = getPropertyPointer (scope, name)) return *v; @@ -187,7 +187,7 @@ struct JavascriptEngine::RootObject : public DynamicObject : var::undefined(); } - bool findAndInvokeMethod (Identifier function, const var::NativeFunctionArgs& args, var& result) const + bool findAndInvokeMethod (const Identifier& function, const var::NativeFunctionArgs& args, var& result) const { DynamicObject* target = args.thisObject.getDynamicObject(); @@ -352,7 +352,7 @@ struct JavascriptEngine::RootObject : public DynamicObject struct UnqualifiedName : public Expression { - UnqualifiedName (const CodeLocation& l, Identifier n) noexcept : Expression (l), name (n) {} + UnqualifiedName (const CodeLocation& l, const Identifier& n) noexcept : Expression (l), name (n) {} var getResult (const Scope& s) const override { return s.findSymbolInParentScopes (name); } @@ -369,7 +369,7 @@ struct JavascriptEngine::RootObject : public DynamicObject struct DotOperator : public Expression { - DotOperator (const CodeLocation& l, ExpPtr& p, Identifier c) noexcept : Expression (l), parent (p), child (c) {} + DotOperator (const CodeLocation& l, ExpPtr& p, const Identifier& c) noexcept : Expression (l), parent (p), child (c) {} var getResult (const Scope& s) const override { @@ -1670,7 +1670,7 @@ JavascriptEngine::~JavascriptEngine() {} void JavascriptEngine::prepareTimeout() const noexcept { root->timeout = Time::getCurrentTime() + maximumExecutionTime; } -void JavascriptEngine::registerNativeObject (Identifier name, DynamicObject* object) +void JavascriptEngine::registerNativeObject (const Identifier& name, DynamicObject* object) { root->setProperty (name, object); } @@ -1706,7 +1706,7 @@ var JavascriptEngine::evaluate (const String& code, Result* result) return var::undefined(); } -var JavascriptEngine::callFunction (Identifier function, const var::NativeFunctionArgs& args, Result* result) +var JavascriptEngine::callFunction (const Identifier& function, const var::NativeFunctionArgs& args, Result* result) { var returnVal (var::undefined()); diff --git a/modules/juce_core/javascript/juce_Javascript.h b/modules/juce_core/javascript/juce_Javascript.h index eafc3cdb60..62eadbb116 100644 --- a/modules/juce_core/javascript/juce_Javascript.h +++ b/modules/juce_core/javascript/juce_Javascript.h @@ -78,7 +78,7 @@ public: The function arguments are passed in the same format as used by native methods in the var class. */ - var callFunction (Identifier function, + var callFunction (const Identifier& function, const var::NativeFunctionArgs& args, Result* errorMessage = nullptr); @@ -87,7 +87,7 @@ public: engine until the engine is deleted. The name must be a simple JS identifier, without any dots. */ - void registerNativeObject (Identifier objectName, DynamicObject* object); + void registerNativeObject (const Identifier& objectName, DynamicObject* object); /** This value indicates how long a call to one of the evaluate methods is permitted to run before timing-out and failing.