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.build.code_extractor; | 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/java_core.dart' show CharSeq
uence; | 10 import 'package:analyzer/src/generated/java_core.dart' show CharSequence; |
11 import 'package:analyzer_experimental/src/generated/ast.dart'; | 11 import 'package:analyzer/src/generated/ast.dart'; |
12 import 'package:analyzer_experimental/src/generated/error.dart'; | 12 import 'package:analyzer/src/generated/error.dart'; |
13 import 'package:analyzer_experimental/src/generated/parser.dart'; | 13 import 'package:analyzer/src/generated/parser.dart'; |
14 import 'package:analyzer_experimental/src/generated/scanner.dart'; | 14 import 'package:analyzer/src/generated/scanner.dart'; |
15 import 'package:barback/barback.dart'; | 15 import 'package:barback/barback.dart'; |
16 import 'package:path/path.dart' as path; | 16 import 'package:path/path.dart' as path; |
17 | 17 |
18 import 'common.dart'; | 18 import 'common.dart'; |
19 | 19 |
20 /** | 20 /** |
21 * Transformer that extracts Dart code inlined in HTML script tags and outputs a | 21 * Transformer that extracts Dart code inlined in HTML script tags and outputs a |
22 * separate file for each. | 22 * separate file for each. |
23 */ | 23 */ |
24 class InlineCodeExtractor extends Transformer with PolymerTransformer { | 24 class InlineCodeExtractor extends Transformer with PolymerTransformer { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 var scanner = new Scanner(null, reader, errorListener); | 77 var scanner = new Scanner(null, reader, errorListener); |
78 var token = scanner.tokenize(); | 78 var token = scanner.tokenize(); |
79 var unit = new Parser(null, errorListener).parseCompilationUnit(token); | 79 var unit = new Parser(null, errorListener).parseCompilationUnit(token); |
80 return unit.directives.any((d) => d is LibraryDirective); | 80 return unit.directives.any((d) => d is LibraryDirective); |
81 } | 81 } |
82 | 82 |
83 class _ErrorCollector extends AnalysisErrorListener { | 83 class _ErrorCollector extends AnalysisErrorListener { |
84 final errors = <AnalysisError>[]; | 84 final errors = <AnalysisError>[]; |
85 onError(error) => errors.add(error); | 85 onError(error) => errors.add(error); |
86 } | 86 } |
OLD | NEW |