bahasa-simpl 1.0.21 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/simpl.js +6 -4
- package/package.json +1 -1
package/dist/simpl.js
CHANGED
|
@@ -90,6 +90,8 @@ class Stipe extends Variable {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
function kePetik(v, thing) {
|
|
93
|
+
if (!thing || (thing.data === null && !thing.member)) return "nihil";
|
|
94
|
+
|
|
93
95
|
if (thing.type === logisSymbol) {
|
|
94
96
|
return thing.data ? "benar" : "salah";
|
|
95
97
|
} else if (thing.type === barisSymbol) {
|
|
@@ -833,8 +835,8 @@ class Interpreter {
|
|
|
833
835
|
// a real TODO would've been to implement real iterables
|
|
834
836
|
let iterable = indexExpr.iterable.accept(this);
|
|
835
837
|
if (!iterable || iterable.data === null) {
|
|
836
|
-
this.error("Objek bernilai nihil
|
|
837
|
-
}
|
|
838
|
+
this.error("Objek tidak dapat diindeks, bernilai nihil atau bukan sebuah baris/petik.");
|
|
839
|
+
}
|
|
838
840
|
|
|
839
841
|
if (iterable.type === petikSymbol) {
|
|
840
842
|
iterable = new Value(barisSymbol, iterable.data.split("").map(str => new Value(petikSymbol, str)));
|
|
@@ -1054,7 +1056,7 @@ class Interpreter {
|
|
|
1054
1056
|
let willBeCalled = this.exprWillBeCalled;
|
|
1055
1057
|
this.exprWillBeCalled = false;
|
|
1056
1058
|
let main = memberExpr.main.accept(this);
|
|
1057
|
-
if (!main || main.data === null) {
|
|
1059
|
+
if (!main || (main.data === null && !main.member)) {
|
|
1058
1060
|
this.error("Objek bernilai nihil, tidak dapat mengaksesnya.");
|
|
1059
1061
|
}
|
|
1060
1062
|
let name = memberExpr.member.token.lexeme;
|
|
@@ -1385,7 +1387,7 @@ class Interpreter {
|
|
|
1385
1387
|
}
|
|
1386
1388
|
|
|
1387
1389
|
error(message) {
|
|
1388
|
-
throw new SimplErrorEksekusi(`Error Eksekusi => ${message}`, this.line, this.output.join('
|
|
1390
|
+
throw new SimplErrorEksekusi(`Error Eksekusi => ${message}`, this.line, this.output.join(''));
|
|
1389
1391
|
}
|
|
1390
1392
|
|
|
1391
1393
|
|