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 /** | 5 /** |
6 * Part of the template compilation that concerns with extracting information | 6 * Part of the template compilation that concerns with extracting information |
7 * from the HTML parse tree. | 7 * from the HTML parse tree. |
8 */ | 8 */ |
9 library analyzer; | 9 library analyzer; |
10 | 10 |
11 import 'package:csslib/parser.dart' as Css; | 11 import 'package:csslib/parser.dart' as css; |
12 import 'package:csslib/visitor.dart' show StyleSheet, treeToDebugString, Visitor
, Expressions, VarDefinition; | 12 import 'package:csslib/visitor.dart' show StyleSheet, treeToDebugString, Visitor
, Expressions, VarDefinition; |
13 import 'package:html5lib/dom.dart'; | 13 import 'package:html5lib/dom.dart'; |
14 import 'package:html5lib/dom_parsing.dart'; | 14 import 'package:html5lib/dom_parsing.dart'; |
15 import 'package:source_maps/span.dart' hide SourceFile; | 15 import 'package:source_maps/span.dart' hide SourceFile; |
16 | 16 |
17 import 'dart_parser.dart'; | 17 import 'dart_parser.dart'; |
18 import 'files.dart'; | 18 import 'files.dart'; |
19 import 'html_css_fixup.dart'; | 19 import 'html_css_fixup.dart'; |
20 import 'html5_utils.dart'; | 20 import 'html5_utils.dart'; |
21 import 'info.dart'; | 21 import 'info.dart'; |
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 void normalize() { | 1093 void normalize() { |
1094 // Remove all var definitions for all style sheets analyzed. | 1094 // Remove all var definitions for all style sheets analyzed. |
1095 for (var tree in allStyleSheets) new RemoveVarDefinitions().visitTree(tree); | 1095 for (var tree in allStyleSheets) new RemoveVarDefinitions().visitTree(tree); |
1096 } | 1096 } |
1097 | 1097 |
1098 List<StyleSheet> processVars(var libraryInfo) { | 1098 List<StyleSheet> processVars(var libraryInfo) { |
1099 // Get list of all stylesheet(s) dependencies referenced from this file. | 1099 // Get list of all stylesheet(s) dependencies referenced from this file. |
1100 var styleSheets = _dependencies(libraryInfo).toList(); | 1100 var styleSheets = _dependencies(libraryInfo).toList(); |
1101 | 1101 |
1102 var errors = []; | 1102 var errors = []; |
1103 Css.analyze(styleSheets, errors: errors, options: | 1103 css.analyze(styleSheets, errors: errors, options: |
1104 [_warningsAsErrors ? '--warnings_as_errors' : '', 'memory']); | 1104 [_warningsAsErrors ? '--warnings_as_errors' : '', 'memory']); |
1105 | 1105 |
1106 // Print errors as warnings. | 1106 // Print errors as warnings. |
1107 for (var e in errors) { | 1107 for (var e in errors) { |
1108 _messages.warning(e.message, e.span); | 1108 _messages.warning(e.message, e.span); |
1109 } | 1109 } |
1110 | 1110 |
1111 // Build list of all var definitions. | 1111 // Build list of all var definitions. |
1112 Map varDefs = new Map(); | 1112 Map varDefs = new Map(); |
1113 for (var tree in styleSheets) { | 1113 for (var tree in styleSheets) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 } | 1173 } |
1174 } | 1174 } |
1175 } | 1175 } |
1176 } | 1176 } |
1177 } | 1177 } |
1178 } | 1178 } |
1179 | 1179 |
1180 return seen; | 1180 return seen; |
1181 } | 1181 } |
1182 } | 1182 } |
OLD | NEW |