porffor 0.57.18 → 0.57.20
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/assemble.js +382 -324
- package/compiler/builtins/annexb_string.js +10 -14
- package/compiler/builtins/string.ts +4 -4
- package/compiler/builtins_precompiled.js +118 -82
- package/compiler/codegen.js +55 -49
- package/compiler/encoding.js +22 -0
- package/compiler/wrap.js +5 -41
- package/foo.js +17 -1
- package/package.json +1 -1
- package/r.js +243 -0
- package/runtime/index.js +1 -1
@@ -1,14 +1,12 @@
|
|
1
1
|
export default () => {
|
2
|
-
let out =
|
2
|
+
let out = `// @porf --valtype=i32`;
|
3
3
|
const noArgs = (a0, a1) => out += `
|
4
|
-
export const __String_prototype_${a0} = (_this:
|
4
|
+
export const __String_prototype_${a0} = (_this: string) =>
|
5
5
|
Porffor.concatStrings(
|
6
6
|
Porffor.concatStrings('<${a1}>', _this),
|
7
7
|
'</${a1}>');
|
8
|
-
|
9
|
-
|
10
|
-
__String_prototype_${a0}(_this);
|
11
|
-
`;
|
8
|
+
export const __ByteString_prototype_${a0} = (_this: bytestring) =>
|
9
|
+
__String_prototype_${a0}(_this);`;
|
12
10
|
|
13
11
|
noArgs('big', 'big');
|
14
12
|
noArgs('blink', 'blink');
|
@@ -21,7 +19,7 @@ export const __ByteString_prototype_${a0} = (_this: any) =>
|
|
21
19
|
noArgs('sup', 'sup');
|
22
20
|
|
23
21
|
const arg = (name, s1, s2) => out += `
|
24
|
-
export const __String_prototype_${name} = (_this:
|
22
|
+
export const __String_prototype_${name} = (_this: string, arg: any) =>
|
25
23
|
Porffor.concatStrings(
|
26
24
|
Porffor.concatStrings(
|
27
25
|
Porffor.concatStrings(
|
@@ -29,21 +27,19 @@ export const __String_prototype_${name} = (_this: any, arg: any) =>
|
|
29
27
|
'">'),
|
30
28
|
_this),
|
31
29
|
'</${s1}>');
|
32
|
-
|
33
|
-
|
34
|
-
__String_prototype_${name}(_this, arg);
|
35
|
-
`;
|
30
|
+
export const __ByteString_prototype_${name} = (_this: bytestring, arg: any) =>
|
31
|
+
__String_prototype_${name}(_this, arg);`;
|
36
32
|
|
37
33
|
arg('fontcolor', 'font', 'color');
|
38
34
|
arg('fontsize', 'font', 'size');
|
39
35
|
arg('anchor', 'a', 'name');
|
40
36
|
arg('link', 'a', 'href');
|
41
37
|
|
42
|
-
const prototypeAlias = (regular, annex) => `
|
38
|
+
const prototypeAlias = (regular, annex) => `
|
39
|
+
export const __String_prototype_${annex} = (_this: any) =>
|
43
40
|
__String_prototype_${regular}(_this);
|
44
41
|
export const __ByteString_prototype_${annex} = (_this: any) =>
|
45
|
-
__ByteString_prototype_${regular}(_this)
|
46
|
-
`;
|
42
|
+
__ByteString_prototype_${regular}(_this);`;
|
47
43
|
|
48
44
|
prototypeAlias('trimStart', 'trimLeft');
|
49
45
|
prototypeAlias('trimEnd', 'trimRight');
|
@@ -810,7 +810,7 @@ export const __String_prototype_substr = (_this: string, start: number, length:
|
|
810
810
|
return out;
|
811
811
|
};
|
812
812
|
|
813
|
-
export const __ByteString_prototype_substr = (_this:
|
813
|
+
export const __ByteString_prototype_substr = (_this: bytestring, start: number, length: number) => {
|
814
814
|
const len: i32 = _this.length;
|
815
815
|
|
816
816
|
start |= 0;
|
@@ -1078,7 +1078,7 @@ export const __ByteString_prototype_trim = (_this: bytestring) => {
|
|
1078
1078
|
};
|
1079
1079
|
|
1080
1080
|
|
1081
|
-
export const __String_prototype_concat = (_this:
|
1081
|
+
export const __String_prototype_concat = (_this: string, ...vals: any[]) => {
|
1082
1082
|
let out: any = Porffor.allocate();
|
1083
1083
|
Porffor.clone(_this, out);
|
1084
1084
|
|
@@ -1117,7 +1117,7 @@ local.set ${out}`;
|
|
1117
1117
|
return out;
|
1118
1118
|
};
|
1119
1119
|
|
1120
|
-
export const __ByteString_prototype_concat = (_this:
|
1120
|
+
export const __ByteString_prototype_concat = (_this: bytestring, ...vals: any[]) => {
|
1121
1121
|
let out: any = Porffor.allocate();
|
1122
1122
|
Porffor.clone(_this, out);
|
1123
1123
|
|
@@ -1190,7 +1190,7 @@ memory.copy 0 0`;
|
|
1190
1190
|
return out;
|
1191
1191
|
};
|
1192
1192
|
|
1193
|
-
export const __ByteString_prototype_repeat = (_this:
|
1193
|
+
export const __ByteString_prototype_repeat = (_this: bytestring, cnt: any) => {
|
1194
1194
|
const count: number = ecma262.ToIntegerOrInfinity(cnt);
|
1195
1195
|
if (count < 0) throw new RangeError('Invalid count value');
|
1196
1196
|
|