Skip to content

Commit 50fcdb8

Browse files
fix comparations
1 parent 378b441 commit 50fcdb8

File tree

9 files changed

+52
-52
lines changed

9 files changed

+52
-52
lines changed

src/arrays/em_js.array_get.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ EM_JS(int ,c2wasm_get_array_type_by_index,(long stack_index, int index),{
8585
EM_JS(int ,c2wasm_get_array_bool_by_index,(long stack_index, int index),{
8686
let array = window.c2wasm_stack[stack_index];
8787
let value = array[index];
88-
if(value == false){
88+
if(value === false){
8989
return 0;
9090
}
9191
return 1;

src/arrays/em_js.array_set.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ EM_JS(void ,c2wasm_set_array_any_by_index,( c2wasm_js_var stack_index, int index
4242

4343
EM_JS(void ,c2wasm_set_array_bool_by_index,( c2wasm_js_var stack_index, int index, int value), {
4444
let array = window.c2wasm_stack[stack_index];
45-
if (value == 0){
45+
if (value === 0){
4646
array[index] = false;
4747
}
4848
if (value > 0){

src/em_js.creation.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
EM_JS(c2wasm_js_var,c2wasm_create_bool,(int value),{
2121
let index = window.c2wasm_get_stack_point();
22-
if (value == 0){
22+
if (value === 0){
2323
window.c2wasm_stack[index] = false;
2424
}
2525
if (value > 0){

src/em_js.start.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ EM_JS(void ,c2wasm_start, (void), {
6161

6262
window.c2wasm_get_stack_point = function(){
6363
for(let i= 8; i < window.c2wasm_stack.length; i++){
64-
if (window.c2wasm_stack[i] == undefined){
64+
if (window.c2wasm_stack[i] === undefined){
6565

6666
window.c2wasm_stack[i] = 0;
6767
return i;
@@ -119,34 +119,34 @@ EM_JS(void ,c2wasm_start, (void), {
119119
};
120120
//check macro.types.h to see the types
121121
window.c2wasm_get_type = function(value){
122-
if(value == undefined){
122+
if(value === undefined){
123123
return 0;
124124
};
125-
if(value == null){
125+
if(value === null){
126126
return 1;
127127
};
128-
if(value == true || value == false){
128+
if(value === true || value === false){
129129
return 2;
130130
};
131-
if(typeof value == "number"){
131+
if(typeof value === "number"){
132132
return 3;
133133
};
134-
if(typeof value == "string"){
134+
if(typeof value === "string"){
135135
return 4;
136136
};
137137
if(Array.isArray(value)){
138138
return 6;
139139
};
140-
if(typeof value == "object"){
140+
if(typeof value === "object"){
141141
return 5;
142142
};
143-
if(typeof value == "function"){
143+
if(typeof value === "function"){
144144
return 7;
145145
};
146-
if(typeof value == "symbol"){
146+
if(typeof value === "symbol"){
147147
return 8;
148148
}
149-
if(typeof value == "bigint"){
149+
if(typeof value === "bigint"){
150150
return 9;
151151
};
152152
return -1;

src/object/em_js.object_cal.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ EM_JS(c2wasm_js_var,c2wasm_call_object_prop,(c2wasm_js_var stack_index, const ch
2626
result = error;
2727
}
2828

29-
if(result == false){
29+
if(result === false){
3030
return window.c2wasm_false;
3131
}
32-
if(result == true){
32+
if(result === true){
3333
return window.c2wasm_true;
3434
}
35-
if(result == null){
35+
if(result === null){
3636
return window.c2wasm_null;
3737
}
38-
if(result == undefined){
38+
if(result === undefined){
3939
return window.c2wasm_undefined;
4040
}
4141
let created_index = window.c2wasm_get_stack_point();
@@ -63,16 +63,16 @@ EM_JS(c2wasm_js_var,c2wasm_call_object_constructor,(c2wasm_js_var stack_index, c
6363
result = error;
6464
}
6565

66-
if(result == false){
66+
if(result === false){
6767
return window.c2wasm_false;
6868
}
69-
if(result == true){
69+
if(result === true){
7070
return window.c2wasm_true;
7171
}
72-
if(result == null){
72+
if(result === null){
7373
return window.c2wasm_null;
7474
}
75-
if(result == undefined){
75+
if(result === undefined){
7676
return window.c2wasm_undefined;
7777
}
7878
let created_index = window.c2wasm_get_stack_point();
@@ -105,16 +105,16 @@ EM_ASYNC_JS(c2wasm_js_var,await_c2wasm_call_object_prop,(c2wasm_js_var stack_ind
105105
result = error;
106106
}
107107

108-
if(result == false){
108+
if(result === false){
109109
return window.c2wasm_false;
110110
}
111-
if(result == true){
111+
if(result === true){
112112
return window.c2wasm_true;
113113
}
114-
if(result == null){
114+
if(result === null){
115115
return window.c2wasm_null;
116116
}
117-
if(result == undefined){
117+
if(result === undefined){
118118
return window.c2wasm_undefined;
119119
}
120120
let created_index = window.c2wasm_get_stack_point();

src/object/em_js.object_get.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ EM_JS(int ,c2wasm_get_object_prop_bool,(c2wasm_js_var stack_index, const char *p
6767
let object = window.c2wasm_stack[stack_index];
6868
let prop_name_formatted = window.c2wasm_get_string(prop_name);
6969
let value = object[prop_name_formatted];
70-
if(value == false){
70+
if(value === false){
7171
return 0;
7272
}
7373

@@ -80,16 +80,16 @@ EM_JS(c2wasm_js_var , c2wasm_get_object_prop_any,(c2wasm_js_var stack_index, con
8080

8181
let prop_name_formatted = window.c2wasm_get_string(prop_name);
8282
let value = object[prop_name_formatted];
83-
if(value == false){
83+
if(value === false){
8484
return window.c2wasm_false;
8585
}
86-
if(value == true){
86+
if(value === true){
8787
return window.c2wasm_true;
8888
}
89-
if(value == null){
89+
if(value === null){
9090
return window.c2wasm_null;
9191
}
92-
if(value == undefined){
92+
if(value === undefined){
9393
return window.c2wasm_undefined;
9494
}
9595

src/object/em_js.object_set.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ EM_JS(void ,c2wasm_set_object_prop_string,(long stack_index, const char *prop_na
4646
EM_JS(void ,c2wasm_set_object_prop_bool,(c2wasm_js_var stack_index, const char *prop_name, int value), {
4747
let object = window.c2wasm_stack[stack_index];
4848
let prop_name_formatted = window.c2wasm_get_string(prop_name);
49-
if (value == 0){
49+
if (value === 0){
5050
object[prop_name_formatted] = false;
5151
}
5252
if (value > 0){

src/vars/em_js.vars_call.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ EM_JS(c2wasm_js_var, c2wasm_call_var, (c2wasm_js_var stack_index, c2wasm_js_var
2424
result = error;
2525
}
2626

27-
if(result == false){
27+
if(result === false){
2828
return window.c2wasm_false;
2929
}
30-
if(result == true){
30+
if(result === true){
3131
return window.c2wasm_true;
3232
}
33-
if(result == null){
33+
if(result === null){
3434
return window.c2wasm_null;
3535
}
36-
if(result == undefined){
36+
if(result === undefined){
3737
return window.c2wasm_undefined;
3838
}
3939
let created_index = window.c2wasm_get_stack_point();
@@ -62,16 +62,16 @@ EM_ASYNC_JS(c2wasm_js_var, await_c2wasm_call_var, (c2wasm_js_var stack_index, c2
6262
result = error;
6363
}
6464

65-
if(result == false){
65+
if(result === false){
6666
return window.c2wasm_false;
6767
}
68-
if(result == true){
68+
if(result === true){
6969
return window.c2wasm_true;
7070
}
71-
if(result == null){
71+
if(result === null){
7272
return window.c2wasm_null;
7373
}
74-
if(result == undefined){
74+
if(result === undefined){
7575
return window.c2wasm_undefined;
7676
}
7777
let created_index = window.c2wasm_get_stack_point();
@@ -100,16 +100,16 @@ EM_JS(c2wasm_js_var, c2wasm_call_var_constructor, (c2wasm_js_var stack_index, c2
100100
result = error;
101101
}
102102

103-
if(result == false){
103+
if(result === false){
104104
return window.c2wasm_false;
105105
}
106-
if(result == true){
106+
if(result === true){
107107
return window.c2wasm_true;
108108
}
109-
if(result == null){
109+
if(result === null){
110110
return window.c2wasm_null;
111111
}
112-
if(result == undefined){
112+
if(result === undefined){
113113
return window.c2wasm_undefined;
114114
}
115115
let created_index = window.c2wasm_get_stack_point();
@@ -138,16 +138,16 @@ EM_ASYNC_JS(c2wasm_js_var, await_c2wasm_call_var_constructor, (c2wasm_js_var sta
138138
result = error;
139139
}
140140

141-
if(result == false){
141+
if(result === false){
142142
return window.c2wasm_false;
143143
}
144-
if(result == true){
144+
if(result === true){
145145
return window.c2wasm_true;
146146
}
147-
if(result == null){
147+
if(result === null){
148148
return window.c2wasm_null;
149149
}
150-
if(result == undefined){
150+
if(result === undefined){
151151
return window.c2wasm_undefined;
152152
}
153153
let created_index = window.c2wasm_get_stack_point();

src/vars/em_js.vars_get.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ EM_JS(int, c2wasm_instance_of, (c2wasm_js_var stack_index,c2wasm_js_var target),
5959

6060
EM_JS(int, c2wasm_get_var_bool, (c2wasm_js_var stack_index), {
6161
let value = window.c2wasm_stack[stack_index];
62-
if(value == false){
62+
if(value === false){
6363
return 0;
6464
}
6565
return 1;
@@ -68,16 +68,16 @@ EM_JS(int, c2wasm_get_var_bool, (c2wasm_js_var stack_index), {
6868
EM_JS(c2wasm_js_var, c2wasm_get_var_any, (c2wasm_js_var stack_index), {
6969
let value = window.c2wasm_stack[stack_index];
7070

71-
if(value == false){
71+
if(value === false){
7272
return window.c2wasm_false;
7373
}
74-
if(value == true){
74+
if(value === true){
7575
return window.c2wasm_true;
7676
}
77-
if(value == null){
77+
if(value === null){
7878
return window.c2wasm_null;
7979
}
80-
if(value == undefined){
80+
if(value === undefined){
8181
return window.c2wasm_undefined;
8282
}
8383

0 commit comments

Comments
 (0)