Skip to content

Commit dce4a15

Browse files
authored
Merge pull request #413 from statementreply/hanzi2num
Overhaul hanzi2num
2 parents fa899d1 + 005ad0f commit dce4a15

File tree

7 files changed

+995
-293
lines changed

7 files changed

+995
-293
lines changed

src/compiler/js.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class JSCompiler extends Base {
1616
var errcurlvls = [];
1717

1818
function getval(x) {
19-
if (x == undefined) {
19+
if (x === undefined) {
2020
return "";
2121
}
2222
if (x[0] == "ans") {
@@ -31,16 +31,16 @@ class JSCompiler extends Base {
3131
var a = this.asc[i];
3232
if (a.op == "var") {
3333
for (var j = 0; j < a.count; j++) {
34-
if (a.values[j] == undefined) {
34+
if (a.values[j] === undefined) {
3535
a.values[j] = [];
3636
}
3737
var name = a.names[j];
3838
var value = a.values[j][1];
39-
if (name == undefined) {
39+
if (name === undefined) {
4040
name = this.nextTmpVar();
4141
strayvar.push(name);
4242
}
43-
if (value == undefined) {
43+
if (value === undefined) {
4444
if (a.type == "arr") {
4545
value = "[]";
4646
} else if (a.type == "num") {
@@ -265,7 +265,7 @@ class JSCompiler extends Base {
265265
strayvar = [];
266266
} else if (a.op == "catcherr") {
267267
var ec = errcurlvls[errcurlvls.length - 1];
268-
if (a.error == undefined) {
268+
if (a.error === undefined) {
269269
var vname = this.nextTmpVar();
270270
strayvar.push(vname);
271271
if (curlvl != ec[0]) {

src/compiler/py.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ class PYCompiler extends Base {
1717
var strayvar = [];
1818
var took = 0;
1919
const getval = x => {
20-
if (x == undefined) {
20+
if (x === undefined) {
2121
return "";
2222
}
2323
if (x[0] == "ans") {
2424
var ans = strayvar[strayvar.length - 1];
2525
strayvar = [];
2626
return ans;
2727
}
28-
if (x[1] == undefined) {
28+
if (x[1] === undefined) {
2929
return undefined;
3030
}
3131
if (x[1].toString() == "true") {
@@ -41,16 +41,16 @@ class PYCompiler extends Base {
4141
var a = this.asc[i];
4242
if (a.op == "var") {
4343
for (var j = 0; j < a.count; j++) {
44-
if (a.values[j] == undefined) {
44+
if (a.values[j] === undefined) {
4545
a.values[j] = [];
4646
}
4747
var name = a.names[j];
4848
var value = getval(a.values[j]);
49-
if (name == undefined) {
49+
if (name === undefined) {
5050
name = this.nextTmpVar();
5151
strayvar.push(name);
5252
}
53-
if (value == undefined) {
53+
if (value === undefined) {
5454
if (a.type == "arr") {
5555
value = "Ctnr()";
5656
} else if (a.type == "num") {

src/compiler/rb.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ class RBCompiler extends Base {
9999
return ans;
100100
}
101101
if (x[0] == "iden") return this.rename(x[1]);
102-
if (x[1] == undefined) return "nil";
102+
if (x[1] === undefined) return "nil";
103103
return x[1];
104104
};
105105
for (let i = 0; i < asc.length; i++) {
106106
let a = asc[i];
107107
if (a.op == "var") {
108108
for (let j = 0; j < a.count; j++) {
109-
if (a.values[j] == undefined) {
109+
if (a.values[j] === undefined) {
110110
a.values[j] = [];
111111
}
112112
let name = a.names[j];
@@ -115,7 +115,7 @@ class RBCompiler extends Base {
115115
continue;
116116
}
117117
let value = getval(a.values[j]);
118-
if (name == undefined) {
118+
if (name === undefined) {
119119
name = this.nextTmpVar();
120120
strayvar.push(name);
121121
}

0 commit comments

Comments
 (0)