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 import 'dart:collection' show HashMap, HashSet; | 5 import 'dart:collection' show HashMap, HashSet; |
6 import 'package:analyzer/dart/ast/ast.dart' show Identifier; | 6 import 'package:analyzer/dart/ast/ast.dart' show Identifier; |
7 import 'package:analyzer/dart/element/element.dart'; | 7 import 'package:analyzer/dart/element/element.dart'; |
8 | 8 |
9 import 'js_codegen.dart' show ExtensionTypeSet; | 9 import 'js_codegen.dart' show ExtensionTypeSet; |
10 import '../info.dart' show LibraryUnit; | |
11 | 10 |
12 /// We use a storage slot for fields that override or can be overridden by | 11 /// We use a storage slot for fields that override or can be overridden by |
13 /// getter/setter pairs. | 12 /// getter/setter pairs. |
14 HashSet<FieldElement> findFieldsNeedingStorage( | 13 HashSet<FieldElement> findFieldsNeedingStorage( |
15 LibraryUnit library, ExtensionTypeSet extensionTypes) { | 14 Iterable<CompilationUnitElement> units, ExtensionTypeSet extensionTypes) { |
16 var overrides = new HashSet<FieldElement>(); | 15 var overrides = new HashSet<FieldElement>(); |
17 for (var unit in library.partsThenLibrary) { | 16 for (var unit in units) { |
18 for (var cls in unit.element.types) { | 17 for (var cls in unit.types) { |
19 var superclasses = getSuperclasses(cls); | 18 var superclasses = getSuperclasses(cls); |
20 for (var field in cls.fields) { | 19 for (var field in cls.fields) { |
21 if (!field.isSynthetic && !overrides.contains(field)) { | 20 if (!field.isSynthetic && !overrides.contains(field)) { |
22 checkForPropertyOverride( | 21 checkForPropertyOverride( |
23 field, superclasses, overrides, extensionTypes); | 22 field, superclasses, overrides, extensionTypes); |
24 } | 23 } |
25 } | 24 } |
26 } | 25 } |
27 } | 26 } |
28 | 27 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 if (mixin != null) result.add(mixin); | 82 if (mixin != null) result.add(mixin); |
84 } | 83 } |
85 var supertype = cls.supertype; | 84 var supertype = cls.supertype; |
86 if (supertype == null) break; | 85 if (supertype == null) break; |
87 | 86 |
88 cls = supertype.element; | 87 cls = supertype.element; |
89 result.add(cls); | 88 result.add(cls); |
90 } | 89 } |
91 return result; | 90 return result; |
92 } | 91 } |
OLD | NEW |