-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path:wq
71 lines (44 loc) · 1.78 KB
/
:wq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <vector>
#include <canal/operation.h>
#include <canal/function.h>
#include <canal/debugger.h>
void Equal::execute(){
debug("Equal execute");
freference.operations.getNext()->execute();
error_conditional(freference.identifier.look() == result_identifier_stack::result, "in equal::execute left is a result which is weird");
std::vector<variable *> left_var = freference.locals.pop();
debug("Equal execute gets %s from current_vstance",left_var.front()->name.c_str());
operation *op = freference.operations.getNext();
error_conditional(!op,"right operation in equal is NULL");
op->execute();
if(freference.identifier.look() == result_identifier_stack::result){
result right_result = freference.results.pop_result();
error_conditional(right_result.get_size() != left_var.size(),
"in equal::execute right_result size is %d and left_var size is %lu",
right_result.get_size(),
left_var.size()
);
std::vector<variable *>::iterator left_iterator = left_var.begin();
variable *right_iterator = right_result.begin();
while(left_iterator != left_var.end()){
(*left_iterator)->Equal(right_iterator);
left_iterator++;
right_iterator++;
}
}else{
std::vector<variable *> right_var = freference.locals.pop();
debug("Equal execute gets %s from current_vstance",right_var.front()->name.c_str());
error_conditional(right_var.size() != left_var.size(),
"in equal::execute right_result size is %lu and left_var size is %lu",
right_var.size(),
left_var.size()
);
std::vector<variable *>::iterator left_iterator = left_var.begin();
std::vector<variable *>::iterator right_iterator = right_var.begin();
while(left_iterator != left_var.end()){
(*left_iterator)->Equal(*right_iterator);
left_iterator++;
right_iterator++;
}
}
}