| 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 /// |
| 11 /// This library only uses the analyzer to consume data previously produced by | 11 /// This library only uses the analyzer to consume data previously produced by |
| 12 /// running the resolver. This library does not provide any hooks to integrate | 12 /// running the resolver. This library does not provide any hooks to integrate |
| 13 /// running the analyzer itself. See `package:code_transformers` to integrate | 13 /// running the analyzer itself. See `package:code_transformers` to integrate |
| 14 /// the analyzer into pub transformers. | 14 /// the analyzer into pub transformers. |
| 15 library smoke.codegen.recorder; | 15 library smoke.codegen.recorder; |
| 16 | 16 |
| 17 import 'package:analyzer/src/generated/element.dart'; | 17 import 'package:analyzer/dart/ast/ast.dart'; |
| 18 import 'package:analyzer/src/generated/ast.dart'; | 18 import 'package:analyzer/dart/element/element.dart'; |
| 19 import 'generator.dart'; | 19 import 'generator.dart'; |
| 20 | 20 |
| 21 typedef String ImportUrlResolver(LibraryElement lib); | 21 typedef String ImportUrlResolver(LibraryElement lib); |
| 22 | 22 |
| 23 /// A recorder that tracks how elements are accessed in order to generate code | 23 /// A recorder that tracks how elements are accessed in order to generate code |
| 24 /// that replicates those accesses with the smoke runtime. | 24 /// that replicates those accesses with the smoke runtime. |
| 25 class Recorder { | 25 class Recorder { |
| 26 /// Underlying code generator. | 26 /// Underlying code generator. |
| 27 SmokeCodeGenerator generator; | 27 SmokeCodeGenerator generator; |
| 28 | 28 |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 this.includeInherited: true, | 406 this.includeInherited: true, |
| 407 this.includeUpTo: null, | 407 this.includeUpTo: null, |
| 408 this.excludeFinal: false, | 408 this.excludeFinal: false, |
| 409 this.includeMethods: false, | 409 this.includeMethods: false, |
| 410 this.withAnnotations: null, | 410 this.withAnnotations: null, |
| 411 this.matches: null}); | 411 this.matches: null}); |
| 412 } | 412 } |
| 413 | 413 |
| 414 /// Predicate that tells whether [name] should be included in query results. | 414 /// Predicate that tells whether [name] should be included in query results. |
| 415 typedef bool NameMatcher(String name); | 415 typedef bool NameMatcher(String name); |
| OLD | NEW |