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

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

Issue 2109353004: Revert "fix #25794, infer parameter type from default value" (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | pkg/analyzer/lib/src/summary/summarize_elements.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index f286a87e59a93eec254f02988dc21557154a9cd5..15c41d6218239ff744561fdab9bb3775ba2e2c5d 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -4857,7 +4857,7 @@ class InferenceContext {
* Place an info node into the error stream indicating that a
* [type] has been inferred as the type of [node].
*/
- void recordInference(AstNode node, DartType type) {
+ void recordInference(Expression node, DartType type) {
if (!_inferenceHints) {
return;
}
@@ -5653,11 +5653,6 @@ class ResolverVisitor extends ScopedVisitor {
bool resolveOnlyCommentInFunctionBody = false;
/**
- * True if we're analyzing in strong mode.
- */
- bool _strongMode;
-
- /**
* Body of the function currently being analyzed, if any.
*/
FunctionBody _currentFunctionBody;
@@ -5688,7 +5683,6 @@ class ResolverVisitor extends ScopedVisitor {
this.typeSystem = definingLibrary.context.typeSystem;
bool strongModeHints = false;
AnalysisOptions options = definingLibrary.context.analysisOptions;
- _strongMode = options.strongMode;
if (options is AnalysisOptionsImpl) {
strongModeHints = options.strongModeHints;
}
@@ -6379,24 +6373,13 @@ class ResolverVisitor extends ScopedVisitor {
@override
Object visitDefaultFormalParameter(DefaultFormalParameter node) {
- ParameterElement element = node.element;
- InferenceContext.setType(node.defaultValue, element.type);
+ InferenceContext.setType(node.defaultValue, node.parameter.element?.type);
super.visitDefaultFormalParameter(node);
+ ParameterElement element = node.element;
if (element.initializer != null && node.defaultValue != null) {
(element.initializer as FunctionElementImpl).returnType =
node.defaultValue.staticType;
}
- if (_strongMode &&
- node.defaultValue != null &&
- element.hasImplicitType &&
- element is! FieldFormalParameterElement) {
-
- DartType type = node.defaultValue.staticType;
- if (!type.isBottom && !type.isDynamic) {
- (element as ParameterElementImpl).type = type;
- inferenceContext.recordInference(node, type);
- }
- }
// Clone the ASTs for default formal parameters, so that we can use them
// during constant evaluation.
if (!LibraryElementImpl.hasResolutionCapability(
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/summarize_elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698