| 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 /// Records accesses to Dart program declarations and generates code that will | 5 /// Records accesses to Dart program declarations and generates code that will |
| 6 /// allow to do the same accesses at runtime using `package:smoke/static.dart`. | 6 /// allow to do the same accesses at runtime using `package:smoke/static.dart`. |
| 7 /// Internally, this library relies on the `analyzer` to extract data from the | 7 /// Internally, this library relies on the `analyzer` to extract data from the |
| 8 /// program, and then uses [SmokeCodeGenerator] to produce the code needed by | 8 /// program, and then uses [SmokeCodeGenerator] to produce the code needed by |
| 9 /// the smoke system. | 9 /// the smoke system. |
| 10 /// | 10 /// |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 246 |
| 247 /// Adds [name] as a symbol, a getter, and optionally a setter in [generator]. | 247 /// Adds [name] as a symbol, a getter, and optionally a setter in [generator]. |
| 248 _addAccessors(String name, bool includeSetter) { | 248 _addAccessors(String name, bool includeSetter) { |
| 249 generator.addSymbol(name); | 249 generator.addSymbol(name); |
| 250 generator.addGetter(name); | 250 generator.addGetter(name); |
| 251 if (includeSetter) generator.addSetter(name); | 251 if (includeSetter) generator.addSetter(name); |
| 252 } | 252 } |
| 253 | 253 |
| 254 /// Copy metadata associated with the declaration of [target]. | 254 /// Copy metadata associated with the declaration of [target]. |
| 255 List<ConstExpression> _copyAnnotations(Element target) { | 255 List<ConstExpression> _copyAnnotations(Element target) { |
| 256 var node = target.node; | 256 var node = target.computeNode(); |
| 257 // [node] is the initialization expression, we walk up to get to the actual | 257 // [node] is the initialization expression, we walk up to get to the actual |
| 258 // member declaration where the metadata is attached to. | 258 // member declaration where the metadata is attached to. |
| 259 while (node is! ClassMember) node = node.parent; | 259 while (node is! ClassMember) node = node.parent; |
| 260 return node.metadata.map(_convertAnnotation).toList(); | 260 return node.metadata.map(_convertAnnotation).toList(); |
| 261 } | 261 } |
| 262 | 262 |
| 263 /// Converts annotations into [ConstExpression]s supported by the codegen | 263 /// Converts annotations into [ConstExpression]s supported by the codegen |
| 264 /// library. | 264 /// library. |
| 265 ConstExpression _convertAnnotation(Annotation annotation) { | 265 ConstExpression _convertAnnotation(Annotation annotation) { |
| 266 var element = annotation.element; | 266 var element = annotation.element; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 final NameMatcher matches; | 396 final NameMatcher matches; |
| 397 | 397 |
| 398 const QueryOptions({this.includeFields: true, this.includeProperties: true, | 398 const QueryOptions({this.includeFields: true, this.includeProperties: true, |
| 399 this.includeInherited: true, this.includeUpTo: null, | 399 this.includeInherited: true, this.includeUpTo: null, |
| 400 this.excludeFinal: false, this.includeMethods: false, | 400 this.excludeFinal: false, this.includeMethods: false, |
| 401 this.withAnnotations: null, this.matches: null}); | 401 this.withAnnotations: null, this.matches: null}); |
| 402 } | 402 } |
| 403 | 403 |
| 404 /// Predicate that tells whether [name] should be included in query results. | 404 /// Predicate that tells whether [name] should be included in query results. |
| 405 typedef bool NameMatcher(String name); | 405 typedef bool NameMatcher(String name); |
| OLD | NEW |