porffor 0.16.0-f9e625159 → 0.16.0-fa3914030
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.
@@ -0,0 +1,10 @@
|
|
1
|
+
// todo: support non-bytestring properly
|
2
|
+
export const String = (value: any): bytestring => {
|
3
|
+
if (Porffor.rawType(value) == Porffor.TYPES.symbol) return __Symbol_prototype_toString(value);
|
4
|
+
return __ecma262_ToString(value);
|
5
|
+
};
|
6
|
+
|
7
|
+
// todo: support constructor/string objects properly
|
8
|
+
export const String$constructor = (value: any): bytestring => {
|
9
|
+
return __ecma262_ToString(value);
|
10
|
+
};
|
package/compiler/codegen.js
CHANGED
@@ -1933,15 +1933,15 @@ const generateCall = (scope, decl, _global, _name, unusedValue = false) => {
|
|
1933
1933
|
}
|
1934
1934
|
|
1935
1935
|
if (valtypeBinary !== Valtype.i32 &&
|
1936
|
-
(
|
1936
|
+
(func && func.params[i * (typedParams ? 2 : 1)] === Valtype.i32)
|
1937
1937
|
) {
|
1938
1938
|
out.push(Opcodes.i32_to);
|
1939
1939
|
}
|
1940
1940
|
|
1941
1941
|
if (valtypeBinary === Valtype.i32 &&
|
1942
|
-
(
|
1942
|
+
(func && func.params[i * (typedParams ? 2 : 1)] === Valtype.f64)
|
1943
1943
|
) {
|
1944
|
-
out.push(Opcodes.f64_convert_i32_s);
|
1944
|
+
out.push([ Opcodes.f64_convert_i32_s ]);
|
1945
1945
|
}
|
1946
1946
|
|
1947
1947
|
if (typedParams) out = out.concat(getNodeType(scope, arg));
|
@@ -2092,6 +2092,24 @@ export const BuiltinFuncs = function() {
|
|
2092
2092
|
locals: [],
|
2093
2093
|
localNames: ["_this","_this#type"],
|
2094
2094
|
};
|
2095
|
+
this.String = {
|
2096
|
+
wasm: (scope, {builtin,}) => [[32,0],[32,1],[16, builtin('__Porffor_rawType')],[68,0,0,0,0,0,0,24,64],[97],[4,64],[32,0],[32,1],[16, builtin('__Symbol_prototype_toString')],[26],[15],[11],[32,0],[32,1],[16, builtin('__ecma262_ToString')],[15]],
|
2097
|
+
params: [124,127],
|
2098
|
+
typedParams: true,
|
2099
|
+
returns: [124],
|
2100
|
+
returnType: 18,
|
2101
|
+
locals: [127],
|
2102
|
+
localNames: ["value","value#type","#last_type"],
|
2103
|
+
};
|
2104
|
+
this.String$constructor = {
|
2105
|
+
wasm: (scope, {builtin,}) => [[32,0],[32,1],[16, builtin('__ecma262_ToString')],[15]],
|
2106
|
+
params: [124,127],
|
2107
|
+
typedParams: true,
|
2108
|
+
returns: [124],
|
2109
|
+
returnType: 18,
|
2110
|
+
locals: [],
|
2111
|
+
localNames: ["value","value#type"],
|
2112
|
+
};
|
2095
2113
|
this.__Porffor_symbol_descStore = {
|
2096
2114
|
wasm: (scope, {allocPage,builtin,}) => [...number(allocPage(scope, 'bytestring: __Porffor_symbol_descStore/ptr', 'i8') * pageSize, 124),[33,4],[32,0],[252,3],[4,64],[32,4],[252,2],[40,0,0],[183],[33,5],[32,4],[252,2],[32,5],[68,0,0,0,0,0,0,240,63],[160],[252,2],[54,0,0],[32,4],[65,18],[32,5],[65,0],[32,2],[32,3],[16, builtin('__Porffor_set_write')],[26],[32,5],[65,0],[15],[5],[32,4],[65,18],[32,2],[32,3],[16, builtin('__Porffor_set_read')],[34,6],[15],[11],[68,0,0,0,0,0,0,0,0],[65,3],[15]],
|
2097
2115
|
params: [124,127,124,127],
|
package/package.json
CHANGED