| 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 /** Transfomer that extracts inlined script code into separate assets. */ | 5 /** Transfomer that extracts inlined script code into separate assets. */ |
| 6 library polymer.src.transformers; | 6 library polymer.src.build.code_extractor; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 | 9 |
| 10 import 'package:analyzer_experimental/src/generated/ast.dart'; | 10 import 'package:analyzer_experimental/src/generated/ast.dart'; |
| 11 import 'package:analyzer_experimental/src/generated/error.dart'; | 11 import 'package:analyzer_experimental/src/generated/error.dart'; |
| 12 import 'package:analyzer_experimental/src/generated/parser.dart'; | 12 import 'package:analyzer_experimental/src/generated/parser.dart'; |
| 13 import 'package:analyzer_experimental/src/generated/scanner.dart'; | 13 import 'package:analyzer_experimental/src/generated/scanner.dart'; |
| 14 import 'package:barback/barback.dart'; | 14 import 'package:barback/barback.dart'; |
| 15 import 'package:path/path.dart' as path; | 15 import 'package:path/path.dart' as path; |
| 16 | 16 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 var errorListener = new _ErrorCollector(); | 74 var errorListener = new _ErrorCollector(); |
| 75 var token = new StringScanner(null, code, errorListener).tokenize(); | 75 var token = new StringScanner(null, code, errorListener).tokenize(); |
| 76 var unit = new Parser(null, errorListener).parseCompilationUnit(token); | 76 var unit = new Parser(null, errorListener).parseCompilationUnit(token); |
| 77 return unit.directives.any((d) => d is LibraryDirective); | 77 return unit.directives.any((d) => d is LibraryDirective); |
| 78 } | 78 } |
| 79 | 79 |
| 80 class _ErrorCollector extends AnalysisErrorListener { | 80 class _ErrorCollector extends AnalysisErrorListener { |
| 81 final errors = <AnalysisError>[]; | 81 final errors = <AnalysisError>[]; |
| 82 onError(error) => errors.add(error); | 82 onError(error) => errors.add(error); |
| 83 } | 83 } |
| OLD | NEW |