OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 dart2js.resolution.constructors; | 5 library dart2js.resolution.constructors; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/resolution.dart' show Feature; | 8 import '../common/resolution.dart' show Feature; |
9 import '../compiler.dart' show Compiler; | 9 import '../compiler.dart' show Compiler; |
10 import '../constants/constructors.dart' | 10 import '../constants/constructors.dart' |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 ]); | 70 ]); |
71 isValidAsConstant = false; | 71 isValidAsConstant = false; |
72 } | 72 } |
73 | 73 |
74 void checkForDuplicateInitializers(FieldElementX field, Node init) { | 74 void checkForDuplicateInitializers(FieldElementX field, Node init) { |
75 // [field] can be null if it could not be resolved. | 75 // [field] can be null if it could not be resolved. |
76 if (field == null) return; | 76 if (field == null) return; |
77 if (initialized.containsKey(field)) { | 77 if (initialized.containsKey(field)) { |
78 reportDuplicateInitializerError(field, init, initialized[field]); | 78 reportDuplicateInitializerError(field, init, initialized[field]); |
79 } else if (field.isFinal) { | 79 } else if (field.isFinal) { |
80 field.parseNode(visitor.resolution.parsing); | 80 field.parseNode(visitor.resolution.parsingContext); |
81 Expression initializer = field.initializer; | 81 Expression initializer = field.initializer; |
82 if (initializer != null) { | 82 if (initializer != null) { |
83 reportDuplicateInitializerError( | 83 reportDuplicateInitializerError( |
84 field, | 84 field, |
85 init, | 85 init, |
86 reporter.withCurrentElement( | 86 reporter.withCurrentElement( |
87 field, () => reporter.spanFromSpannable(initializer))); | 87 field, () => reporter.spanFromSpannable(initializer))); |
88 } | 88 } |
89 } | 89 } |
90 initialized[field] = init; | 90 initialized[field] = init; |
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 // constructors. | 849 // constructors. |
850 return null; | 850 return null; |
851 } | 851 } |
852 // TODO(johnniwinther): Use [Name] for lookup. | 852 // TODO(johnniwinther): Use [Name] for lookup. |
853 ConstructorElement constructor = cls.lookupConstructor(constructorName); | 853 ConstructorElement constructor = cls.lookupConstructor(constructorName); |
854 if (constructor != null) { | 854 if (constructor != null) { |
855 constructor = constructor.declaration; | 855 constructor = constructor.declaration; |
856 } | 856 } |
857 return constructor; | 857 return constructor; |
858 } | 858 } |
OLD | NEW |