Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3754)

Unified Diff: pkg/analyzer/lib/src/generated/static_type_analyzer.dart

Issue 2711733003: Issue 28862. Implement type inference for invokeConstructor. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/driver.dart ('k') | pkg/analyzer/lib/src/summary/link.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/static_type_analyzer.dart
diff --git a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
index b0d106c36809f8713c613da8044b90e7c4503d68..4b96f41e8d0d841b4df240ef960c82290204eef4 100644
--- a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
+++ b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
@@ -1582,7 +1582,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* For example given the type `class C<T> { C(T arg); }`, the generic function
* type is `<T>(T) -> C<T>`.
*/
- FunctionType _constructorToGenericFunctionType(
+ static FunctionType constructorToGenericFunctionType(
ConstructorElement constructor) {
// TODO(jmesserly): it may be worth making this available from the
// constructor. It's nice if our inference code can operate uniformly on
@@ -1621,6 +1621,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
type = type.substitute2(freshTypeVars, typeVars);
var function = new FunctionElementImpl("", -1);
+ function.enclosingElement = cls;
function.isSynthetic = true;
function.returnType = type.returnType;
function.typeParameters = freshVarElements;
@@ -2043,7 +2044,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
var rawElement = (originalElement as ConstructorMember).baseElement;
FunctionType constructorType =
- _constructorToGenericFunctionType(rawElement);
+ constructorToGenericFunctionType(rawElement);
ArgumentList arguments = node.argumentList;
FunctionType inferred = _inferGenericInvoke(node, constructorType,
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/driver.dart ('k') | pkg/analyzer/lib/src/summary/link.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698