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

Unified Diff: pkg/polymer/lib/src/compiler.dart

Issue 23735003: Get rid of doctype warning in analyzer (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/polymer/example/scoped_style/my_test.html ('k') | samples/third_party/todomvc/web/app.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/lib/src/compiler.dart
diff --git a/pkg/polymer/lib/src/compiler.dart b/pkg/polymer/lib/src/compiler.dart
index ec7ffebbf45ad4dde8743fab6126eb27e7bf8bb9..9d5d10de5ed1168d0dd1eeec801ba2b26e4fcfde 100644
--- a/pkg/polymer/lib/src/compiler.dart
+++ b/pkg/polymer/lib/src/compiler.dart
@@ -30,7 +30,8 @@ import 'utils.dart';
*
* Adds emitted error/warning to [messages], if [messages] is supplied.
*/
-Document parseHtml(contents, String sourcePath, Messages messages) {
+Document parseHtml(contents, String sourcePath, Messages messages,
+ bool checkDocType) {
var parser = new HtmlParser(contents, generateSpans: true,
sourceUrl: sourcePath);
var document = parser.parse();
@@ -38,7 +39,9 @@ Document parseHtml(contents, String sourcePath, Messages messages) {
// Note: errors aren't fatal in HTML (unless strict mode is on).
// So just print them as warnings.
for (var e in parser.errors) {
- messages.warning(e.message, e.span);
+ if (checkDocType || e.errorCode != 'expected-doctype-but-got-start-tag') {
+ messages.warning(e.message, e.span);
+ }
}
return document;
}
@@ -117,7 +120,7 @@ class Compiler {
_tasks = new FutureGroup();
_processed = new Set();
_processed.add(inputFile);
- _tasks.add(_parseHtmlFile(new UrlInfo(inputFile, inputFile, null)));
+ _tasks.add(_parseHtmlFile(new UrlInfo(inputFile, inputFile, null), true));
return _tasks.future;
}
@@ -182,7 +185,7 @@ class Compiler {
}
/** Parse an HTML file. */
- Future _parseHtmlFile(UrlInfo inputUrl) {
+ Future _parseHtmlFile(UrlInfo inputUrl, [bool checkDocType = false]) {
var filePath = inputUrl.resolvedPath;
return fileSystem.readTextOrBytes(filePath)
.catchError((e) => _readError(e, inputUrl))
@@ -190,7 +193,7 @@ class Compiler {
if (source == null) return;
var file = new SourceFile(filePath);
file.document = _time('Parsed', filePath,
- () => parseHtml(source, filePath, _messages));
+ () => parseHtml(source, filePath, _messages, checkDocType));
_processHtmlFile(inputUrl, file);
});
}
« no previous file with comments | « pkg/polymer/example/scoped_style/my_test.html ('k') | samples/third_party/todomvc/web/app.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698