Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: pkg/polymer/lib/src/build/code_extractor.dart

Issue 172923002: [polymer] fix editor hints -- query/queryAll and unused imports (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/polymer/lib/src/build/build_filter.dart ('k') | pkg/polymer/lib/src/build/linter.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/src/generated/ast.dart'; 10 import 'package:analyzer/src/generated/ast.dart';
(...skipping 16 matching lines...) Expand all
27 27
28 /** Only run this transformer on .html files. */ 28 /** Only run this transformer on .html files. */
29 final String allowedExtensions = ".html"; 29 final String allowedExtensions = ".html";
30 30
31 Future apply(Transform transform) { 31 Future apply(Transform transform) {
32 var input = transform.primaryInput; 32 var input = transform.primaryInput;
33 var id = transform.primaryInput.id; 33 var id = transform.primaryInput.id;
34 return readPrimaryAsHtml(transform).then((document) { 34 return readPrimaryAsHtml(transform).then((document) {
35 int count = 0; 35 int count = 0;
36 bool htmlChanged = false; 36 bool htmlChanged = false;
37 for (var tag in document.queryAll('script')) { 37 for (var tag in document.querySelectorAll('script')) {
38 // Only process tags that have inline Dart code 38 // Only process tags that have inline Dart code
39 if (tag.attributes['type'] != 'application/dart' || 39 if (tag.attributes['type'] != 'application/dart' ||
40 tag.attributes.containsKey('src')) { 40 tag.attributes.containsKey('src')) {
41 continue; 41 continue;
42 } 42 }
43 htmlChanged = true; 43 htmlChanged = true;
44 44
45 // Remove empty tags 45 // Remove empty tags
46 if (tag.nodes.length == 0) { 46 if (tag.nodes.length == 0) {
47 tag.remove(); 47 tag.remove();
(...skipping 28 matching lines...) Expand all
76 var scanner = new Scanner(null, reader, errorListener); 76 var scanner = new Scanner(null, reader, errorListener);
77 var token = scanner.tokenize(); 77 var token = scanner.tokenize();
78 var unit = new Parser(null, errorListener).parseCompilationUnit(token); 78 var unit = new Parser(null, errorListener).parseCompilationUnit(token);
79 return unit.directives.any((d) => d is LibraryDirective); 79 return unit.directives.any((d) => d is LibraryDirective);
80 } 80 }
81 81
82 class _ErrorCollector extends AnalysisErrorListener { 82 class _ErrorCollector extends AnalysisErrorListener {
83 final errors = <AnalysisError>[]; 83 final errors = <AnalysisError>[];
84 onError(error) => errors.add(error); 84 onError(error) => errors.add(error);
85 } 85 }
OLDNEW
« no previous file with comments | « pkg/polymer/lib/src/build/build_filter.dart ('k') | pkg/polymer/lib/src/build/linter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698