OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library analyzer.src.generated.resolver; | 5 library analyzer.src.generated.resolver; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
(...skipping 1839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1850 void _validateFieldInitializers( | 1850 void _validateFieldInitializers( |
1851 ClassDeclaration classDeclaration, ConstructorDeclaration errorSite) { | 1851 ClassDeclaration classDeclaration, ConstructorDeclaration errorSite) { |
1852 NodeList<ClassMember> members = classDeclaration.members; | 1852 NodeList<ClassMember> members = classDeclaration.members; |
1853 for (ClassMember member in members) { | 1853 for (ClassMember member in members) { |
1854 if (member is FieldDeclaration && !member.isStatic) { | 1854 if (member is FieldDeclaration && !member.isStatic) { |
1855 for (VariableDeclaration variableDeclaration | 1855 for (VariableDeclaration variableDeclaration |
1856 in member.fields.variables) { | 1856 in member.fields.variables) { |
1857 Expression initializer = variableDeclaration.initializer; | 1857 Expression initializer = variableDeclaration.initializer; |
1858 if (initializer != null) { | 1858 if (initializer != null) { |
1859 // Ignore any errors produced during validation--if the constant | 1859 // Ignore any errors produced during validation--if the constant |
1860 // can't be eavluated we'll just report a single error. | 1860 // can't be evaluated we'll just report a single error. |
1861 AnalysisErrorListener errorListener = | 1861 AnalysisErrorListener errorListener = |
1862 AnalysisErrorListener.NULL_LISTENER; | 1862 AnalysisErrorListener.NULL_LISTENER; |
1863 ErrorReporter subErrorReporter = | 1863 ErrorReporter subErrorReporter = |
1864 new ErrorReporter(errorListener, _errorReporter.source); | 1864 new ErrorReporter(errorListener, _errorReporter.source); |
1865 DartObjectImpl result = initializer.accept(new ConstantVisitor( | 1865 DartObjectImpl result = initializer.accept(new ConstantVisitor( |
1866 new ConstantEvaluationEngine(_typeProvider, declaredVariables, | 1866 new ConstantEvaluationEngine(_typeProvider, declaredVariables, |
1867 typeSystem: _typeSystem), | 1867 typeSystem: _typeSystem), |
1868 subErrorReporter)); | 1868 subErrorReporter)); |
1869 if (result == null) { | 1869 if (result == null) { |
1870 _errorReporter.reportErrorForNode( | 1870 _errorReporter.reportErrorForNode( |
(...skipping 9065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10936 return null; | 10936 return null; |
10937 } | 10937 } |
10938 if (identical(node.staticElement, variable)) { | 10938 if (identical(node.staticElement, variable)) { |
10939 if (node.inSetterContext()) { | 10939 if (node.inSetterContext()) { |
10940 result = true; | 10940 result = true; |
10941 } | 10941 } |
10942 } | 10942 } |
10943 return null; | 10943 return null; |
10944 } | 10944 } |
10945 } | 10945 } |
OLD | NEW |