porffor 0.60.3 → 0.60.5
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/_internal_object.ts +5 -5
- package/compiler/builtins/array.ts +1 -1
- package/compiler/builtins/date.ts +1 -1
- package/compiler/builtins/json.ts +2 -2
- package/compiler/builtins/object.ts +1 -2
- package/compiler/builtins/object_hiddenPrototype.js +1 -2
- package/compiler/builtins/typedarray.js +3 -3
- package/compiler/builtins/z_ecma262.ts +4 -6
- package/compiler/builtins_precompiled.js +40 -40
- package/compiler/codegen.js +5 -27
- package/foo.js +9 -0
- package/package.json +1 -1
- package/runtime/index.js +1 -1
@@ -172,15 +172,15 @@ local.set ${obj}`;
|
|
172
172
|
// it does not, make it
|
173
173
|
const underlying: object = {};
|
174
174
|
if (Porffor.type(_obj) == Porffor.TYPES.function) {
|
175
|
+
__Porffor_object_fastAdd(underlying, 'length', __Porffor_funcLut_length(obj), 0b0010);
|
176
|
+
__Porffor_object_fastAdd(underlying, 'name', __Porffor_funcLut_name(obj), 0b0010);
|
177
|
+
|
175
178
|
if (ecma262.IsConstructor(_obj)) { // constructor
|
176
179
|
// set prototype and prototype.constructor if function and constructor
|
177
180
|
const proto: object = {};
|
178
181
|
__Porffor_object_fastAdd(underlying, 'prototype', proto, 0b1000);
|
179
182
|
__Porffor_object_fastAdd(proto, 'constructor', _obj, 0b1010);
|
180
183
|
}
|
181
|
-
|
182
|
-
__Porffor_object_fastAdd(underlying, 'name', __Porffor_funcLut_name(obj), 0b0010);
|
183
|
-
__Porffor_object_fastAdd(underlying, 'length', __Porffor_funcLut_length(obj), 0b0010);
|
184
184
|
}
|
185
185
|
|
186
186
|
if (Porffor.type(_obj) == Porffor.TYPES.array) {
|
@@ -206,8 +206,8 @@ local.set x#type`;
|
|
206
206
|
|
207
207
|
if (Porffor.fastOr(
|
208
208
|
Porffor.type(_obj) == Porffor.TYPES.string,
|
209
|
-
Porffor.type(_obj) == Porffor.TYPES.stringobject
|
210
|
-
) {
|
209
|
+
Porffor.type(_obj) == Porffor.TYPES.stringobject
|
210
|
+
)) {
|
211
211
|
const len: i32 = (obj as string).length;
|
212
212
|
__Porffor_object_fastAdd(underlying, 'length', len, 0b0000);
|
213
213
|
|
@@ -42,7 +42,7 @@ export const __Array_from = (arg: any, mapFn: any): any[] => {
|
|
42
42
|
|
43
43
|
if (Porffor.fastOr(
|
44
44
|
Porffor.type(arg) == Porffor.TYPES.array,
|
45
|
-
Porffor.type(arg)
|
45
|
+
(Porffor.type(arg) | 0b10000000) == Porffor.TYPES.bytestring,
|
46
46
|
Porffor.type(arg) == Porffor.TYPES.set,
|
47
47
|
Porffor.fastAnd(Porffor.type(arg) >= Porffor.TYPES.uint8clampedarray, Porffor.type(arg) <= Porffor.TYPES.float64array)
|
48
48
|
)) {
|
@@ -1832,7 +1832,7 @@ export const Date = function (v0: unknown, v1: unknown, v2: unknown, v3: unknown
|
|
1832
1832
|
} else {
|
1833
1833
|
// c. Else,
|
1834
1834
|
// ii. If v is a String, then
|
1835
|
-
if (
|
1835
|
+
if ((Porffor.type(v0) | 0b10000000) == Porffor.TYPES.bytestring) {
|
1836
1836
|
// 1. Assert: The next step never returns an abrupt completion because v is a String.
|
1837
1837
|
|
1838
1838
|
// 2. Let tv be the result of parsing v as a date, in exactly the same manner as for the parse method (21.4.3.2).
|
@@ -311,7 +311,7 @@ export const __JSON_parse = (_: bytestring) => {
|
|
311
311
|
Porffor.bytestring.appendChar(out, ch);
|
312
312
|
pos++;
|
313
313
|
}
|
314
|
-
}
|
314
|
+
}
|
315
315
|
throw new SyntaxError('Unterminated string');
|
316
316
|
}
|
317
317
|
|
@@ -396,7 +396,7 @@ export const __JSON_parse = (_: bytestring) => {
|
|
396
396
|
else break;
|
397
397
|
}
|
398
398
|
|
399
|
-
return
|
399
|
+
return ecma262.StringToNumber(__ByteString_prototype_slice(text, start, pos));
|
400
400
|
}
|
401
401
|
|
402
402
|
throw new SyntaxError('Unexpected token');
|
@@ -690,8 +690,7 @@ export const __Object_prototype_toString = (_this: any) => {
|
|
690
690
|
Porffor.type(_this) == Porffor.TYPES.number,
|
691
691
|
Porffor.type(_this) == Porffor.TYPES.numberobject)) return '[object Number]';
|
692
692
|
if (Porffor.fastOr(
|
693
|
-
Porffor.type(_this) == Porffor.TYPES.
|
694
|
-
Porffor.type(_this) == Porffor.TYPES.bytestring,
|
693
|
+
(Porffor.type(_this) | 0b10000000) == Porffor.TYPES.bytestring,
|
695
694
|
Porffor.type(_this) == Porffor.TYPES.stringobject)) return '[object String]';
|
696
695
|
if (Porffor.type(_this) == Porffor.TYPES.date) return '[object Date]';
|
697
696
|
if (Porffor.type(_this) == Porffor.TYPES.regexp) return '[object RegExp]';
|
@@ -3,8 +3,7 @@ export default ({ TYPES, TYPE_NAMES }) => {
|
|
3
3
|
export const __Porffor_object_getHiddenPrototype = (trueType: i32): any => {
|
4
4
|
if (Porffor.comptime.flag\`hasFunc.#get___String_prototype\`) {
|
5
5
|
if (Porffor.fastOr(
|
6
|
-
trueType == Porffor.TYPES.
|
7
|
-
trueType == Porffor.TYPES.bytestring,
|
6
|
+
(trueType | 0b10000000) == Porffor.TYPES.bytestring,
|
8
7
|
trueType == Porffor.TYPES.stringobject
|
9
8
|
)) return __String_prototype;
|
10
9
|
}
|
@@ -46,7 +46,7 @@ export default async () => {
|
|
46
46
|
|
47
47
|
if (Porffor.fastOr(
|
48
48
|
Porffor.type(arg) == Porffor.TYPES.array,
|
49
|
-
Porffor.type(arg)
|
49
|
+
(Porffor.type(arg) | 0b10000000) == Porffor.TYPES.bytestring,
|
50
50
|
Porffor.type(arg) == Porffor.TYPES.set,
|
51
51
|
Porffor.fastAnd(Porffor.type(arg) >= Porffor.TYPES.uint8clampedarray, Porffor.type(arg) <= Porffor.TYPES.float64array)
|
52
52
|
)) {
|
@@ -77,7 +77,7 @@ export const __${name}_from = (arg: any, mapFn: any): ${name} => {
|
|
77
77
|
|
78
78
|
if (Porffor.fastOr(
|
79
79
|
Porffor.type(arg) == Porffor.TYPES.array,
|
80
|
-
Porffor.type(arg)
|
80
|
+
(Porffor.type(arg) | 0b10000000) == Porffor.TYPES.bytestring,
|
81
81
|
Porffor.type(arg) == Porffor.TYPES.set,
|
82
82
|
Porffor.fastAnd(Porffor.type(arg) >= Porffor.TYPES.uint8clampedarray, Porffor.type(arg) <= Porffor.TYPES.float64array)
|
83
83
|
)) {
|
@@ -164,7 +164,7 @@ export const __${name}_prototype_set = (_this: ${name}, array: any, offset: numb
|
|
164
164
|
|
165
165
|
if (Porffor.fastOr(
|
166
166
|
Porffor.type(array) == Porffor.TYPES.array,
|
167
|
-
Porffor.type(array)
|
167
|
+
(Porffor.type(array) | 0b10000000) == Porffor.TYPES.bytestring,
|
168
168
|
Porffor.type(array) == Porffor.TYPES.set,
|
169
169
|
Porffor.fastAnd(Porffor.type(array) >= Porffor.TYPES.uint8clampedarray, Porffor.type(array) <= Porffor.TYPES.float64array)
|
170
170
|
)) {
|
@@ -49,9 +49,8 @@ export const __ecma262_ToNumber = (argument: unknown): number => {
|
|
49
49
|
if (argument === true) return 1;
|
50
50
|
|
51
51
|
// 6. If argument is a String, return StringToNumber(argument).
|
52
|
-
if (Porffor.
|
53
|
-
|
54
|
-
Porffor.type(argument) == Porffor.TYPES.bytestring)) return __ecma262_StringToNumber(argument);
|
52
|
+
if ((Porffor.type(argument) | 0b10000000) == Porffor.TYPES.bytestring)
|
53
|
+
return __ecma262_StringToNumber(argument);
|
55
54
|
|
56
55
|
// 7. Assert: argument is an Object.
|
57
56
|
// 8. Let primValue be ? ToPrimitive(argument, number).
|
@@ -121,9 +120,8 @@ export const __ecma262_ToIndex = (value: unknown): number => {
|
|
121
120
|
// https://tc39.es/ecma262/#sec-tostring
|
122
121
|
export const __ecma262_ToString = (argument: unknown): any => {
|
123
122
|
// 1. If argument is a String, return argument.
|
124
|
-
if (Porffor.
|
125
|
-
|
126
|
-
Porffor.type(argument) == Porffor.TYPES.bytestring)) return argument;
|
123
|
+
if ((Porffor.type(argument) | 0b10000000) == Porffor.TYPES.bytestring)
|
124
|
+
return argument;
|
127
125
|
|
128
126
|
// 2. If argument is a Symbol, throw a TypeError exception.
|
129
127
|
if (Porffor.type(argument) == Porffor.TYPES.symbol) throw new TypeError('Cannot convert a Symbol value to a string');
|