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

Unified Diff: pkg/analyzer/lib/src/task/strong_mode.dart

Issue 1305863011: Improve strong-mode implementation and fix several failing tests (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Addressed comments Created 5 years, 3 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/task/dart.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/task/strong_mode.dart
diff --git a/pkg/analyzer/lib/src/task/strong_mode.dart b/pkg/analyzer/lib/src/task/strong_mode.dart
index 3d13146065a5344d93801fdf710494630f757e27..a78d590f344a6403c06ab3b52cb26763f5fc0579 100644
--- a/pkg/analyzer/lib/src/task/strong_mode.dart
+++ b/pkg/analyzer/lib/src/task/strong_mode.dart
@@ -83,83 +83,6 @@ ParameterElement _getParameter(ExecutableElement setter) {
typedef bool VariableFilter(VariableElement element);
/**
- * An object used to find static variables whose types should be inferred and
- * classes whose members should have types inferred. Clients are expected to
- * visit a [CompilationUnit].
- */
-class InferrenceFinder extends SimpleAstVisitor {
- /**
- * The static variables that should have types inferred for them.
- */
- final List<VariableElement> staticVariables = <VariableElement>[];
-
- /**
- * The classes defined in the unit.
- *
- * TODO(brianwilkerson) We don't currently remove classes whose members do not
- * need to be processed, but we potentially could.
- */
- final List<ClassElement> classes = <ClassElement>[];
-
- /**
- * Initialize a newly created finder.
- */
- InferrenceFinder();
-
- @override
- void visitClassDeclaration(ClassDeclaration node) {
- classes.add(node.element);
- for (ClassMember member in node.members) {
- member.accept(this);
- }
- }
-
- @override
- void visitClassTypeAlias(ClassTypeAlias node) {
- classes.add(node.element);
- }
-
- @override
- void visitCompilationUnit(CompilationUnit node) {
- for (CompilationUnitMember declaration in node.declarations) {
- declaration.accept(this);
- }
- }
-
- @override
- void visitFieldDeclaration(FieldDeclaration node) {
- if (node.isStatic && node.fields.type == null) {
- _addVariables(node.fields.variables);
- }
- }
-
- @override
- void visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) {
- if (node.variables.type == null) {
- _addVariables(node.variables.variables);
- }
- }
-
- /**
- * Add all of the [variables] with initializers to the list of variables whose
- * type can be inferred. Technically, we only infer the types of variables
- * that do not have a static type, but all variables with initializers
- * potentially need to be re-resolved after inference because they might
- * refer to fields whose type was inferred.
- */
- void _addVariables(NodeList<VariableDeclaration> variables) {
- for (VariableDeclaration variable in variables) {
- if (variable.initializer != null) {
- VariableElement element = variable.element;
- if (element.hasImplicitType) {
- staticVariables.add(element);
- }
- }
- }
- }
-}
-
-/**
* An object used to infer the type of instance fields and the return types of
* instance methods within a single compilation unit.
*/
@@ -416,7 +339,7 @@ class InstanceMemberInferrer {
(fieldElement as FieldElementImpl).type = newType;
setReturnType(fieldElement.getter, newType);
if (!fieldElement.isFinal && !fieldElement.isConst) {
- setParameterType(fieldElement.setter, newType);
+ setParameterType(fieldElement.setter, newType);
}
}
}
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698