From ccc8a425ad2ea1e0c514f3f249d30cf7d537950c Mon Sep 17 00:00:00 2001 From: Spencer Ahrens Date: Mon, 5 Nov 2018 15:32:47 -0800 Subject: [PATCH] Cleanup a bunch of the JS stuff Summary: Stricter flow typing, better naming, modularization with context objects, more extensible, etc. Reviewed By: yungsters Differential Revision: D10443440 fbshipit-source-id: 171358dfb105829b872d6379064ba4bc29ce34de --- ReactCommon/fabric/uimanager/ReactBytecodeInterpreter.cpp | 6 +++--- .../fabric/uimanager/tests/ReactBytecodeInterpreterTest.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ReactCommon/fabric/uimanager/ReactBytecodeInterpreter.cpp b/ReactCommon/fabric/uimanager/ReactBytecodeInterpreter.cpp index a9b8ef2c8..58460f1e4 100644 --- a/ReactCommon/fabric/uimanager/ReactBytecodeInterpreter.cpp +++ b/ReactCommon/fabric/uimanager/ReactBytecodeInterpreter.cpp @@ -55,7 +55,7 @@ SharedShadowNode ReactBytecodeInterpreter::runCommand( componentDescriptorRegistry[parentShadowNode]; componentDescriptor->appendChild(parentShadowNode, nodes[tag]); } - } else if (opcode == "childSetNode") { + } else if (opcode == "returnRoot") { LOG(INFO) << "(stop) UITemplateProcessor inject serialized 'server rendered' view tree"; return nodes[command[1].asInt()]; @@ -138,9 +138,9 @@ SharedShadowNode ReactBytecodeInterpreter::buildShadowTree( << folly::toJson(command) << "': '" << e.what() << "'"; } } - LOG(ERROR) << "react ui template missing childSetNode command :("; + LOG(ERROR) << "react ui template missing returnRoot command :("; throw std::runtime_error( - "Missing childSetNode command in template content:\n" + content); + "Missing returnRoot command in template content:\n" + content); return SharedShadowNode{}; } diff --git a/ReactCommon/fabric/uimanager/tests/ReactBytecodeInterpreterTest.cpp b/ReactCommon/fabric/uimanager/tests/ReactBytecodeInterpreterTest.cpp index c96f4f496..ce35f2072 100644 --- a/ReactCommon/fabric/uimanager/tests/ReactBytecodeInterpreterTest.cpp +++ b/ReactCommon/fabric/uimanager/tests/ReactBytecodeInterpreterTest.cpp @@ -75,7 +75,7 @@ TEST(ReactBytecodeInterpreterTest, testSimpleBytecode) { auto bytecode = R"delim({"version":0.1,"commands":[ ["createNode",2,"RCTView",-1,{"opacity": 0.5, "testId": "root"}], ["createNode",4,"RCTView",2,{"testId": "child"}], - ["childSetNode",2] + ["returnRoot",2] ]})delim"; mockSimpleTestValue_ = true; @@ -110,7 +110,7 @@ TEST(ReactBytecodeInterpreterTest, testConditionalBytecode) { [["createNode",4,"RCTView",2,{"testId": "cond_true"}]], [["createNode",4,"RCTView",2,{"testId": "cond_false"}]] ], - ["childSetNode",2] + ["returnRoot",2] ]})delim"; mockSimpleTestValue_ = true;