OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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.js_emitter.metadata_collector; | 5 library dart2js.js_emitter.metadata_collector; |
6 | 6 |
7 import 'package:js_ast/src/precedence.dart' as js_precedence; | 7 import 'package:js_ast/src/precedence.dart' as js_precedence; |
8 | 8 |
9 import '../common.dart'; | 9 import '../common.dart'; |
10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 182 } |
183 | 183 |
184 jsAst.Fun buildLibraryMetadataFunction(LibraryEntity element) { | 184 jsAst.Fun buildLibraryMetadataFunction(LibraryEntity element) { |
185 if (!_mirrorsData.mustRetainMetadata || | 185 if (!_mirrorsData.mustRetainMetadata || |
186 !_mirrorsData.isLibraryReferencedFromMirrorSystem(element)) { | 186 !_mirrorsData.isLibraryReferencedFromMirrorSystem(element)) { |
187 return null; | 187 return null; |
188 } | 188 } |
189 return _buildMetadataFunction(element as LibraryElement); | 189 return _buildMetadataFunction(element as LibraryElement); |
190 } | 190 } |
191 | 191 |
192 jsAst.Fun buildClassMetadataFunction(ClassElement element) { | 192 jsAst.Fun buildClassMetadataFunction(ClassEntity cls) { |
193 if (!_mirrorsData.mustRetainMetadata || | 193 if (!_mirrorsData.mustRetainMetadata || |
194 !_mirrorsData.isClassReferencedFromMirrorSystem(element)) { | 194 !_mirrorsData.isClassReferencedFromMirrorSystem(cls)) { |
195 return null; | 195 return null; |
196 } | 196 } |
| 197 // TODO(johnniwinther): Handle class entities. |
| 198 ClassElement element = cls; |
197 return _buildMetadataFunction(element); | 199 return _buildMetadataFunction(element); |
198 } | 200 } |
199 | 201 |
200 bool _mustEmitMetadataForMember(MemberElement element) { | 202 bool _mustEmitMetadataForMember(MemberElement element) { |
201 return _mirrorsData.mustRetainMetadata && | 203 return _mirrorsData.mustRetainMetadata && |
202 _mirrorsData.isMemberReferencedFromMirrorSystem(element); | 204 _mirrorsData.isMemberReferencedFromMirrorSystem(element); |
203 } | 205 } |
204 | 206 |
205 jsAst.Fun buildFieldMetadataFunction(FieldElement element) { | 207 jsAst.Fun buildFieldMetadataFunction(FieldElement element) { |
206 if (!_mustEmitMetadataForMember(element)) return null; | 208 if (!_mustEmitMetadataForMember(element)) return null; |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 if (token is _ForwardingMetadataEntry && !token.isBound) { | 465 if (token is _ForwardingMetadataEntry && !token.isBound) { |
464 _foundUnboundToken = true; | 466 _foundUnboundToken = true; |
465 } | 467 } |
466 } | 468 } |
467 | 469 |
468 bool findUnboundPlaceholders(jsAst.Node node) { | 470 bool findUnboundPlaceholders(jsAst.Node node) { |
469 node.accept(this); | 471 node.accept(this); |
470 return _foundUnboundToken; | 472 return _foundUnboundToken; |
471 } | 473 } |
472 } | 474 } |
OLD | NEW |