[dart2wasm] Ensure functions.getFunction().type and functions.getFunctionType() agree
Right now the two APIs disagree when the given function is a wasm import/export: We eagerly generate wasm import/export functions and construct their function's type in a special way - so any `functions.getFunction()` will return this already built function object. Though `functions.getFunctionType()` doesn't recognize imports/exports and generates different type. => Make the `getFunctionType()` also recognize imports/exports. Change-Id: I2afbf38eeda87019e589db8ee6b9f2c7697eede9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378707 Reviewed-by: Ömer Ağacan <omersa@google.com> Commit-Queue: Martin Kustermann <kustermann@google.com>
This commit is contained in:
committed by
Commit Queue
parent
85ae8e03eb
commit
b678794932
@@ -138,6 +138,15 @@ class FunctionCollector {
|
||||
}
|
||||
|
||||
w.FunctionType getFunctionType(Reference target) {
|
||||
// We first try to get the function type by seeing if we already
|
||||
// compiled the [target] function.
|
||||
//
|
||||
// We do that because [target] may refer to a imported/exported function
|
||||
// which get their function type translated differently (it would be
|
||||
// incorrect to use [_getFunctionType]).
|
||||
final existingFunction = getExistingFunction(target);
|
||||
if (existingFunction != null) return existingFunction.type;
|
||||
|
||||
return _getFunctionType(target);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user