Chromium Code Reviews| Index: tools/testing/dart/test_suite.dart |
| =================================================================== |
| --- tools/testing/dart/test_suite.dart (revision 14431) |
| +++ tools/testing/dart/test_suite.dart (working copy) |
| @@ -977,12 +977,13 @@ |
| RegExp leadingHashRegExp = const RegExp(r"^#", multiLine: true); |
| RegExp isolateStubsRegExp = const RegExp(r"// IsolateStubs=(.*)"); |
| RegExp domImportRegExp = |
| - const RegExp(r"^#import.*(dart:(dom|html)|html\.dart).*\)", |
| - multiLine: true); |
| + const RegExp(r"^[#]?import.*dart:html", multiLine: true); |
| RegExp libraryDefinitionRegExp = |
| - const RegExp(r"^#library\(", multiLine: true); |
| + const RegExp(r"^[#]?library[\( ]", multiLine: true); |
| RegExp sourceOrImportRegExp = |
| - const RegExp(r"^#(source|import|resource)\(", multiLine: true); |
| + const RegExp(r"^[#]?(source|part|import|resource)", multiLine: true); |
|
Siggi Cherem (dart-lang)
2012/11/01 21:02:04
I think resource is gone. Also this matches more t
ahe
2012/11/01 21:08:42
I don't think it matters. There are good chances w
gram
2012/11/01 21:20:48
Yes, these false positives are very unlikely to ha
|
| + RegExp partofRegExp = |
| + const RegExp(r"^[ \t]*part[ \t]*of[ \t]", multiLine: true); |
| // Read the entire file into a byte buffer and transform it to a |
| // String. This will treat the file as ascii but the only parts |
| @@ -1040,7 +1041,8 @@ |
| String isolateStubs = isolateMatch != null ? isolateMatch[1] : ''; |
| bool containsDomImport = domImportRegExp.hasMatch(contents); |
| bool isLibraryDefinition = libraryDefinitionRegExp.hasMatch(contents); |
| - bool containsSourceOrImport = sourceOrImportRegExp.hasMatch(contents); |
| + bool containsSourceOrImport = sourceOrImportRegExp.hasMatch(contents) && |
| + !partofRegExp.hasMatch(contents); |
|
Siggi Cherem (dart-lang)
2012/11/01 21:02:04
alternative you could include a ['"] in the match
|
| int numStaticTypeAnnotations = 0; |
| for (var i in staticTypeRegExp.allMatches(contents)) { |
| numStaticTypeAnnotations++; |