Make RegExp's constructor non-const.

BUG=

Review URL: https://codereview.chromium.org//11410033

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14829 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
ajohnsen@google.com 2012-11-13 06:48:43 +00:00
parent 4ca0c72fd5
commit 8dc3edd7ce
110 changed files with 270 additions and 269 deletions

View file

@ -200,9 +200,9 @@ import 'src/utils.dart';
* options and flags from them.
*/
class ArgParser {
static const _SOLO_OPT = const RegExp(r'^-([a-zA-Z0-9])$');
static const _ABBR_OPT = const RegExp(r'^-([a-zA-Z0-9]+)(.*)$');
static const _LONG_OPT = const RegExp(r'^--([a-zA-Z\-_0-9]+)(=(.*))?$');
static final _SOLO_OPT = new RegExp(r'^-([a-zA-Z0-9])$');
static final _ABBR_OPT = new RegExp(r'^-([a-zA-Z0-9]+)(.*)$');
static final _LONG_OPT = new RegExp(r'^--([a-zA-Z\-_0-9]+)(=(.*))?$');
final Map<String, _Option> _options;

View file

@ -681,7 +681,7 @@ String unindentString(String text) {
var lines = text.split('\n');
// Count the indentation of the last line.
var whitespace = const RegExp('^ *');
var whitespace = new RegExp('^ *');
var indent = whitespace.firstMatch(lines[lines.length - 1])[0].length;
// Drop the last line. It only exists for specifying indentation.

View file

@ -114,7 +114,7 @@ List<int> encodeString(String string, Encoding encoding) {
/// A regular expression that matches strings that are composed entirely of
/// ASCII-compatible characters.
final RegExp _ASCII_ONLY = const RegExp(r"^[\x00-\x7F]+$");
final RegExp _ASCII_ONLY = new RegExp(r"^[\x00-\x7F]+$");
/// Returns whether [string] is composed entirely of ASCII-compatible
/// characters.

View file

@ -100,7 +100,7 @@ class Bidi {
// The regular expression is simplified for an HTML tag (opening or
// closing) or an HTML escape. We might want to skip over such expressions
// when estimating the text directionality.
return text.replaceAll(const RegExp(r'<[^>]*>|&[^;]+;'), ' ');
return text.replaceAll(new RegExp(r'<[^>]*>|&[^;]+;'), ' ');
}
/**
@ -108,7 +108,7 @@ class Bidi {
* LTR. If [isHtml] is true, the text is HTML or HTML-escaped.
*/
static bool startsWithLtr(String text, [isHtml=false]) {
return const RegExp('^[^$_RTL_CHARS]*[$_LTR_CHARS]').hasMatch(
return new RegExp('^[^$_RTL_CHARS]*[$_LTR_CHARS]').hasMatch(
isHtml? stripHtmlIfNeeded(text) : text);
}
@ -117,7 +117,7 @@ class Bidi {
* RTL. If [isHtml] is true, the text is HTML or HTML-escaped.
*/
static bool startsWithRtl(String text, [isHtml=false]) {
return const RegExp('^[^$_LTR_CHARS]*[$_RTL_CHARS]').hasMatch(
return new RegExp('^[^$_LTR_CHARS]*[$_RTL_CHARS]').hasMatch(
isHtml? stripHtmlIfNeeded(text) : text);
}
@ -127,7 +127,7 @@ class Bidi {
* HTML-escaped.
*/
static bool endsWithLtr(String text, [isHtml=false]) {
return const RegExp('[$_LTR_CHARS][^$_RTL_CHARS]*\$').hasMatch(
return new RegExp('[$_LTR_CHARS][^$_RTL_CHARS]*\$').hasMatch(
isHtml? stripHtmlIfNeeded(text) : text);
}
@ -137,7 +137,7 @@ class Bidi {
* HTML-escaped.
*/
static bool endsWithRtl(String text, [isHtml=false]) {
return const RegExp('[$_RTL_CHARS][^$_LTR_CHARS]*\$').hasMatch(
return new RegExp('[$_RTL_CHARS][^$_LTR_CHARS]*\$').hasMatch(
isHtml? stripHtmlIfNeeded(text) : text);
}
@ -146,7 +146,7 @@ class Bidi {
* If [isHtml] is true, the text is HTML or HTML-escaped.
*/
static bool hasAnyLtr(String text, [isHtml=false]) {
return const RegExp(r'[' '$_LTR_CHARS' r']').hasMatch(
return new RegExp(r'[' '$_LTR_CHARS' r']').hasMatch(
isHtml? stripHtmlIfNeeded(text) : text);
}
@ -155,7 +155,7 @@ class Bidi {
* If [isHtml] is true, the text is HTML or HTML-escaped.
*/
static bool hasAnyRtl(String text, [isHtml=false]) {
return const RegExp(r'[' '$_RTL_CHARS' r']').hasMatch(
return new RegExp(r'[' '$_RTL_CHARS' r']').hasMatch(
isHtml? stripHtmlIfNeeded(text) : text);
}
@ -184,7 +184,7 @@ class Bidi {
* (Egypt), is ignored.
*/
static bool isRtlLanguage(String languageString) {
return const RegExp(r'^(ar|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_]'
return new RegExp(r'^(ar|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_]'
r'(Arab|Hebr|Thaa|Nkoo|Tfng))(?!.*[-_](Latn|Cyrl)($|-|_))'
r'($|-|_)', ignoreCase : true).hasMatch(languageString);
}
@ -242,7 +242,7 @@ class Bidi {
if (html.startsWith('<')) {
StringBuffer buffer = new StringBuffer();
var startIndex = 0;
Match match = const RegExp('<\\w+').firstMatch(html);
Match match = new RegExp('<\\w+').firstMatch(html);
if (match != null) {
buffer.add(html.substring(
startIndex, match.end)).add(' dir=$direction');
@ -263,7 +263,7 @@ class Bidi {
static String guardBracketInHtml(String str, [bool isRtlContext]) {
var useRtl = isRtlContext == null ? hasAnyRtl(str) : isRtlContext;
RegExp matchingBrackets =
const RegExp(r'(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(&lt;.*?(&gt;)+)');
new RegExp(r'(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(&lt;.*?(&gt;)+)');
return _guardBracketHelper(str, matchingBrackets,
'<span dir=${useRtl? "rtl" : "ltr"}>', '</span>');
}
@ -280,14 +280,14 @@ class Bidi {
var useRtl = isRtlContext == null ? hasAnyRtl(str) : isRtlContext;
var mark = useRtl ? RLM : LRM;
return _guardBracketHelper(str,
const RegExp(r'(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(<.*?>+)'), mark, mark);
new RegExp(r'(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(<.*?>+)'), mark, mark);
}
/**
* (Mostly) reimplements the $& functionality of "replace" in JavaScript.
* Given a [str] and the [regexp] to match with, optionally supply a string to
* be inserted [before] the match and/or [after]. For example,
* `_guardBracketHelper('firetruck', const RegExp('truck'), 'hydrant', '!')`
* `_guardBracketHelper('firetruck', new RegExp('truck'), 'hydrant', '!')`
* would return 'firehydrant!'.
*/
// TODO(efortuna): Get rid of this once this is implemented in Dart.
@ -325,17 +325,17 @@ class Bidi {
var hasWeaklyLtr = false;
// Split a string into 'words' for directionality estimation based on
// relative word counts.
for (String token in text.split(const RegExp(r'\s+'))) {
for (String token in text.split(new RegExp(r'\s+'))) {
if (startsWithRtl(token)) {
rtlCount++;
total++;
} else if (const RegExp(r'^http://').hasMatch(token)) {
} else if (new RegExp(r'^http://').hasMatch(token)) {
// Checked if token looks like something that must always be LTR even in
// RTL text, such as a URL.
hasWeaklyLtr = true;
} else if (hasAnyLtr(token)) {
total++;
} else if (const RegExp(r'\d').hasMatch(token)) {
} else if (new RegExp(r'\d').hasMatch(token)) {
// Checked if token contains any numerals.
hasWeaklyLtr = true;
}
@ -379,10 +379,10 @@ class Bidi {
// [\u0591-\u05f2]'.
for (int i = 1; i < str.length; i++) {
if (str.substring(i, i+1) == '"'
&& const RegExp('[\u0591-\u05f2]').hasMatch(str.substring(i-1, i))) {
&& new RegExp('[\u0591-\u05f2]').hasMatch(str.substring(i-1, i))) {
buf.add('\u05f4');
} else if (str.substring(i, i+1) == "'"
&& const RegExp('[\u0591-\u05f2]').hasMatch(str.substring(i-1, i))) {
&& new RegExp('[\u0591-\u05f2]').hasMatch(str.substring(i-1, i))) {
buf.add('\u05f3');
} else {
buf.add(str.substring(i, i+1));

View file

@ -445,19 +445,19 @@ class DateFormat {
* A series of regular expressions used to parse a format string into its
* component fields.
*/
static var _matchers = const [
static List<Pattern> _matchers = [
// Quoted String - anything between single quotes, with escaping
// of single quotes by doubling them.
// e.g. in the pattern "hh 'o''clock'" will match 'o''clock'
const RegExp("^\'(?:[^\']|\'\')*\'"),
new RegExp("^\'(?:[^\']|\'\')*\'"),
// Fields - any sequence of 1 or more of the same field characters.
// e.g. in "hh:mm:ss" will match hh, mm, and ss. But in "hms" would
// match each letter individually.
const RegExp(
new RegExp(
"^(?:G+|y+|M+|k+|S+|E+|a+|h+|K+|H+|c+|L+|Q+|d+|m+|s+|v+|z+|Z+)"),
// Everything else - A sequence that is not quotes or field characters.
// e.g. in "hh:mm:ss" will match the colons.
const RegExp("^[^\'GyMkSEahKHcLQdmsvzZ]+")
new RegExp("^[^\'GyMkSEahKHcLQdmsvzZ]+")
];
/**

View file

@ -51,7 +51,7 @@ Future<String> findSystemLocale() {
* Regular expression to match the expected output of systeminfo on
* Windows. e.g. System Locale:<tab>en_US;English (United States)
*/
RegExp _sysInfoRegex = const RegExp(r"System Locale:\s+(\w\w-\w+);");
RegExp _sysInfoRegex = new RegExp(r"System Locale:\s+(\w\w-\w+);");
/**
* Regular expression to match the expected output of reading the defaults
@ -61,7 +61,7 @@ RegExp _sysInfoRegex = const RegExp(r"System Locale:\s+(\w\w-\w+);");
* "pt-PT",
* ...
*/
RegExp _appleDefaultsRegex = const RegExp(r'(\w\w_\w+)');
RegExp _appleDefaultsRegex = new RegExp(r'(\w\w_\w+)');
/**
* Check to see if we have a "LANG" environment variable we can use and return

View file

@ -133,7 +133,7 @@ class _Stream {
* Assuming that the contents are characters, read as many digits as we
* can see and then return the corresponding integer. Advance the stream.
*/
var digitMatcher = const RegExp(r'\d+');
var digitMatcher = new RegExp(r'\d+');
int nextInteger() {
var string = digitMatcher.stringMatch(rest());
if (string == null || string.isEmpty) return null;

View file

@ -40,7 +40,7 @@ class _Message {
_Message.fromString(String msg) {
// The format of a message is '<type> <elapsedTime> <body>'.
// If we don't get a type we default to a 'log' type.
var messageParser = const RegExp('\([a-z]*\) \([0-9]*\) \(.*\)');
var messageParser = new RegExp('\([a-z]*\) \([0-9]*\) \(.*\)');
Match match = messageParser.firstMatch(msg);
if (match == null) {
messageType = 'log';

View file

@ -258,7 +258,7 @@ class ParentInteractiveHtmlConfiguration extends HtmlConfiguration {
window.on.message.add(_messageHandler);
}
static const _notAlphaNumeric = const RegExp('[^a-z0-9A-Z]');
static final _notAlphaNumeric = new RegExp('[^a-z0-9A-Z]');
String _stringToDomId(String s) {
if (s.length == 0) {

View file

@ -133,7 +133,7 @@ class Configuration {
String _indent(String str) {
// TODO(nweiz): Use this simpler code once issue 2980 is fixed.
// return str.replaceAll(const RegExp("^", multiLine: true), " ");
// return str.replaceAll(new RegExp("^", multiLine: true), " ");
return Strings.join(str.split("\n").map((line) => " $line"), "\n");
}

View file

@ -201,7 +201,7 @@ class WebDriverBase {
*/
WebDriverBase.fromUrl([this._url = 'http://localhost:4444/wd/hub']) {
// Break out the URL components.
var re = const RegExp('[^:/]+://([^/]+)(/.*)');
var re = new RegExp('[^:/]+://([^/]+)(/.*)');
var matches = re.firstMatch(_url);
_host = matches[1];
_path = matches[2];

View file

@ -54,7 +54,7 @@ class _JSRegExpMatch implements Match {
patch class JSSyntaxRegExp {
/* patch */ const factory JSSyntaxRegExp(
/* patch */ factory JSSyntaxRegExp(
String pattern,
{bool multiLine: false,
bool ignoreCase: false}) native "JSSyntaxRegExp_factory";

View file

@ -35,7 +35,7 @@ class OptionHandler {
String extractParameter(String argument) {
// m[0] is the entire match (which will be equal to argument). m[1]
// is something like "-o" or "--out=", and m[2] is the parameter.
Match m = const RegExp('^(-[a-z]|--.+=)(.*)').firstMatch(argument);
Match m = new RegExp('^(-[a-z]|--.+=)(.*)').firstMatch(argument);
if (m == null) helpAndFail('Error: Unknown option "$argument".');
return m[2];
}

View file

@ -15,6 +15,7 @@ class Printer implements NodeVisitor {
final Namer namer;
bool pendingSemicolon = false;
bool pendingSpace = false;
static final identifierRegexp = new RegExp(r'^[a-zA-Z_0-9$]');
Printer(leg.Compiler compiler, { allowVariableMinification: true })
: shouldCompressOutput = compiler.enableMinification,
@ -46,7 +47,6 @@ class Printer implements NodeVisitor {
void out(String str) {
if (str != "") {
const identifierRegexp = const RegExp(r'^[a-zA-Z_0-9$]');
if (pendingSemicolon && (!shouldCompressOutput || str != "}")) {
outBuffer.add(";");
}
@ -1067,7 +1067,7 @@ class MinifyRenamer implements Namer {
codes.add(charCodes.$0 + digit);
newName = new String.fromCharCodes(codes);
}
assert(const RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName));
assert(new RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName));
maps.last[oldName] = newName;
return newName;
}

View file

@ -12,9 +12,9 @@ patch class JSSyntaxRegExp {
final bool _multiLine;
final bool _ignoreCase;
patch const JSSyntaxRegExp(String pattern,
{bool multiLine: false,
bool ignoreCase: false})
patch JSSyntaxRegExp(String pattern,
{bool multiLine: false,
bool ignoreCase: false})
: _pattern = pattern,
_multiLine = multiLine,
_ignoreCase = ignoreCase;

View file

@ -75,6 +75,8 @@ stringReplaceJS(receiver, replacer, to) {
return JS('String', r'#.replace(#, #)', receiver, replacer, to);
}
final RegExp quoteRegExp = new JSSyntaxRegExp(r'[-[\]{}()*+?.,\\^$|#\s]');
stringReplaceAllUnchecked(receiver, from, to) {
if (from is String) {
if (from == "") {
@ -91,8 +93,6 @@ stringReplaceAllUnchecked(receiver, from, to) {
return result.toString();
}
} else {
RegExp quoteRegExp =
const JSSyntaxRegExp(r'[-[\]{}()*+?.,\\^$|#\s]');
var quoter = regExpMakeNative(quoteRegExp, global: true);
var quoted = JS('String', r'#.replace(#, "\\$&")', from, quoter);
RegExp replaceRegExp = new JSSyntaxRegExp(quoted);

View file

@ -176,6 +176,8 @@ bool isOverriddenMethod(FunctionElement element,
return false;
}
final RegExp nativeRedirectionRegExp = new RegExp(r'^[a-zA-Z][a-zA-Z_$0-9]*$');
void handleSsaNative(SsaBuilder builder, Expression nativeBody) {
Compiler compiler = builder.compiler;
FunctionElement element = builder.work.element;
@ -212,7 +214,6 @@ void handleSsaNative(SsaBuilder builder, Expression nativeBody) {
// 1) foo() native; hasBody = false, isRedirecting = false
// 2) foo() native "bar"; hasBody = false, isRedirecting = true
// 3) foo() native "return 42"; hasBody = true, isRedirecting = false
RegExp nativeRedirectionRegExp = const RegExp(r'^[a-zA-Z][a-zA-Z_$0-9]*$');
bool hasBody = false;
bool isRedirecting = false;
String nativeMethodName = element.name.slowToString();

View file

@ -445,6 +445,7 @@ class VariableNamer {
final Map<Element, String> parameterNames;
final List<String> freeTemporaryNames;
int temporaryIndex = 0;
static final RegExp regexp = new RegExp('t[0-9]+');
VariableNamer(LiveEnvironment environment, this.names, this.parameterNames)
: usedNames = new Set<String>(),
@ -550,7 +551,6 @@ class VariableNamer {
void freeName(HInstruction instruction) {
String ownName = names.ownName[instruction];
if (ownName != null) {
RegExp regexp = const RegExp('t[0-9]+');
// We check if we have already looked for temporary names
// because if we haven't, chances are the temporary we allocate
// in this block can match a phi with the same name in the

View file

@ -1527,7 +1527,7 @@ class Dartdoc {
// TODO(rnystrom): Why don't we have a nice type in the platform for this?
// TODO(rnystrom): This is a bit hackish. We consider any URL that lacks
// a scheme to be relative.
return const RegExp(r'^\w+:').hasMatch(url);
return new RegExp(r'^\w+:').hasMatch(url);
}
/** Gets the URL to the documentation for [library]. */

View file

@ -5,39 +5,39 @@
part of markdown;
/// The line contains only whitespace or is empty.
const _RE_EMPTY = const RegExp(r'^([ \t]*)$');
const _RE_EMPTY = new RegExp(r'^([ \t]*)$');
/// A series of `=` or `-` (on the next line) define setext-style headers.
const _RE_SETEXT = const RegExp(r'^((=+)|(-+))$');
const _RE_SETEXT = new RegExp(r'^((=+)|(-+))$');
/// Leading (and trailing) `#` define atx-style headers.
const _RE_HEADER = const RegExp(r'^(#{1,6})(.*?)#*$');
const _RE_HEADER = new RegExp(r'^(#{1,6})(.*?)#*$');
/// The line starts with `>` with one optional space after.
const _RE_BLOCKQUOTE = const RegExp(r'^[ ]{0,3}>[ ]?(.*)$');
const _RE_BLOCKQUOTE = new RegExp(r'^[ ]{0,3}>[ ]?(.*)$');
/// A line indented four spaces. Used for code blocks and lists.
const _RE_INDENT = const RegExp(r'^(?: |\t)(.*)$');
const _RE_INDENT = new RegExp(r'^(?: |\t)(.*)$');
/// Three or more hyphens, asterisks or underscores by themselves. Note that
/// a line like `----` is valid as both HR and SETEXT. In case of a tie,
/// SETEXT should win.
const _RE_HR = const RegExp(r'^[ ]{0,3}((-+[ ]{0,2}){3,}|'
const _RE_HR = new RegExp(r'^[ ]{0,3}((-+[ ]{0,2}){3,}|'
r'(_+[ ]{0,2}){3,}|'
r'(\*+[ ]{0,2}){3,})$');
/// Really hacky way to detect block-level embedded HTML. Just looks for
/// "<somename".
const _RE_HTML = const RegExp(r'^<[ ]*\w+[ >]');
const _RE_HTML = new RegExp(r'^<[ ]*\w+[ >]');
/// A line starting with one of these markers: `-`, `*`, `+`. May have up to
/// three leading spaces before the marker and any number of spaces or tabs
/// after.
const _RE_UL = const RegExp(r'^[ ]{0,3}[*+-][ \t]+(.*)$');
const _RE_UL = new RegExp(r'^[ ]{0,3}[*+-][ \t]+(.*)$');
/// A line starting with a number like `123.`. May have up to three leading
/// spaces before the marker and any number of spaces or tabs after.
const _RE_OL = const RegExp(r'^[ ]{0,3}\d+\.[ \t]+(.*)$');
const _RE_OL = new RegExp(r'^[ ]{0,3}\d+\.[ \t]+(.*)$');
/// Maintains the internal state needed to parse a series of lines into blocks
/// of markdown suitable for further inline parsing.

View file

@ -8,7 +8,7 @@ String renderToHtml(List<Node> nodes) => new HtmlRenderer().render(nodes);
/// Translates a parsed AST to HTML.
class HtmlRenderer implements NodeVisitor {
static const _BLOCK_TAGS = const RegExp(
static const _BLOCK_TAGS = new RegExp(
'blockquote|h1|h2|h3|h4|h5|h6|hr|p|pre');
StringBuffer buffer;

View file

@ -257,7 +257,7 @@ class _DateImpl implements Date {
// - "20120227"
// - "2012-02-27T14Z"
// - "-123450101 00:00:00 Z" // In the year -12345.
final RegExp re = const RegExp(
final RegExp re = new RegExp(
r'^([+-]?\d?\d\d\d\d)-?(\d\d)-?(\d\d)' // The day part.
r'(?:[ T](\d\d)(?::?(\d\d)(?::?(\d\d)(.\d{1,6})?)?)? ?([zZ])?)?$');
Match match = re.firstMatch(formattedString);

View file

@ -10,7 +10,7 @@
* The following example finds all matches of a [RegExp] in a [String]
* and iterates through the returned iterable of [Match] objects.
*
* RegExp exp = const RegExp(r"(\w+)");
* RegExp exp = new RegExp(r"(\w+)");
* String str = "Parse my string";
* Iterable<Match> matches = exp.allMatches(str);
* for (Match m in matches) {
@ -84,7 +84,7 @@ abstract class Match {
* The following example finds all matches of a regular expression in
* a string.
*
* RegExp exp = const RegExp(r"(\w+)");
* RegExp exp = new RegExp(r"(\w+)");
* String str = "Parse my string";
* Iterable<Match> matches = exp.allMatches(str);
*/
@ -93,8 +93,8 @@ interface RegExp extends Pattern default JSSyntaxRegExp {
* Constructs a regular expression. The default implementation of a
* [RegExp] sets [multiLine] and [ignoreCase] to false.
*/
const RegExp(String pattern, {bool multiLine: false,
bool ignoreCase: false});
RegExp(String pattern, {bool multiLine: false,
bool ignoreCase: false});
/**
* Searches for the first match of the regular expression

View file

@ -3,9 +3,9 @@
// BSD-style license that can be found in the LICENSE file.
class JSSyntaxRegExp implements RegExp {
external const JSSyntaxRegExp(String pattern,
{bool multiLine: false,
bool ignoreCase: false});
external JSSyntaxRegExp(String pattern,
{bool multiLine: false,
bool ignoreCase: false});
external Match firstMatch(String str);
external Iterable<Match> allMatches(String str);
external bool hasMatch(String str);

View file

@ -6241,14 +6241,14 @@ class Document extends Node
Element query(String selectors) {
// It is fine for our RegExp to detect element id query selectors to have
// false negatives but not false positives.
if (const RegExp("^#[_a-zA-Z]\\w*\$").hasMatch(selectors)) {
if (new RegExp("^#[_a-zA-Z]\\w*\$").hasMatch(selectors)) {
return $dom_getElementById(selectors.substring(1));
}
return $dom_querySelector(selectors);
}
List<Element> queryAll(String selectors) {
if (const RegExp("""^\\[name=["'][^'"]+['"]\\]\$""").hasMatch(selectors)) {
if (new RegExp("""^\\[name=["'][^'"]+['"]\\]\$""").hasMatch(selectors)) {
final mutableMatches = $dom_getElementsByName(
selectors.substring(7,selectors.length - 2));
int len = mutableMatches.length;
@ -6257,7 +6257,7 @@ class Document extends Node
copyOfMatches[i] = mutableMatches[i];
}
return new _FrozenElementList._wrap(copyOfMatches);
} else if (const RegExp("^[*a-zA-Z0-9]+\$").hasMatch(selectors)) {
} else if (new RegExp("^[*a-zA-Z0-9]+\$").hasMatch(selectors)) {
final mutableMatches = $dom_getElementsByTagName(selectors);
int len = mutableMatches.length;
final copyOfMatches = new List<Element>(len);
@ -7569,7 +7569,7 @@ class Element extends Node implements ElementTraversal native "*Element" {
// Temporary dispatch hook to support WebComponents.
Function dynamicUnknownElementDispatcher;
final _START_TAG_REGEXP = const RegExp('<(\\w+)');
final _START_TAG_REGEXP = new RegExp('<(\\w+)');
class _ElementFactoryProvider {
static final _CUSTOM_PARENT_TAG_MAP = const {
'body' : 'html',

View file

@ -8250,14 +8250,14 @@ class Document extends Node
Element query(String selectors) {
// It is fine for our RegExp to detect element id query selectors to have
// false negatives but not false positives.
if (const RegExp("^#[_a-zA-Z]\\w*\$").hasMatch(selectors)) {
if (new RegExp("^#[_a-zA-Z]\\w*\$").hasMatch(selectors)) {
return $dom_getElementById(selectors.substring(1));
}
return $dom_querySelector(selectors);
}
List<Element> queryAll(String selectors) {
if (const RegExp("""^\\[name=["'][^'"]+['"]\\]\$""").hasMatch(selectors)) {
if (new RegExp("""^\\[name=["'][^'"]+['"]\\]\$""").hasMatch(selectors)) {
final mutableMatches = $dom_getElementsByName(
selectors.substring(7,selectors.length - 2));
int len = mutableMatches.length;
@ -8266,7 +8266,7 @@ class Document extends Node
copyOfMatches[i] = mutableMatches[i];
}
return new _FrozenElementList._wrap(copyOfMatches);
} else if (const RegExp("^[*a-zA-Z0-9]+\$").hasMatch(selectors)) {
} else if (new RegExp("^[*a-zA-Z0-9]+\$").hasMatch(selectors)) {
final mutableMatches = $dom_getElementsByTagName(selectors);
int len = mutableMatches.length;
final copyOfMatches = new List<Element>(len);
@ -9637,7 +9637,7 @@ class Element extends Node implements ElementTraversal {
// Temporary dispatch hook to support WebComponents.
Function dynamicUnknownElementDispatcher;
final _START_TAG_REGEXP = const RegExp('<(\\w+)');
final _START_TAG_REGEXP = new RegExp('<(\\w+)');
class _ElementFactoryProvider {
static final _CUSTOM_PARENT_TAG_MAP = const {
'body' : 'html',

View file

@ -56,7 +56,7 @@ class Uri {
}
// NOTE: This code was ported from: closure-library/closure/goog/uri/utils.js
static const RegExp _splitRe = const RegExp(
static final RegExp _splitRe = new RegExp(
'^'
'(?:'
'([^:/?#.]+)' // scheme - ignore special characters

View file

@ -8,7 +8,7 @@
#import('../../tools/testing/dart/test_suite.dart');
class Co19TestSuite extends StandardTestSuite {
RegExp _testRegExp = const RegExp(r"t[0-9]{2}.dart$");
RegExp _testRegExp = new RegExp(r"t[0-9]{2}.dart$");
Co19TestSuite(Map configuration)
: super(configuration,

View file

@ -47,7 +47,7 @@ foo(param0, param1) {
""";
main() {
RegExp regexp = const RegExp('=== true');
RegExp regexp = new RegExp('=== true');
String generated = compile(TEST_EQUAL, entry: 'foo');
Expect.isFalse(generated.contains('=== true'));

View file

@ -85,7 +85,7 @@ main() {
main() {
// At some point Dart2js generated bad object literals with dangling commas:
// { a: true, }. Make sure this doesn't happen again.
RegExp danglingComma = const RegExp(r',[ \n]*}');
RegExp danglingComma = new RegExp(r',[ \n]*}');
String generated = compileAll(TEST_ONE);
Expect.isFalse(danglingComma.hasMatch(generated));

View file

@ -32,7 +32,7 @@ void main() {
main() {
// Make sure that class A, B and C are emitted in that order. For simplicity
// we just verify that their members are in the correct order.
RegExp regexp = const RegExp(r"foo\$0?:(.|\n)*bar\$0:(.|\n)*gee\$0:");
RegExp regexp = new RegExp(r"foo\$0?:(.|\n)*bar\$0:(.|\n)*gee\$0:");
String generated = compileAll(TEST_ONE);
print(generated);

View file

@ -52,7 +52,7 @@ closureInvocation() {
// the closure.
closureBailout() {
String generated = compileAll(TEST_BAILOUT);
RegExp regexp = const RegExp(r'call\$0: function');
RegExp regexp = new RegExp(r'call\$0: function');
Iterator<Match> matches = regexp.allMatches(generated).iterator();
checkNumberOfMatches(matches, 1);
}

View file

@ -19,7 +19,7 @@ foo(int a, int b, bool param2) {
main() {
String generated = compile(TEST_ONE, entry: 'foo');
RegExp regexp = const RegExp('a \\+ b');
RegExp regexp = new RegExp('a \\+ b');
Iterator matches = regexp.allMatches(generated).iterator();
Expect.isTrue(matches.hasNext);
matches.next();

View file

@ -32,20 +32,20 @@ foo(a, b, c, d) {
main() {
compileAndMatch(
NUMBER_FOLDING, 'main', const RegExp(r"print\(7\)"));
NUMBER_FOLDING, 'main', new RegExp(r"print\(7\)"));
compileAndMatch(
NEGATIVE_NUMBER_FOLDING, 'main', const RegExp(r"print\(1\)"));
NEGATIVE_NUMBER_FOLDING, 'main', new RegExp(r"print\(1\)"));
String generated = compile(NULL_EQUALS_FOLDING, entry: 'foo');
RegExp regexp = const RegExp(r'a == null');
RegExp regexp = new RegExp(r'a == null');
Expect.isTrue(regexp.hasMatch(generated));
regexp = const RegExp(r'null == b');
regexp = new RegExp(r'null == b');
Expect.isTrue(regexp.hasMatch(generated));
regexp = const RegExp(r'4 === c');
regexp = new RegExp(r'4 === c');
Expect.isTrue(regexp.hasMatch(generated));
regexp = const RegExp("'foo' === d");
regexp = new RegExp("'foo' === d");
Expect.isTrue(regexp.hasMatch(generated));
}

View file

@ -17,6 +17,6 @@ void foo(bar) {
main() {
String generated = compile(TEST_ONE, entry: 'foo');
RegExp regexp = const RegExp("toBeRemoved");
RegExp regexp = new RegExp("toBeRemoved");
Expect.isTrue(!regexp.hasMatch(generated));
}

View file

@ -26,7 +26,7 @@ main() {
var compiler = compilerFor(TEST, uri);
compiler.runCompiler(uri);
String generated = compiler.assembledCode;
RegExp regexp = const RegExp(r"get\$foo");
RegExp regexp = new RegExp(r"get\$foo");
Iterator matches = regexp.allMatches(generated).iterator();
checkNumberOfMatches(matches, 1);
var cls = findElement(compiler, 'A');

View file

@ -15,7 +15,7 @@ void foo(bar) {
main() {
String generated = compile(TEST_ONE, entry: 'foo');
RegExp regexp = const RegExp(r"1 \+ [a-z]+");
RegExp regexp = new RegExp(r"1 \+ [a-z]+");
Iterator matches = regexp.allMatches(generated).iterator();
Expect.isTrue(matches.hasNext);
matches.next();

View file

@ -17,11 +17,11 @@ main() {
String generated = compile(TEST_ONE, entry: 'foo');
// Check that no boolify code is generated.
RegExp regexp = const RegExp("=== true");
RegExp regexp = new RegExp("=== true");
Iterator matches = regexp.allMatches(generated).iterator();
Expect.isFalse(matches.hasNext);
regexp = const RegExp("===");
regexp = new RegExp("===");
matches = regexp.allMatches(generated).iterator();
Expect.isTrue(matches.hasNext);
matches.next();

View file

@ -17,24 +17,24 @@ main() {
}
buffer.add("2000; return i; }");
var generated = compile(buffer.toString(), 'foo', minify: true);
RegExp re = const RegExp(r"\(a,b,c");
RegExp re = new RegExp(r"\(a,b,c");
Expect.isTrue(re.hasMatch(generated));
re = const RegExp(r"x,y,z,A,B,C");
re = new RegExp(r"x,y,z,A,B,C");
Expect.isTrue(re.hasMatch(generated));
re = const RegExp(r"Y,Z,a0,a1,a2,a3,a4,a5,a6");
re = new RegExp(r"Y,Z,a0,a1,a2,a3,a4,a5,a6");
Expect.isTrue(re.hasMatch(generated));
re = const RegExp(r"g8,g9,h0,h1");
re = new RegExp(r"g8,g9,h0,h1");
Expect.isTrue(re.hasMatch(generated));
re = const RegExp(r"Z8,Z9,aa0,aa1,aa2");
re = new RegExp(r"Z8,Z9,aa0,aa1,aa2");
Expect.isTrue(re.hasMatch(generated));
re = const RegExp(r"aa9,ab0,ab1");
re = new RegExp(r"aa9,ab0,ab1");
Expect.isTrue(re.hasMatch(generated));
re = const RegExp(r"aZ9,ba0,ba1");
re = new RegExp(r"aZ9,ba0,ba1");
Expect.isTrue(re.hasMatch(generated));
}

View file

@ -70,41 +70,41 @@ int foo(var start, bool test) {
main() {
String generated = compile(FOO, entry: 'foo');
// TODO(ngeoffray): Use 'contains' when frog supports it.
RegExp regexp = const RegExp(r"function\(a, b\) {");
RegExp regexp = new RegExp(r"function\(a, b\) {");
Expect.isTrue(regexp.hasMatch(generated));
generated = compile(BAR, entry: 'bar');
regexp = const RegExp(r"function\(eval\$, \$\$eval\) {");
regexp = new RegExp(r"function\(eval\$, \$\$eval\) {");
Expect.isTrue(regexp.hasMatch(generated));
generated = compile(PARAMETER_AND_TEMP, entry: 'bar');
regexp = const RegExp(r"print\(t0\)");
regexp = new RegExp(r"print\(t0\)");
Expect.isTrue(regexp.hasMatch(generated));
// Check that the second 't0' got another name.
regexp = const RegExp(r"print\(t0_0\)");
regexp = new RegExp(r"print\(t0_0\)");
Expect.isTrue(regexp.hasMatch(generated));
generated = compile(NO_LOCAL, entry: 'foo');
regexp = const RegExp("return baz");
regexp = new RegExp("return baz");
Expect.isTrue(regexp.hasMatch(generated));
regexp = const RegExp(r"baz = 2");
regexp = new RegExp(r"baz = 2");
Expect.isTrue(regexp.hasMatch(generated));
regexp = const RegExp(r"baz = 3");
regexp = new RegExp(r"baz = 3");
Expect.isTrue(regexp.hasMatch(generated));
regexp = const RegExp("bar === true");
regexp = new RegExp("bar === true");
Expect.isTrue(regexp.hasMatch(generated));
generated = compile(MULTIPLE_PHIS_ONE_LOCAL, entry: 'foo');
regexp = const RegExp(r"var a = 2;");
regexp = new RegExp(r"var a = 2;");
Expect.isTrue(regexp.hasMatch(generated));
regexp = const RegExp(r"a = 2;");
regexp = new RegExp(r"a = 2;");
Iterator matches = regexp.allMatches(generated).iterator();
Expect.isTrue(matches.hasNext);
matches.next();
Expect.isFalse(matches.hasNext);
generated = compile(PARAMETER_INIT, entry: 'foo');
regexp = const RegExp("var result = start;");
regexp = new RegExp("var result = start;");
Expect.isTrue(regexp.hasMatch(generated));
}

View file

@ -28,12 +28,12 @@ void foo() {
main() {
String generated = compile(TEST_ONE, entry: 'foo');
RegExp regexp = const RegExp("toBeRemoved");
RegExp regexp = new RegExp("toBeRemoved");
Expect.isTrue(!regexp.hasMatch(generated));
generated = compile(TEST_TWO, entry: 'foo');
regexp = const RegExp("toBeRemoved");
regexp = new RegExp("toBeRemoved");
Expect.isTrue(!regexp.hasMatch(generated));
regexp = const RegExp("temp");
regexp = new RegExp("temp");
Expect.isTrue(!regexp.hasMatch(generated));
}

View file

@ -26,7 +26,7 @@ main() {
main() {
String generated = compileAll(TEST);
RegExp regexp = const RegExp('foo\\\$0\\\$bailout');
RegExp regexp = new RegExp('foo\\\$0\\\$bailout');
Iterator matches = regexp.allMatches(generated).iterator();
// We check that there is only one call to the bailout method.

View file

@ -47,7 +47,7 @@ main() {
Expect.isTrue(generated.contains(r'return a === true ? $.foo(2) : b;'));
generated = compile(TEST_TWO, entry: 'foo');
regexp = const RegExp("foo\\(1\\)");
regexp = new RegExp("foo\\(1\\)");
matches = regexp.allMatches(generated).iterator();
checkNumberOfMatches(matches, 1);

View file

@ -22,7 +22,7 @@ main() {
// Also make sure that we are not just in bailout mode without speculative
// types by grepping for the integer-bailout check on argument j.
var argname =
const RegExp(r'function(?: [a-z]+)?\(([a-zA-Z0-9_]+)\)').firstMatch(generated)[1];
new RegExp(r'function(?: [a-z]+)?\(([a-zA-Z0-9_]+)\)').firstMatch(generated)[1];
print(argname);
RegExp regexp = new RegExp(getIntTypeCheck(argname));
Expect.isTrue(regexp.hasMatch(generated));

View file

@ -73,14 +73,14 @@ main() {
RegExp regexp = new RegExp(getNumberTypeCheck('a'));
Expect.isTrue(!regexp.hasMatch(generated));
regexp = const RegExp('-a');
regexp = new RegExp('-a');
Expect.isTrue(!regexp.hasMatch(generated));
generated = compile(TEST_TWO_WITH_BAILOUT, entry: 'foo');
regexp = new RegExp(getNumberTypeCheck('a'));
Expect.isTrue(regexp.hasMatch(generated));
regexp = const RegExp('-a');
regexp = new RegExp('-a');
Expect.isTrue(regexp.hasMatch(generated));
generated = compile(TEST_THREE, entry: 'foo');
@ -92,19 +92,19 @@ main() {
Expect.isTrue(regexp.hasMatch(generated));
generated = compile(TEST_FIVE, entry: 'foo');
regexp = const RegExp('a.constructor !== Array');
regexp = new RegExp('a.constructor !== Array');
Expect.isTrue(!regexp.hasMatch(generated));
Expect.isTrue(generated.contains('index'));
Expect.isTrue(generated.contains('indexSet'));
generated = compile(TEST_FIVE_WITH_BAILOUT, entry: 'foo');
regexp = const RegExp('a.constructor !== Array');
regexp = new RegExp('a.constructor !== Array');
Expect.isTrue(regexp.hasMatch(generated));
Expect.isTrue(!generated.contains('index'));
Expect.isTrue(!generated.contains('indexSet'));
generated = compile(TEST_SIX, entry: 'foo');
regexp = const RegExp('a.constructor !== Array');
regexp = new RegExp('a.constructor !== Array');
Expect.isTrue(regexp.hasMatch(generated));
Expect.isTrue(!generated.contains('index'));
Expect.isTrue(!generated.contains('indexSet'));

View file

@ -221,13 +221,13 @@ expect(String code, int kind) {
break;
case ONE_CHECK:
RegExp regexp = const RegExp('ioore');
RegExp regexp = new RegExp('ioore');
Iterator matches = regexp.allMatches(generated).iterator();
checkNumberOfMatches(matches, 1);
break;
case ONE_ZERO_CHECK:
RegExp regexp = const RegExp('< 0');
RegExp regexp = new RegExp('< 0');
Iterator matches = regexp.allMatches(generated).iterator();
checkNumberOfMatches(matches, 1);
break;

View file

@ -5,7 +5,7 @@
class RegExp1Test {
static testMain() {
RegExp exp1 = const RegExp("bar|foo");
RegExp exp1 = new RegExp("bar|foo");
Expect.equals(true, exp1.hasMatch("foo"));
Expect.equals(true, exp1.hasMatch("bar"));
Expect.equals(false, exp1.hasMatch("gim"));
@ -14,7 +14,7 @@ class RegExp1Test {
Expect.equals(false, exp1.multiLine);
Expect.equals(false, exp1.ignoreCase);
RegExp exp2 = const RegExp("o+", ignoreCase: true);
RegExp exp2 = new RegExp("o+", ignoreCase: true);
Expect.equals(true, exp2.hasMatch("this looks good"));
Expect.equals(true, exp2.hasMatch("fOO"));
Expect.equals(false, exp2.hasMatch("bar"));

View file

@ -5,7 +5,7 @@
main() {
try {
RegExp ex = const RegExp(null);
RegExp ex = new RegExp(null);
Expect.fail("Expected: NullPointerException got: no exception");
} on Exception catch (ex) {
if (!(ex is NullPointerException)) {
@ -13,7 +13,7 @@ main() {
}
}
try {
const RegExp(r"^\w+$").hasMatch(null);
new RegExp(r"^\w+$").hasMatch(null);
Expect.fail("Expected: NullPointerException got: no exception");
} on Exception catch (ex) {
if (!(ex is NullPointerException)) {
@ -21,7 +21,7 @@ main() {
}
}
try {
const RegExp(r"^\w+$").firstMatch(null);
new RegExp(r"^\w+$").firstMatch(null);
Expect.fail("Expected: NullPointerException got: no exception");
} on Exception catch (ex) {
if (!(ex is NullPointerException)) {
@ -29,7 +29,7 @@ main() {
}
}
try {
const RegExp(r"^\w+$").allMatches(null);
new RegExp(r"^\w+$").allMatches(null);
Expect.fail("Expected: NullPointerException got: no exception");
} on Exception catch (ex) {
if (!(ex is NullPointerException)) {
@ -37,7 +37,7 @@ main() {
}
}
try {
const RegExp(r"^\w+$").stringMatch(null);
new RegExp(r"^\w+$").stringMatch(null);
Expect.fail("Expected: NullPointerException got: no exception");
} on Exception catch (ex) {
if (!(ex is NullPointerException)) {

View file

@ -3,13 +3,13 @@
// BSD-style license that can be found in the LICENSE file.
main() {
var list = "a b c".split(const RegExp(" "));
var list = "a b c".split(new RegExp(" "));
Expect.equals(3, list.length);
Expect.equals("a", list[0]);
Expect.equals("b", list[1]);
Expect.equals("c", list[2]);
list = "adbdc".split(const RegExp("[dz]"));
list = "adbdc".split(new RegExp("[dz]"));
Expect.equals(3, list.length);
Expect.equals("a", list[0]);
Expect.equals("b", list[1]);
@ -38,7 +38,7 @@ main() {
Expect.equals("", list[2]);
Expect.equals("", list[3]);
list = "aaa".split(const RegExp(r"a$"));
list = "aaa".split(new RegExp(r"a$"));
Expect.equals(2, list.length);
Expect.equals("aa", list[0]);
Expect.equals("", list[1]);

View file

@ -5,7 +5,7 @@
class RegExpTest {
static test1() {
RegExp exp = const RegExp("(\\w+)");
RegExp exp = new RegExp("(\\w+)");
String str = "Parse my string";
List<Match> matches = new List<Match>.from(exp.allMatches(str));
Expect.equals(3, matches.length);

View file

@ -122,7 +122,7 @@ class Version {
int getRevisionFromSvnInfo(String info) {
if (info == null || info == '') return 0;
var lines = info.split("\n");
RegExp exp = const RegExp(r"Last Changed Rev: (\d*)");
RegExp exp = new RegExp(r"Last Changed Rev: (\d*)");
for (var line in lines) {
if (exp.hasMatch(line)) {
String revisionString = (exp.firstMatch(line).group(1));

View file

@ -159,7 +159,7 @@ Set<Path> _findAllRelativeImports(Path topLibrary) {
Path libraryDir = topLibrary.directoryPath;
// Matches #import( or #source( followed by " or ' followed by anything
// except dart:, dart-ext: or /, at the beginning of a line.
RegExp relativeImportRegExp = const RegExp(
RegExp relativeImportRegExp = new RegExp(
'^#(import|source)[(]["\'](?!(dart:|dart-ext:|/))([^"\']*)["\']');
while (!toSearch.isEmpty) {
var thisPass = toSearch;

View file

@ -50,9 +50,9 @@ class Tokenizer {
: tokens = new List<String>();
// Tokens are : "(", ")", "$", ",", "&&", "||", "==", and (maximal) \w+.
static const testRegexp =
const RegExp(r"^([()$\w\s,]|(\&\&)|(\|\|)|(\=\=))+$");
static const regexp = const RegExp(r"[()$,]|(\&\&)|(\|\|)|(\=\=)|\w+");
static final testRegexp =
new RegExp(r"^([()$\w\s,]|(\&\&)|(\|\|)|(\=\=))+$");
static final regexp = new RegExp(r"[()$,]|(\&\&)|(\|\|)|(\=\=)|\w+");
List<String> tokenize() {
if (!testRegexp.hasMatch(expression)) {
@ -234,7 +234,7 @@ class ExpressionParser {
scanner.advance();
return value;
}
Expect.isTrue(const RegExp(r"^\w+$").hasMatch(scanner.current),
Expect.isTrue(new RegExp(r"^\w+$").hasMatch(scanner.current),
"Expected identifier in expression, got ${scanner.current}");
SetExpression value = new SetConstant(scanner.current);
scanner.advance();
@ -278,13 +278,13 @@ class ExpressionParser {
Expect.equals(scanner.current, Token.DOLLAR_SYMBOL,
"Expected \$ in expression, got ${scanner.current}");
scanner.advance();
Expect.isTrue(const RegExp(r"^\w+$").hasMatch(scanner.current),
Expect.isTrue(new RegExp(r"^\w+$").hasMatch(scanner.current),
"Expected identifier in expression, got ${scanner.current}");
TermVariable left = new TermVariable(scanner.current);
scanner.advance();
if (scanner.current == Token.EQUALS) {
scanner.advance();
Expect.isTrue(const RegExp(r"^\w+$").hasMatch(scanner.current),
Expect.isTrue(new RegExp(r"^\w+$").hasMatch(scanner.current),
"Expected identifier in expression, got ${scanner.current}");
TermConstant right = new TermConstant(scanner.current);
scanner.advance();

View file

@ -23,9 +23,9 @@ const OK = "ok";
*/
const SLOW = "slow";
const RegExp StripComment = const RegExp("^[^#]*");
const RegExp HeaderPattern = const RegExp(r"^\[([^\]]+)\]");
const RegExp RulePattern = const RegExp(r"\s*([^: ]*)\s*:(.*)");
final RegExp StripComment = new RegExp("^[^#]*");
final RegExp HeaderPattern = new RegExp(r"^\[([^\]]+)\]");
final RegExp RulePattern = new RegExp(r"\s*([^: ]*)\s*:(.*)");
// TODO(whesse): Implement configuration_info library that contains data
// structures for test configuration, including Section.

View file

@ -1153,7 +1153,7 @@ class ProcessQueue {
stdoutStringStream.onLine = () {
var line = stdoutStringStream.readLine();
while (null != line) {
var regexp = const RegExp(r".*selenium-server-standalone.*");
var regexp = new RegExp(r".*selenium-server-standalone.*");
if (regexp.hasMatch(line)) {
_seleniumAlreadyRunning = true;
resumeTesting();
@ -1196,8 +1196,8 @@ class ProcessQueue {
if (source.closed) return; // TODO(whesse): Remove when bug is fixed.
var line = source.readLine();
while (null != line) {
if (const RegExp(r".*Started.*Server.*").hasMatch(line) ||
const RegExp(r"Exception.*Selenium is already running.*").hasMatch(
if (new RegExp(r".*Started.*Server.*").hasMatch(line) ||
new RegExp(r"Exception.*Selenium is already running.*").hasMatch(
line)) {
resumeTesting();
}
@ -1219,7 +1219,7 @@ class ProcessQueue {
filePath = '${filePath.substring(0, index)}${pathSep}testing${pathSep}';
var lister = new Directory(filePath).list();
lister.onFile = (String file) {
if (const RegExp(r"selenium-server-standalone-.*\.jar").hasMatch(file)
if (new RegExp(r"selenium-server-standalone-.*\.jar").hasMatch(file)
&& _seleniumServer == null) {
Future processFuture = Process.start('java', ['-jar', file]);
processFuture.then((Process server) {

View file

@ -1180,26 +1180,26 @@ class StandardTestSuite extends TestSuite {
* configurations, so it may not use [configuration].
*/
static Map readOptionsFromFile(Path filePath) {
RegExp testOptionsRegExp = const RegExp(r"// VMOptions=(.*)");
RegExp dartOptionsRegExp = const RegExp(r"// DartOptions=(.*)");
RegExp otherScriptsRegExp = const RegExp(r"// OtherScripts=(.*)");
RegExp multiTestRegExp = const RegExp(r"/// [0-9][0-9]:(.*)");
RegExp testOptionsRegExp = new RegExp(r"// VMOptions=(.*)");
RegExp dartOptionsRegExp = new RegExp(r"// DartOptions=(.*)");
RegExp otherScriptsRegExp = new RegExp(r"// OtherScripts=(.*)");
RegExp multiTestRegExp = new RegExp(r"/// [0-9][0-9]:(.*)");
RegExp multiHtmlTestRegExp =
const RegExp(r"useHtmlIndividualConfiguration()");
new RegExp(r"useHtmlIndividualConfiguration()");
RegExp staticTypeRegExp =
const RegExp(r"/// ([0-9][0-9]:){0,1}\s*static type warning");
new RegExp(r"/// ([0-9][0-9]:){0,1}\s*static type warning");
RegExp compileTimeRegExp =
const RegExp(r"/// ([0-9][0-9]:){0,1}\s*compile-time error");
RegExp staticCleanRegExp = const RegExp(r"// @static-clean");
RegExp leadingHashRegExp = const RegExp(r"^#", multiLine: true);
RegExp isolateStubsRegExp = const RegExp(r"// IsolateStubs=(.*)");
new RegExp(r"/// ([0-9][0-9]:){0,1}\s*compile-time error");
RegExp staticCleanRegExp = new RegExp(r"// @static-clean");
RegExp leadingHashRegExp = new RegExp(r"^#", multiLine: true);
RegExp isolateStubsRegExp = new RegExp(r"// IsolateStubs=(.*)");
// TODO(gram) Clean these up once the old directives are not supported.
RegExp domImportRegExp =
const RegExp(r"^[#]?import.*dart:html", multiLine: true);
new RegExp(r"^[#]?import.*dart:html", multiLine: true);
RegExp libraryDefinitionRegExp =
const RegExp(r"^[#]?library[\( ]", multiLine: true);
new RegExp(r"^[#]?library[\( ]", multiLine: true);
RegExp sourceOrImportRegExp =
const RegExp("^(#source|#import|part)[ \t]+[\('\"]", multiLine: true);
new RegExp("^(#source|#import|part)[ \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

View file

@ -384,7 +384,7 @@ class Apidoc extends doc.Dartdoc {
doc.DocComment createDocComment(String text,
[ClassMirror inheritedFrom]) {
String strippedText =
text.replaceAll(const RegExp("@([a-zA-Z]+) ([^;]+)(?:;|\$)"),
text.replaceAll(new RegExp("@([a-zA-Z]+) ([^;]+)(?:;|\$)"),
'').trim();
if (strippedText.isEmpty) return null;
return super.createDocComment(strippedText, inheritedFrom);

View file

@ -234,7 +234,7 @@ class HtmlDiff {
*/
Map<String, String> _getTags(String comment) {
if (comment == null) return const <String, String>{};
final re = const RegExp("@([a-zA-Z]+) ([^;]+)(?:;|\$)");
final re = new RegExp("@([a-zA-Z]+) ([^;]+)(?:;|\$)");
final tags = <String, String>{};
for (var m in re.allMatches(comment.trim())) {
tags[m[1]] = m[2];

View file

@ -691,7 +691,7 @@ bool isObsolete(Element e) {
}
bool isFirstCharLowerCase(String str) {
return const RegExp("^[a-z]").hasMatch(str);
return new RegExp("^[a-z]").hasMatch(str);
}
/**
@ -943,8 +943,8 @@ String trimHtml(String html) {
}
bool maybeName(String name) {
return const RegExp("^[a-z][a-z0-9A-Z]+\$").hasMatch(name) ||
const RegExp("^[A-Z][A-Z_]*\$").hasMatch(name);
return new RegExp("^[a-z][a-z0-9A-Z]+\$").hasMatch(name) ||
new RegExp("^[A-Z][A-Z_]*\$").hasMatch(name);
}
// TODO(jacobr): this element is ugly at the moment but will become easier to
@ -967,7 +967,7 @@ String JSONFIXUPHACK(String value) {
}
String mozToWebkit(String name) {
return name.replaceFirst(const RegExp("^moz"), "webkit");
return name.replaceFirst(new RegExp("^moz"), "webkit");
}
String stripWebkit(String name) {
@ -1121,10 +1121,10 @@ void run() {
}
// Fix up links.
const SHORT_LINK = const RegExp(r'^[\w/]+$');
const INNER_LINK = const RegExp(r'[Ee]n/(?:[\w/]+/|)([\w#.]+)(?:\(\))?$');
const MEMBER_LINK = const RegExp(r'(\w+)[.#](\w+)');
const RELATIVE_LINK = const RegExp(r'^(?:../)*/?[Ee][Nn]/(.+)');
const SHORT_LINK = new RegExp(r'^[\w/]+$');
const INNER_LINK = new RegExp(r'[Ee]n/(?:[\w/]+/|)([\w#.]+)(?:\(\))?$');
const MEMBER_LINK = new RegExp(r'(\w+)[.#](\w+)');
const RELATIVE_LINK = new RegExp(r'^(?:../)*/?[Ee][Nn]/(.+)');
// - Make relative links absolute.
// - If we can, take links that point to other MDN pages and retarget them

View file

@ -152,7 +152,7 @@ class GitSource extends Source {
// have the right working directory when pub spawns git, so the relative
// path fails. To work around it, if [from] looks like a relative path then
// manually make it absolute here. Should figure out what's really going on.
const URL_LIKE = const RegExp(r'^[a-z]+\:');
var URL_LIKE = new RegExp(r'^[a-z]+\:');
if (!URL_LIKE.hasMatch(from)) {
from = getFullPath(from);
}

View file

@ -21,7 +21,7 @@ String _gitCommandCache;
/** Gets the current working directory. */
String get currentWorkingDir => new File('.').fullPathSync();
const Pattern NEWLINE_PATTERN = const RegExp("\r\n?|\n\r?");
final NEWLINE_PATTERN = new RegExp("\r\n?|\n\r?");
/**
* Prints the given string to `stderr` on its own line.
@ -382,7 +382,7 @@ String getFullPath(entry) {
if (Platform.operatingSystem == 'windows') {
// An absolute path on Windows is either UNC (two leading backslashes),
// or a drive letter followed by a colon and a slash.
const ABSOLUTE = const RegExp(r'^(\\\\|[a-zA-Z]:[/\\])');
var ABSOLUTE = new RegExp(r'^(\\\\|[a-zA-Z]:[/\\])');
if (ABSOLUTE.hasMatch(path)) return path;
} else {
if (path.startsWith('/')) return path;

View file

@ -18,7 +18,7 @@ class Version implements Comparable, VersionConstraint {
/** No released version: i.e. "0.0.0". */
static Version get none => new Version(0, 0, 0);
static const _PARSE_REGEX = const RegExp(
static final _PARSE_REGEX = new RegExp(
r'^' // Start at beginning.
r'(\d+).(\d+).(\d+)' // Version number.
r'(-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?' // Pre-release.
@ -411,7 +411,7 @@ class _VersionConstraintFactory {
// unfortunately meaningful in YAML, requiring it to be quoted in a
// pubspec.
// See if it's a comparison operator followed by a version, like ">1.2.3".
var match = const RegExp(r"^([<>]=?)?(.*)$").firstMatch(text);
var match = new RegExp(r"^([<>]=?)?(.*)$").firstMatch(text);
if (match != null) {
var comparison = match[1];
var version = new Version.parse(match[2]);

View file

@ -106,13 +106,13 @@ class _Composer extends _Visitor {
/** Parses a null scalar. */
_ScalarNode parseNull(String content) {
if (!const RegExp("^(null|Null|NULL|~|)\$").hasMatch(content)) return null;
if (!new RegExp("^(null|Null|NULL|~|)\$").hasMatch(content)) return null;
return new _ScalarNode(_Tag.yaml("null"), value: null);
}
/** Parses a boolean scalar. */
_ScalarNode parseBool(String content) {
var match = const RegExp("^(?:(true|True|TRUE)|(false|False|FALSE))\$").
var match = new RegExp("^(?:(true|True|TRUE)|(false|False|FALSE))\$").
firstMatch(content);
if (match == null) return null;
return new _ScalarNode(_Tag.yaml("bool"), value: match.group(1) != null);
@ -120,13 +120,13 @@ class _Composer extends _Visitor {
/** Parses an integer scalar. */
_ScalarNode parseInt(String content) {
var match = const RegExp("^[-+]?[0-9]+\$").firstMatch(content);
var match = new RegExp("^[-+]?[0-9]+\$").firstMatch(content);
if (match != null) {
return new _ScalarNode(_Tag.yaml("int"),
value: Math.parseInt(match.group(0)));
}
match = const RegExp("^0o([0-7]+)\$").firstMatch(content);
match = new RegExp("^0o([0-7]+)\$").firstMatch(content);
if (match != null) {
// TODO(nweiz): clean this up when Dart can parse an octal string
var n = 0;
@ -137,7 +137,7 @@ class _Composer extends _Visitor {
return new _ScalarNode(_Tag.yaml("int"), value: n);
}
match = const RegExp("^0x[0-9a-fA-F]+\$").firstMatch(content);
match = new RegExp("^0x[0-9a-fA-F]+\$").firstMatch(content);
if (match != null) {
return new _ScalarNode(_Tag.yaml("int"),
value: Math.parseInt(match.group(0)));
@ -148,7 +148,7 @@ class _Composer extends _Visitor {
/** Parses a floating-point scalar. */
_ScalarNode parseFloat(String content) {
var match = const RegExp(
var match = new RegExp(
"^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?\$").
firstMatch(content);
if (match != null) {
@ -159,14 +159,14 @@ class _Composer extends _Visitor {
value: Math.parseDouble(matchStr));
}
match = const RegExp("^([+-]?)\.(inf|Inf|INF)\$").firstMatch(content);
match = new RegExp("^([+-]?)\.(inf|Inf|INF)\$").firstMatch(content);
if (match != null) {
var infinityStr = match.group(1) == "-" ? "-Infinity" : "Infinity";
return new _ScalarNode(_Tag.yaml("float"),
value: Math.parseDouble(infinityStr));
}
match = const RegExp("^\.(nan|NaN|NAN)\$").firstMatch(content);
match = new RegExp("^\.(nan|NaN|NAN)\$").firstMatch(content);
if (match != null) {
return new _ScalarNode(_Tag.yaml("float"),
value: Math.parseDouble("NaN"));

View file

@ -146,7 +146,7 @@ class _ScalarNode extends _Node {
// 20 is the maximum value for this argument, which we use since YAML
// doesn't specify a maximum.
return value.toStringAsExponential(20).
replaceFirst(const RegExp("0+e"), "e");
replaceFirst(new RegExp("0+e"), "e");
}
if (value is String) {

View file

@ -501,7 +501,7 @@ class Codegen {
class ElemCG {
// List of identifiers and quoted strings (single and double quoted).
var identRe = const RegExp(
var identRe = new RegExp(
"\s*('\"\\'\\\"[^'\"\\'\\\"]+'\"\\'\\\"|[_A-Za-z][_A-Za-z0-9]*)");
List<CGBlock> _cgBlocks;

View file

@ -164,7 +164,7 @@ runTextLayoutTest(testNum) {
var expectedFileName =
'$sourceDir${Platform.pathSeparator}'
'${label.replaceAll("###", "_")
.replaceAll(const RegExp("[^A-Za-z0-9]"),"_")}.txt';
.replaceAll(new RegExp("[^A-Za-z0-9]"),"_")}.txt';
var expected = new File(expectedFileName);
if (regenerate) {
var ostream = expected.openOutputStream(FileMode.WRITE);
@ -260,7 +260,7 @@ runPixelLayoutTest(int testNum) {
var expectedFileName =
'$sourceDir${Platform.pathSeparator}'
'${label.replaceAll("###","_").
replaceAll(const RegExp("[^A-Za-z0-9]"),"_")}.png';
replaceAll(new RegExp("[^A-Za-z0-9]"),"_")}.png';
var expected = new File(expectedFileName);
if (regenerate) {
var ostream = expected.openOutputStream(FileMode.WRITE);

View file

@ -21,7 +21,7 @@ main() {
appDir([{"git": "../foo.git"}]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
dir(cachePath, [
dir('git', [
@ -46,7 +46,7 @@ main() {
]).scheduleCommit();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
// When we download a new version of the git package, we should re-use the
// git/cache directory but create a new git/ directory.

View file

@ -28,7 +28,7 @@ main() {
appDir([{"git": {"url": "../foo.git", "ref": "old"}}]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
dir(packagesPath, [
dir('foo', [

View file

@ -28,7 +28,7 @@ main() {
appDir([{"git": {"url": "../foo.git", "ref": commit}}]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
dir(packagesPath, [
dir('foo', [

View file

@ -21,7 +21,7 @@ main() {
appDir([{"git": "../foo.git"}]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
dir(cachePath, [
dir('git', [

View file

@ -26,7 +26,7 @@ main() {
appDir([{"git": "../foo.git"}]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp("Dependencies installed!\$"));
output: new RegExp("Dependencies installed!\$"));
dir(cachePath, [
dir('git', [

View file

@ -21,7 +21,7 @@ main() {
appDir([{"git": "../foo.git"}]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
dir(cachePath, [
dir('git', [
@ -42,7 +42,7 @@ main() {
// Verify that nothing breaks if we install a Git revision that's already
// in the cache.
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
run();
});

View file

@ -22,7 +22,7 @@ main() {
appDir([{"git": "../foo.git/"}]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
dir(cachePath, [
dir('git', [

View file

@ -30,7 +30,7 @@ main() {
// TODO(nweiz): clean up this RegExp when either issue 4706 or 4707 is
// fixed.
schedulePub(args: ['install'],
error: const RegExp(r'^The name you specified for your dependency, '
error: new RegExp(r'^The name you specified for your dependency, '
'"weirdname", doesn\'t match the name "foo" in its '
r'pubspec\.'),
exitCode: 1);

View file

@ -29,7 +29,7 @@ main() {
]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
dir(packagesPath, [
dir('weirdname', [

View file

@ -22,7 +22,7 @@ main() {
// This install should lock the foo.git dependency to the current revision.
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
dir(packagesPath, [
dir('foo', [
@ -40,7 +40,7 @@ main() {
// This install shouldn't update the foo.git dependency due to the lockfile.
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
dir(packagesPath, [
dir('foo', [

View file

@ -23,7 +23,7 @@ main() {
// TODO(nweiz): clean up this RegExp when either issue 4706 or 4707 is
// fixed.
schedulePub(args: ['install'],
error: const RegExp(r'^Package "foo"' "'" 's pubspec.yaml file is '
error: new RegExp(r'^Package "foo"' "'" 's pubspec.yaml file is '
r'missing the required "name" field \(e\.g\. "name: foo"\)\.'),
exitCode: 1);

View file

@ -22,7 +22,7 @@ main() {
// TODO(nweiz): clean up this RegExp when either issue 4706 or 4707 is
// fixed.
schedulePub(args: ['install'],
error: const RegExp('^Package "foo" doesn\'t have a '
error: new RegExp('^Package "foo" doesn\'t have a '
'pubspec.yaml file.'),
exitCode: 1);

View file

@ -22,7 +22,7 @@ main() {
appDir([{"git": "../foo.git"}]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
dir(packagesPath, [
dir('foo', [
@ -38,7 +38,7 @@ main() {
appDir([{"git": "../foo.git", "version": ">=1.0.0"}]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
dir(packagesPath, [
dir('foo', [

View file

@ -21,7 +21,7 @@ main() {
appDir([{"git": "../foo.git"}]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
dir(packagesPath, [
dir('foo', [
@ -37,7 +37,7 @@ main() {
appDir([{"git": "../foo.git", "version": ">=1.0.0"}]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
dir(packagesPath, [
dir('foo', [

View file

@ -16,7 +16,7 @@ main() {
appDir([dependency("foo", "1.2.3")]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp("Dependencies installed!\$"));
output: new RegExp("Dependencies installed!\$"));
cacheDir({"foo": "1.2.3"}).scheduleValidate();
packagesDir({"foo": "1.2.3"}).scheduleValidate();

View file

@ -21,7 +21,7 @@ main() {
appDir([dependency("foo", "1.2.3")]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp("Dependencies installed!\$"));
output: new RegExp("Dependencies installed!\$"));
cacheDir({"foo": "1.2.3", "bar": "2.0.4"}).scheduleValidate();
packagesDir({"foo": "1.2.3", "bar": "2.0.4"}).scheduleValidate();

View file

@ -21,7 +21,7 @@ main() {
appDir([dependency("foo"), dependency("bar")]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
packagesDir({
"foo": "1.0.0",
@ -32,7 +32,7 @@ main() {
appDir([dependency("foo")]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
packagesDir({
"foo": "1.0.0",

View file

@ -16,7 +16,7 @@ main() {
appDir([dependency("foo", "1.2.3")]).scheduleCreate();
schedulePub(args: ['install'],
error: const RegExp('Could not find package "foo" at '
error: new RegExp('Could not find package "foo" at '
'http://localhost:'),
exitCode: 1);

View file

@ -26,7 +26,7 @@ main() {
]).scheduleCreate();
schedulePub(args: ['install'],
error: const RegExp('Could not resolve URL "http://pub.invalid".'),
error: new RegExp('Could not resolve URL "http://pub.invalid".'),
exitCode: 1);
run();

View file

@ -19,7 +19,7 @@ main() {
appDir([dependency("foo"), dependency("bar")]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
packagesDir({
"foo": "1.0.0",
@ -29,7 +29,7 @@ main() {
appDir([dependency("foo")]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
packagesDir({
"foo": "1.0.0",

View file

@ -24,7 +24,7 @@ main() {
appDir([dependency("foo"), dependency("bar")]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
packagesDir({
"foo": "1.0.0",
@ -36,7 +36,7 @@ main() {
appDir([dependency("foo")]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
packagesDir({
"foo": "1.0.0",

View file

@ -22,7 +22,7 @@ main() {
appDir([dependency("foo"), dependency("bar")]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp("Dependencies installed!\$"));
output: new RegExp("Dependencies installed!\$"));
cacheDir({
"foo": "1.2.3",

View file

@ -17,7 +17,7 @@ main() {
appDir([dependency("foo")]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
packagesDir({"foo": "1.0.0"}).scheduleValidate();
@ -26,7 +26,7 @@ main() {
appDir([dependency("foo", ">=1.0.0")]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
packagesDir({"foo": "1.0.0"}).scheduleValidate();

View file

@ -21,7 +21,7 @@ main() {
appDir([dependency("foo")]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
packagesDir({
"foo": "1.0.0",
@ -39,7 +39,7 @@ main() {
appDir([dependency("foo"), dependency("newdep")]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
packagesDir({
"foo": "1.0.0",

View file

@ -17,7 +17,7 @@ main() {
// This install should lock the foo dependency to version 1.0.0.
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
packagesDir({"foo": "1.0.0"}).scheduleValidate();
@ -29,7 +29,7 @@ main() {
// This install shouldn't update the foo dependency due to the lockfile.
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
packagesDir({"foo": "1.0.0"}).scheduleValidate();

View file

@ -17,7 +17,7 @@ main() {
appDir([dependency("foo")]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
packagesDir({"foo": "1.0.0"}).scheduleValidate();
@ -26,7 +26,7 @@ main() {
appDir([dependency("foo", ">1.0.0")]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
packagesDir({"foo": "1.0.1"}).scheduleValidate();

View file

@ -22,7 +22,7 @@ main() {
appDir([dependency("foo")]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
packagesDir({
"foo": "1.0.0",
@ -42,7 +42,7 @@ main() {
appDir([dependency("foo"), dependency("newdep")]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
packagesDir({
"foo": "2.0.0",

View file

@ -15,7 +15,7 @@ main() {
dir(appPath, []).scheduleCreate();
schedulePub(args: ['install'],
error: const RegExp(r'^Could not find a file named "pubspec\.yaml"'),
error: new RegExp(r'^Could not find a file named "pubspec\.yaml"'),
exitCode: 1);
run();
@ -27,7 +27,7 @@ main() {
]).scheduleCreate();
schedulePub(args: ['install'],
error: const RegExp(r'^pubspec.yaml is missing the required "name" '
error: new RegExp(r'^pubspec.yaml is missing the required "name" '
r'field \(e\.g\. "name: myapp"\)\.'),
exitCode: 1);
@ -44,7 +44,7 @@ main() {
]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
dir(packagesPath, [
dir("myapp_name", [
@ -63,7 +63,7 @@ main() {
]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
dir(packagesPath, [
nothing("myapp_name")
@ -88,9 +88,9 @@ main() {
]).scheduleCreate();
schedulePub(args: ['install'],
error: const RegExp(r'Warning: Package "foo" does not have a "lib" '
error: new RegExp(r'Warning: Package "foo" does not have a "lib" '
'directory.'),
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
run();
});
@ -102,7 +102,7 @@ main() {
schedulePub(args: ['install'],
error: '',
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
run();
});
@ -118,7 +118,7 @@ main() {
]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
dir(packagesPath, [
nothing('foo'),
@ -137,7 +137,7 @@ main() {
]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
dir(appPath, [
dir("test", [
@ -167,7 +167,7 @@ main() {
]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
dir(appPath, [
dir("example", [
@ -197,7 +197,7 @@ main() {
]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
dir(appPath, [
dir("web", [
@ -227,7 +227,7 @@ main() {
]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
dir(appPath, [
dir("bin", [
@ -257,7 +257,7 @@ main() {
Warning: Package "myapp_name" is using a deprecated layout.
See http://www.dartlang.org/docs/pub-package-manager/package-layout.html for details.
''',
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
run();
});

View file

@ -26,7 +26,7 @@ main() {
]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
packagesDir({"foo": "0.0.1234"}).scheduleValidate();

View file

@ -30,7 +30,7 @@ main() {
]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
packagesDir({
'foo': '0.0.1234',

View file

@ -409,7 +409,7 @@ String _packageName(String sourceName, description) {
switch (sourceName) {
case "git":
var url = description is String ? description : description['url'];
return basename(url.replaceFirst(const RegExp(r"(\.git)?/?$"), ""));
return basename(url.replaceFirst(new RegExp(r"(\.git)?/?$"), ""));
case "hosted":
if (description is String) return description;
return description['name'];

View file

@ -27,7 +27,7 @@ main() {
appDir([{"git": "../foo.git"}]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
dir(packagesPath, [
dir('foo', [
@ -49,7 +49,7 @@ main() {
]).scheduleCommit();
schedulePub(args: ['update', 'foo'],
output: const RegExp(r"Dependencies updated!$"));
output: new RegExp(r"Dependencies updated!$"));
dir(packagesPath, [
dir('foo', [

View file

@ -26,7 +26,7 @@ main() {
appDir([{"git": "../foo.git"}, {"git": "../bar.git"}]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
dir(packagesPath, [
dir('foo', [
@ -48,7 +48,7 @@ main() {
]).scheduleCommit();
schedulePub(args: ['update'],
output: const RegExp(r"Dependencies updated!$"));
output: new RegExp(r"Dependencies updated!$"));
dir(packagesPath, [
dir('foo', [

View file

@ -26,7 +26,7 @@ main() {
appDir([{"git": "../foo.git"}, {"git": "../bar.git"}]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
output: new RegExp(r"Dependencies installed!$"));
dir(packagesPath, [
dir('foo', [
@ -48,7 +48,7 @@ main() {
]).scheduleCommit();
schedulePub(args: ['update', 'foo'],
output: const RegExp(r"Dependencies updated!$"));
output: new RegExp(r"Dependencies updated!$"));
dir(packagesPath, [
dir('foo', [

Some files were not shown because too many files have changed in this diff Show more