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 part of dart2js.js_emitter.program_builder; | 5 part of dart2js.js_emitter.program_builder; |
6 | 6 |
7 class LibraryContents { | 7 class LibraryContents { |
8 final List<ClassEntity> classes = <ClassEntity>[]; | 8 final List<ClassEntity> classes = <ClassEntity>[]; |
9 final List<MemberEntity> members = <MemberEntity>[]; | 9 final List<MemberEntity> members = <MemberEntity>[]; |
10 } | 10 } |
11 | 11 |
12 /// Maps [LibraryEntity]s to their [ClassEntity]s and [MemberEntity]s. | 12 /// Maps [LibraryEntity]s to their [ClassEntity]s and [MemberEntity]s. |
13 /// | 13 /// |
14 /// Fundamentally, this class nicely encapsulates a | 14 /// Fundamentally, this class nicely encapsulates a |
15 /// `Map<LibraryElement, Pair<List<ClassElement>, List<MemberElement>>>`. | 15 /// `Map<LibraryEntity, Pair<List<ClassEntity>, List<MemberEntity>>>`. |
16 /// | 16 /// |
17 /// There exists exactly one instance per [OutputUnit]. | 17 /// There exists exactly one instance per [OutputUnit]. |
18 class LibrariesMap { | 18 class LibrariesMap { |
19 final Map<LibraryEntity, LibraryContents> _mapping = | 19 final Map<LibraryEntity, LibraryContents> _mapping = |
20 <LibraryEntity, LibraryContents>{}; | 20 <LibraryEntity, LibraryContents>{}; |
21 | 21 |
22 // It is very common to access the same library multiple times in a row, so | 22 // It is very common to access the same library multiple times in a row, so |
23 // we cache the last access. | 23 // we cache the last access. |
24 LibraryEntity _lastLibrary; | 24 LibraryEntity _lastLibrary; |
25 LibraryContents _lastMapping; | 25 LibraryContents _lastMapping; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 (_holdersMap[name].isStaticStateHolder == isStaticStateHolder && | 145 (_holdersMap[name].isStaticStateHolder == isStaticStateHolder && |
146 _holdersMap[name].isConstantsHolder == isConstantsHolder)); | 146 _holdersMap[name].isConstantsHolder == isConstantsHolder)); |
147 | 147 |
148 return _holdersMap.putIfAbsent(name, () { | 148 return _holdersMap.putIfAbsent(name, () { |
149 return new Holder(name, _holdersMap.length, | 149 return new Holder(name, _holdersMap.length, |
150 isStaticStateHolder: isStaticStateHolder, | 150 isStaticStateHolder: isStaticStateHolder, |
151 isConstantsHolder: isConstantsHolder); | 151 isConstantsHolder: isConstantsHolder); |
152 }); | 152 }); |
153 } | 153 } |
154 } | 154 } |
OLD | NEW |