OLD | NEW |
1 #!/usr/bin/env dart | 1 #!/usr/bin/env dart |
2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 import 'dart:io'; | 6 import 'dart:io'; |
7 | 7 |
8 import 'package:analyzer/dart/ast/ast.dart'; | 8 import 'package:analyzer/dart/ast/ast.dart'; |
9 import 'package:analyzer/dart/ast/visitor.dart'; | 9 import 'package:analyzer/dart/ast/visitor.dart'; |
10 import 'package:analyzer/src/dart/scanner/reader.dart'; | 10 import 'package:analyzer/src/dart/scanner/reader.dart'; |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 var visitor = new _ASTVisitor(); | 37 var visitor = new _ASTVisitor(); |
38 unit.accept(visitor); | 38 unit.accept(visitor); |
39 | 39 |
40 for (var error in errorListener.errors) { | 40 for (var error in errorListener.errors) { |
41 print(error); | 41 print(error); |
42 } | 42 } |
43 } | 43 } |
44 | 44 |
45 class _ASTVisitor extends GeneralizingAstVisitor { | 45 class _ASTVisitor extends GeneralizingAstVisitor { |
| 46 @override |
46 visitNode(AstNode node) { | 47 visitNode(AstNode node) { |
47 print('${node.runtimeType} : <"$node">'); | 48 print('${node.runtimeType} : <"$node">'); |
48 return super.visitNode(node); | 49 return super.visitNode(node); |
49 } | 50 } |
50 } | 51 } |
51 | 52 |
52 class _ErrorCollector extends AnalysisErrorListener { | 53 class _ErrorCollector extends AnalysisErrorListener { |
53 List<AnalysisError> errors; | 54 List<AnalysisError> errors; |
54 _ErrorCollector() : errors = new List<AnalysisError>(); | 55 _ErrorCollector() : errors = new List<AnalysisError>(); |
| 56 @override |
55 onError(error) => errors.add(error); | 57 onError(error) => errors.add(error); |
56 } | 58 } |
OLD | NEW |