porffor 0.47.7 → 0.47.8
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/compiler/builtins/boolean.ts +2 -5
- package/compiler/builtins/object.ts +10 -12
- package/compiler/builtins/z_ecma262.ts +4 -6
- package/compiler/builtins_precompiled.js +74 -74
- package/compiler/codegen.js +12 -5
- package/compiler/prototype.js +4 -4
- package/package.json +1 -1
- package/runner/index.js +1 -1
@@ -18,11 +18,8 @@ export const Boolean = function (value: any): boolean|BooleanObject {
|
|
18
18
|
export const __Boolean_prototype_toString = (_this: boolean) => {
|
19
19
|
// 1. Let b be ? ThisBooleanValue(this value).
|
20
20
|
// 2. If b is true, return "true"; else return "false".
|
21
|
-
|
22
|
-
|
23
|
-
else out = 'false';
|
24
|
-
|
25
|
-
return out;
|
21
|
+
if (_this) return 'true';
|
22
|
+
return 'false';
|
26
23
|
};
|
27
24
|
|
28
25
|
// 20.3.3.3 Boolean.prototype.valueOf ()
|
@@ -698,33 +698,31 @@ export const __Object_prototype_toString = (_this: any) => {
|
|
698
698
|
}
|
699
699
|
}
|
700
700
|
|
701
|
-
let out: bytestring = Porffor.allocate();
|
702
|
-
|
703
701
|
// 1. If the this value is undefined, return "[object Undefined]".
|
704
|
-
if (_this === undefined) return
|
702
|
+
if (_this === undefined) return '[object Undefined]';
|
705
703
|
|
706
704
|
// 2. If the this value is null, return "[object Null]".
|
707
|
-
if (_this === null) return
|
705
|
+
if (_this === null) return '[object Null]';
|
708
706
|
|
709
707
|
// todo: toStringTag support
|
710
708
|
|
711
709
|
const t: i32 = Porffor.rawType(_this);
|
712
|
-
if (t == Porffor.TYPES.array) return
|
713
|
-
if (t == Porffor.TYPES.function) return
|
710
|
+
if (t == Porffor.TYPES.array) return '[object Array]';
|
711
|
+
if (t == Porffor.TYPES.function) return '[object Function]';
|
714
712
|
if (Porffor.fastOr(
|
715
713
|
t == Porffor.TYPES.boolean,
|
716
|
-
t == Porffor.TYPES.booleanobject)) return
|
714
|
+
t == Porffor.TYPES.booleanobject)) return '[object Boolean]';
|
717
715
|
if (Porffor.fastOr(
|
718
716
|
t == Porffor.TYPES.number,
|
719
|
-
t == Porffor.TYPES.numberobject)) return
|
717
|
+
t == Porffor.TYPES.numberobject)) return '[object Number]';
|
720
718
|
if (Porffor.fastOr(
|
721
719
|
t == Porffor.TYPES.string,
|
722
720
|
t == Porffor.TYPES.bytestring,
|
723
|
-
t == Porffor.TYPES.stringobject)) return
|
724
|
-
if (t == Porffor.TYPES.date) return
|
725
|
-
if (t == Porffor.TYPES.regexp) return
|
721
|
+
t == Porffor.TYPES.stringobject)) return '[object String]';
|
722
|
+
if (t == Porffor.TYPES.date) return '[object Date]';
|
723
|
+
if (t == Porffor.TYPES.regexp) return '[object RegExp]';
|
726
724
|
|
727
|
-
return
|
725
|
+
return '[object Object]';
|
728
726
|
};
|
729
727
|
|
730
728
|
export const __Object_prototype_toLocaleString = (_this: any) => __Object_prototype_toString(_this);
|
@@ -129,24 +129,22 @@ export const __ecma262_ToString = (argument: unknown): any => {
|
|
129
129
|
// 2. If argument is a Symbol, throw a TypeError exception.
|
130
130
|
if (type == Porffor.TYPES.symbol) throw new TypeError('Cannot convert a Symbol value to a string');
|
131
131
|
|
132
|
-
let out: bytestring = Porffor.allocate();
|
133
|
-
|
134
132
|
// 3. If argument is undefined, return "undefined".
|
135
133
|
if (Porffor.fastOr(
|
136
134
|
type == Porffor.TYPES.undefined,
|
137
|
-
type == Porffor.TYPES.empty)) return
|
135
|
+
type == Porffor.TYPES.empty)) return 'undefined';
|
138
136
|
|
139
137
|
// 4. If argument is null, return "null".
|
140
138
|
if (Porffor.fastAnd(
|
141
139
|
type == Porffor.TYPES.object,
|
142
|
-
argument == 0)) return
|
140
|
+
argument == 0)) return 'null';
|
143
141
|
|
144
142
|
if (type == Porffor.TYPES.boolean) {
|
145
143
|
// 5. If argument is true, return "true".
|
146
|
-
if (argument == true) return
|
144
|
+
if (argument == true) return 'true';
|
147
145
|
|
148
146
|
// 6. If argument is false, return "false".
|
149
|
-
return
|
147
|
+
return 'false';
|
150
148
|
}
|
151
149
|
|
152
150
|
// 7. If argument is a Number, return Number::toString(argument, 10).
|