Make sure that contextual type arguments are passed when resolving the target of a new expression; Fix decoding of UTF8 strings with more than two code units in the Binaryen interface

This commit is contained in:
dcodeIO 2018-04-22 00:17:14 +02:00
parent bde13b12cf
commit 05117f9ee3
4 changed files with 5 additions and 3 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5847,7 +5847,7 @@ export class Compiler extends DiagnosticEmitter {
var classPrototype = <ClassPrototype>target; var classPrototype = <ClassPrototype>target;
var classInstance = classPrototype.resolveUsingTypeArguments( // reports var classInstance = classPrototype.resolveUsingTypeArguments( // reports
expression.typeArguments, expression.typeArguments,
null, currentFunction.flow.contextualTypeArguments,
expression expression
); );
if (!classInstance) return module.createUnreachable(); if (!classInstance) return module.createUnreachable();

View File

@ -1195,6 +1195,7 @@ function stringLengthUTF8(str: string): usize {
function allocString(str: string | null): usize { function allocString(str: string | null): usize {
if (str == null) return 0; if (str == null) return 0;
var ptr = allocate_memory(stringLengthUTF8(str) + 1); var ptr = allocate_memory(stringLengthUTF8(str) + 1);
// the following is based on Emscripten's stringToUTF8Array
var idx = ptr; var idx = ptr;
for (let i = 0, k = str.length; i < k; ++i) { for (let i = 0, k = str.length; i < k; ++i) {
let u = str.charCodeAt(i); let u = str.charCodeAt(i);
@ -1284,6 +1285,7 @@ export function readString(ptr: usize): string | null {
} }
} }
} }
arr.push(cp);
// if (cp < 0x10000) { // if (cp < 0x10000) {
// arr.push(cp); // arr.push(cp);
// } else { // } else {