mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 04:27:17 +00:00
[ddc] Avoid adding raw type parameters to type table
There is no need to add a single type parameter to the type table because it is already represented as a local variable in the scope where it appears. Change-Id: I4553d54304a2e3b82e856b8511fdce81cda0653e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324901 Reviewed-by: Mark Zhou <markzipan@google.com> Commit-Queue: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
parent
db214e8c81
commit
1cce9b8052
|
@ -3366,7 +3366,14 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
|
||||||
normalizedType, _currentTypeEnvironment);
|
normalizedType, _currentTypeEnvironment);
|
||||||
var typeRep =
|
var typeRep =
|
||||||
evalInEnvironment(result.requiredEnvironment, result.recipe);
|
evalInEnvironment(result.requiredEnvironment, result.recipe);
|
||||||
if (_cacheTypes) typeRep = _typeTable.nameType(normalizedType, typeRep);
|
if (_cacheTypes &&
|
||||||
|
// Avoid adding a the use of a single type parameter to the type
|
||||||
|
// table. These can be referenced directly because the are already
|
||||||
|
// represented as a local variable in the scope.
|
||||||
|
!(normalizedType is TypeParameterType &&
|
||||||
|
normalizedType.isPotentiallyNonNullable)) {
|
||||||
|
typeRep = _typeTable.nameType(normalizedType, typeRep);
|
||||||
|
}
|
||||||
return typeRep;
|
return typeRep;
|
||||||
} on UnsupportedError catch (e) {
|
} on UnsupportedError catch (e) {
|
||||||
_typeCompilationError(normalizedType, e.message ?? 'Unknown Error');
|
_typeCompilationError(normalizedType, e.message ?? 'Unknown Error');
|
||||||
|
|
Loading…
Reference in a new issue