[go: up one dir, main page]

Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

[WEEX-551][core][Android] Add new new data render mode. #1409

Merged
merged 90 commits into from
Aug 9, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
1e4749f
[core] init vnode & ast interface
yxping Jul 4, 2018
7e9c320
[core] add basic code generator
yxping Jul 9, 2018
00b5164
[core] Add vnode for data-render
Jul 7, 2018
327b434
[core] Add basic VM and ExecState
yxping Jul 11, 2018
a09909b
add ast source code
pengtaopt Jul 11, 2018
a8dd181
[core] Add StringTable and support string value
yxping Jul 11, 2018
1e1c609
Merge branch 'core-feature-data-render' of gitlab.alibaba-inc.com:wee…
pengtaopt Jul 11, 2018
86304a6
fix compile issue
Jul 11, 2018
6528657
[core] opcode implement
Jul 12, 2018
aece998
[core] code generator implement
Jul 12, 2018
366f625
[core] int to int64 & opcode implement
Jul 12, 2018
82944df
[core]VM init in VNodeRenderManager
Jul 12, 2018
27515cf
[core]support createElement and appendChild
Jul 12, 2018
88a997c
[core] remove android log
Jul 12, 2018
a1ac1cf
[core]fix vnode_manager compile error
Jul 12, 2018
fec5b00
[core]prototype test
Jul 12, 2018
da4b46e
[core] support childblockstatement visit
Jul 12, 2018
e48167a
[core]Add setAttr support, fix chunk ast parse
Jul 12, 2018
fe9b53d
[core]fix create element args error
Jul 12, 2018
471140c
rename ast constant,add assignment
pengtaopt Jul 12, 2018
b136923
code optimize and parsing using stacks
pengtaopt Jul 12, 2018
6a3391b
[core] LT LE JMP opcode implement
Jul 16, 2018
056b716
[core] opcode implement
Jul 16, 2018
e10c6a2
[core] LT LE JMP opcode implement
Jul 16, 2018
9b6072c
Merge branch 'core-feature-data-render' of gitlab.alibaba-inc.com:wee…
Jul 16, 2018
fc3cef7
pasing if for statement
pengtaopt Jul 16, 2018
a8667d7
[core] Support global variables getter
yxping Jul 16, 2018
a19e31a
[core] Add time log for data_render, add setClassList support, fix pa…
Jul 16, 2018
267f1ae
[core]fix setClassList issue
Jul 16, 2018
11e5da3
[core] add op_code OP_GOTO
Jul 16, 2018
b7f2b6d
[core] OP_GOTO opcode implement
Jul 16, 2018
179445e
[core] for and if statement implement
Jul 16, 2018
bb3221c
[core] assign expression implement
Jul 16, 2018
a0b1370
[core] op_code increment & decrement implement
Jul 17, 2018
9ac9d2e
[core] Add bool and double AST
Jul 17, 2018
72c178e
[core] op_code increment & decrement implement
Jul 17, 2018
324656a
[core] prefix expression implement & fix value copy construction
Jul 17, 2018
50ce312
[core] Add VNodeRenderContext, move context code from exec_state.
Jul 17, 2018
c19638a
[core] [data_render] support c_ptr value
yxping Jul 18, 2018
d51303f
[core] Fixed crash and paser name error
pengtaopt Jul 18, 2018
e235e99
[core] add test workspace
pengtaopt Jul 18, 2018
257ab32
Merge branch 'core-feature-data-render' of gitlab.alibaba-inc.com:wee…
pengtaopt Jul 18, 2018
955ca8a
Revert "[core] add test workspace"
pengtaopt Jul 18, 2018
65f0672
[core] boolean constant & double constant code generator
Jul 18, 2018
beab3b6
[core]fix compile
Jul 18, 2018
b86add7
[core]using expression parser for match and binding in parser.cc
Jul 18, 2018
101108a
[core] declaration list code generator
Jul 18, 2018
30a31a8
[core] op_code table implement
Jul 19, 2018
1feef82
[core] op_code table implement
Jul 19, 2018
6e6ab6f
[core] modify cmakelist file
Jul 19, 2018
4da841a
[core][data_render] fix compile error & format code
yxping Jul 19, 2018
e2148f3
[core] op_code table_factory && bug fix
Jul 19, 2018
3276243
[core]remove statistic and parse_context, fix code style
hpop1994 Jul 20, 2018
3f97021
[core]Add "data" parse to global var.
hpop1994 Jul 20, 2018
6936177
[core] using sizeof while parsing for,'match' got higher priority , i…
hpop1994 Jul 20, 2018
7df0adc
[core][Android] optimize renderobject to component link.
yxping Jul 20, 2018
5dd666b
[core]Add refresh and close test for data_render. Add a test activity…
hpop1994 Jul 21, 2018
51e75a3
[core] member access & array constant & object constant code generator
gehero Jul 23, 2018
baa94bb
[core] gettable op_code bugfix
gehero Jul 23, 2018
f9b7880
[core] add local c function (sizeof, log)
gehero Jul 23, 2018
f95d56c
[core][Android] remove MeasureMode_jni, optimize text layout
yxping Jul 23, 2018
51d4fb9
[core] add local function gettablesize
gehero Jul 23, 2018
5234fa9
[core] Table lifecycle management & avoid [new] operate
Jul 23, 2018
f426c18
[core] json array size bugfix & set table value bugfix
gehero Jul 23, 2018
b1fd31d
[core] add constructor for VNodeRenderContext
yxping Jul 23, 2018
227ae53
[core] String add operation
Jul 23, 2018
c48879d
[core]Fix for statement and if statement parse, remove extra json
hpop1994 Jul 23, 2018
ba81626
[core] use VNode* value instead of id and tag
yxping Jul 24, 2018
515c471
[core] remove useless code & format
Jul 25, 2018
5e97e86
[core] function prototype implement
gehero Jul 25, 2018
954ee45
[core]Add support for component. Add merge function. Add CommaExpress…
hpop1994 Jul 25, 2018
146ec51
[core] Making function in chunk global, Fix component call, Fix Objec…
hpop1994 Jul 26, 2018
c670c62
[core]Using this to emulate class-field behavior
hpop1994 Jul 26, 2018
28dca54
[core] string factory release
Jul 27, 2018
39b05ac
[core] use unique_ptr to manage pointer
Jul 27, 2018
2155efb
[core] fix opcode ABC overflow problem add ABx and Ax
yxping Jul 27, 2018
792b284
[core] Add Render Strategy DATA_RENDER
yxping Jul 30, 2018
14c0ab3
Merge remote-tracking branch 'github/master' into core-feature-data-r…
yxping Jul 30, 2018
d28f0f7
[core] move json11 to third_party
yxping Jul 31, 2018
e733138
[core] rm non-use file
yxping Jul 31, 2018
5deb422
[core]Add appendUrlParam func
hpop1994 Jul 31, 2018
1c9b04c
[core] add tostring cfunc
hpop1994 Jul 31, 2018
485fd86
[core] update so
yxping Aug 1, 2018
1a94fbe
[core]fix type convert of ValueLT...; fix refresh process.
hpop1994 Aug 1, 2018
cf0f1dc
[core] fix WeexProxy NPE
yxping Aug 1, 2018
913d9b3
[core] update weexcore.so
yxping Aug 1, 2018
4d119ff
[core] fix sequential problem
yxping Aug 1, 2018
17712b2
[core] fix weexproxy npe
yxping Aug 6, 2018
92fc6ba
[core] Add so initialize protection, fix jni_onload error
yxping Aug 7, 2018
35c4127
Merge branch 'core-feature-data-render-release'
yxping Aug 9, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[core]Add setAttr support, fix chunk ast parse
  • Loading branch information
