You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@weex.apache.org by GitBox <gi...@apache.org> on 2018/09/20 16:07:15 UTC

[GitHub] cxfeng1 closed pull request #1557: [core] fix data render bug

cxfeng1 closed pull request #1557: [core] fix data render bug
URL: https://github.com/apache/incubator-weex/pull/1557
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
index 0ea6d59223..8433f914e6 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
+++ b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
@@ -258,13 +258,13 @@ - (void)renderWithURL:(NSURL *)url options:(NSDictionary *)options data:(id)data
 
 - (void)renderView:(id)source options:(NSDictionary *)options data:(id)data
 {
-    WXLogDebug(@"Render source: %@, data:%@", self, [WXUtility JSONString:data]);
     _options = options;
     _jsData = data;
     
     self.needValidate = [[WXHandlerFactory handlerForProtocol:@protocol(WXValidateProtocol)] needValidate:self.scriptURL];
     
     if ([source isKindOfClass:[NSString class]]) {
+        WXLogDebug(@"Render source: %@, data:%@", self, [WXUtility JSONString:data]);
         [self _renderWithMainBundleString:source];
     } else if ([source isKindOfClass:[NSData class]]) {
         [self _renderWithOpcode:source];
diff --git a/weex_core/Source/core/data_render/code_generator.cc b/weex_core/Source/core/data_render/code_generator.cc
index bfb7ba5988..72e870465a 100644
--- a/weex_core/Source/core/data_render/code_generator.cc
+++ b/weex_core/Source/core/data_render/code_generator.cc
@@ -635,14 +635,7 @@ void CodeGenerator::Visit(JSXNodeExpression *node, void *data) {
         if (!node->LowerIdentifier()) {
             std::string name = node->Identifier()->AsIdentifier()->GetName();
             int index = exec_state_->global()->IndexOf(name);
-            if (index < 0) {
-                bool exist = block_->FindVariable(name);
-                if (!exist) {
-                    throw GeneratorError("can't find identifier:" + name);
-                    break;
-                }
-            }
-            else {
+            if (index >= 0) {
                 node->SetClass(true);
             }
         }
@@ -1093,6 +1086,9 @@ void CodeGenerator::Visit(PrefixExpression *node, void *data) {
     else if (operation == PrefixOperation::kDecrement) {
         func_->func_state()->AddInstruction(CREATE_ABC(OP_PRE_DECR, reg, ret, 0));
     }
+    else if (operation == PrefixOperation::kNot) {
+        func_->func_state()->AddInstruction(CREATE_ABx(OP_NOT, ret, reg));
+    }
     else if (operation == PrefixOperation::kUnfold) {
         func_->func_state()->AddInstruction(CREATE_ABC(OP_MOVE, ret, reg, 0));
     }
diff --git a/weex_core/Source/core/data_render/vm.cc b/weex_core/Source/core/data_render/vm.cc
index de057b1146..1deb274371 100644
--- a/weex_core/Source/core/data_render/vm.cc
+++ b/weex_core/Source/core/data_render/vm.cc
@@ -216,7 +216,7 @@ void VM::RunFrame(ExecState *exec_state, Frame frame, Value *ret) {
           break;
       }
       case OP_JMP: {
-          LOGTEMP("OP_JMP A:%ld\n", GET_ARG_A(instruction));
+          LOGTEMP("OP_JMP A:%ld  B:%ld \n", GET_ARG_A(instruction), GET_ARG_Bx(instruction));
           a = frame.reg + GET_ARG_A(instruction);
           bool con = false;
           if (!ToBool(a, con)) {
@@ -292,12 +292,9 @@ void VM::RunFrame(ExecState *exec_state, Frame frame, Value *ret) {
               LOGTEMP("OP_NOT A:%ld B:%ld \n", GET_ARG_A(instruction), GET_ARG_B(instruction));
               a = frame.reg + GET_ARG_A(instruction);
               b = frame.reg + GET_ARG_B(instruction);
-              if (!IsBool(b)) {
-                  // TODO error
-                  throw VMExecError("Not Bool Type Error With OP_CODE [OP_NOT]");
-              }
-              a->type =Value::Type::BOOL;
-              a->b = !b->b;
+              a->type = Value::Type::BOOL;
+              ToBool(b, a->b);
+              a->b = !a->b;
               break;
           }
         case OP_OR: {
@@ -700,8 +697,6 @@ void VM::RunFrame(ExecState *exec_state, Frame frame, Value *ret) {
             }
             *a = ref->value();
             a->ref = &ref->value();
-//            int value_index = a - exec_state->stack()->base();
-//            Value *test = exec_state->stack()->base() + value_index;
             break;
         }
         case OP_GETINDEXVAR:
@@ -802,7 +797,6 @@ void VM::RunFrame(ExecState *exec_state, Frame frame, Value *ret) {
           }
           if (IsString(b) || IsTable(b)) {
               int ret = SetTableValue(reinterpret_cast<Table *>(a->gc), b, *c);
-              //LOGTEMP("[OP_SETTABLE]:%s\n", TableToString(ValueTo<Table>(a)).c_str());
               if (!ret) {
                   // TODO set faile
                   throw VMExecError("Set Table Error With OP_CODE [OP_SETTABLE]");


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services