Skip to content

Commit

Permalink
chore: Avoid copy in MetadataNode::IsJavascriptKeyword
Browse files Browse the repository at this point in the history
Noticed while fixing static initialization of keywords set, see next
commit.
  • Loading branch information
ptomato authored and edusperoni committed Nov 28, 2023
1 parent 1843dd2 commit 25338bf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test-app/runtime/src/main/cpp/MetadataNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2038,7 +2038,7 @@ void MetadataNode::EnableProfiler(bool enableProfiler) {
s_profilerEnabled = enableProfiler;
}

bool MetadataNode::IsJavascriptKeyword(std::string word) {
bool MetadataNode::IsJavascriptKeyword(const std::string& word) {
static set<string> keywords{
"abstract", "arguments", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "debugger", "default", "delete", "do",
"double", "else", "enum", "eval", "export", "extends", "false", "final", "finally", "float", "for", "function", "goto", "if", "implements",
Expand Down
2 changes: 1 addition & 1 deletion test-app/runtime/src/main/cpp/MetadataNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class MetadataNode {

MetadataNode(MetadataTreeNode* treeNode);

static bool IsJavascriptKeyword(std::string word);
static bool IsJavascriptKeyword(const std::string& word);
v8::Local<v8::Object> CreatePackageObject(v8::Isolate* isolate);

v8::Local<v8::Function> GetConstructorFunction(v8::Isolate* isolate);
Expand Down

0 comments on commit 25338bf

Please sign in to comment.