pingyi.xjc committed Jul 12, 2018
commit e48167ad87abead7ebe1039a7991748e85c1c2e9
3 changes: 2 additions & 1 deletion weex_core/Source/core/data_render/code_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ void CodeGenerator::Visit(CallExpression *stms, void *data) {
argc = stms->args().size();
for (auto it = stms->args().begin(); it != stms->args().end(); ++it) {
auto temp = (*it).get();
temp->Accept(this, nullptr);
long arg = cur_block_->NextRegisterId();
temp->Accept(this, &arg);
}

FuncState *state = cur_func_->func_state();
Expand Down
2 changes: 1 addition & 1 deletion weex_core/Source/core/data_render/handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class Ref {
template <class B>
inline operator Ref<B>() {
// typename std::enable_if<std::is_base_of<B, T>::value>::type;
return Ref<B>(dynamic_cast<B*>(ptr_));
return Ref<B>(reinterpret_cast<B*>(ptr_));
}

private:
Expand Down
39 changes: 27 additions & 12 deletions weex_core/Source/core/data_render/statement.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,25 +125,26 @@ void ChunkStatement::Pasing(Json &json) {
}
Json childs = json["childNodes"];
if (childs.is_array() && childs.array_items().size() > 0) {
Handle<ExpressionList> list = factory->NewExpressionList();
// Handle<ExpressionList> list = factory->NewExpressionList();
for (int i = 0;i < childs.array_items().size(); i++) {
Json child = childs[i];
if (child.is_null() || !child.is_object()) {
continue;
}
Handle<Expression> block = factory->NewChildBlockStatement(child, factory->NewExpressionList(), nodeId.string_value());
list->Insert(block);
}
if (controlExpr) {
if (controlExpr->IsForStatement()) {
Handle<ForStatement> forExpr = controlExpr;
Handle<BlockStatement> forBlock = forExpr->body();
forBlock->PushExpression(list);
}
}
else {
PushExpression(list);
// list->Insert(block);
PushExpression(block);
}
// if (controlExpr) {
// if (controlExpr->IsForStatement()) {
// Handle<ForStatement> forExpr = controlExpr;
// Handle<BlockStatement> forBlock = forExpr->body();
// forBlock->PushExpression(list);
// }
// }
// else {
// PushExpression(list);
// }
}

} while (0);
Expand Down Expand Up @@ -205,6 +206,20 @@ void ChildBlockStatement::Pasing(Json &json) {
}
Json attributes = json["attributes"];
if (attributes.is_object()) {
auto items = attributes.object_items();
for (auto it = items.begin(); it != items.end(); ++it) {
const auto& key = it->first;
const auto& value = it->second.string_value();//todo support expression
std::vector<Handle<Expression>> args;
args.push_back(factory->NewStringLiteral(json,nodeId.string_value()));
args.push_back(factory->NewStringLiteral(json,key));
args.push_back(factory->NewStringLiteral(json,value));

Handle<Expression> setAttrFunc = factory->NewIdentifier(json, "setAttr");
Handle<CallExpression> callFunc = factory->NewCallExpression(
json,setAttrFunc,args);
PushExpression(callFunc);
}
std::string error;
Handle<Expression> attr = Parser::parseExpression(attributes, error);
if (controlExpr) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,19 @@ static Value AppendChild(ExecState* exec_state) {//appendChild("parent_id","id")
return Value();
}

static Value SetAttr(ExecState* exec_state) {//setAttr("id","key","value");
VNode* node = exec_state->find_node(exec_state->GetArgument(0)->str->c_str());
char* key = exec_state->GetArgument(1)->str->c_str();
char* value = exec_state->GetArgument(2)->str->c_str();

if (node == nullptr) {
return Value();
}

node->SetAttribute(key,value);
return Value();
}

void RegisterCFunc(ExecState* state, const std::string& name, CFunction function) {
Value func;
func.type = Value::Type::CFUNC;
Expand All @@ -186,7 +199,7 @@ void RegisterCFunc(ExecState* state, const std::string& name, CFunction function

void VNodeRenderManager::InitVM() {
if (g_vm_ == nullptr) {
VM* vm = new VM();
g_vm_ = new VM();
}
}
void VNodeRenderManager::TestProcess(const std::string& input, const std::string& page_id) {
Expand All @@ -196,6 +209,7 @@ void VNodeRenderManager::TestProcess(const std::string& input, const std::string
RegisterCFunc(execState, "log", Log);
RegisterCFunc(execState, "createElement", CreateElement);
RegisterCFunc(execState, "appendChild", AppendChild);
RegisterCFunc(execState, "setAttr", SetAttr);

execState->page_id(page_id);
execState->Compile(input);
Expand Down