Compare commits

..

No commits in common. "014c22d7ff71efe698a1e85ca25f94e4a87189e1" and "a0447650aef79a500edd1d6257d68581437bcbb3" have entirely different histories.

3 changed files with 29 additions and 88 deletions

View File

@ -1081,23 +1081,6 @@
applyHooksTransformer: function (transformer, hooks) { applyHooksTransformer: function (transformer, hooks) {
return transformer(hooks) || hooks; return transformer(hooks) || hooks;
}, },
JSSyntaxRegExp_makeNative: function (source, multiLine, caseSensitive, unicode, dotAll, global) {
var m = multiLine ? "m" : "",
i = caseSensitive ? "" : "i",
u = unicode ? "u" : "",
s = dotAll ? "s" : "",
g = global ? "g" : "",
regexp = function (source, modifiers) {
try {
return new RegExp(source, modifiers);
} catch (e) {
return e;
}
}(source, m + i + u + s + g);
if (regexp instanceof RegExp)
return regexp;
throw H.wrapException(new P.FormatException("Illegal RegExp pattern (" + String(regexp) + ")", source));
},
quoteStringForRegExp: function (string) { quoteStringForRegExp: function (string) {
if (/[[\]{}()*+?.\\^$|]/.test(string)) if (/[[\]{}()*+?.\\^$|]/.test(string))
return string.replace(/[[\]{}()*+?.\\^$|]/g, "\\$&"); return string.replace(/[[\]{}()*+?.\\^$|]/g, "\\$&");
@ -1191,12 +1174,6 @@
initHooks_closure1: function initHooks_closure1(t0) { initHooks_closure1: function initHooks_closure1(t0) {
this.prototypeForTag = t0; this.prototypeForTag = t0;
}, },
JSSyntaxRegExp: function JSSyntaxRegExp(t0, t1) {
var _ = this;
_.pattern = t0;
_._nativeRegExp = t1;
_._nativeAnchoredRegExp = _._nativeGlobalRegExp = null;
},
Rti__getQuestionFromStar: function (universe, rti) { Rti__getQuestionFromStar: function (universe, rti) {
var question = rti._precomputed1; var question = rti._precomputed1;
return question == null ? rti._precomputed1 = H._Universe__lookupQuestionRti(universe, rti._primary, true) : question; return question == null ? rti._precomputed1 = H._Universe__lookupQuestionRti(universe, rti._primary, true) : question;
@ -3505,9 +3482,6 @@
C.JSArray_methods.add$1(list, t1.get$current()); C.JSArray_methods.add$1(list, t1.get$current());
return list; return list;
}, },
RegExp_RegExp: function (source) {
return new H.JSSyntaxRegExp(source, H.JSSyntaxRegExp_makeNative(source, false, true, false, false, false));
},
StringBuffer__writeAll: function (string, objects, separator) { StringBuffer__writeAll: function (string, objects, separator) {
var iterator = J.get$iterator$ax(objects); var iterator = J.get$iterator$ax(objects);
if (!iterator.moveNext$0()) if (!iterator.moveNext$0())
@ -3615,10 +3589,6 @@
_Exception: function _Exception(t0) { _Exception: function _Exception(t0) {
this.message = t0; this.message = t0;
}, },
FormatException: function FormatException(t0, t1) {
this.message = t0;
this.source = t1;
},
Iterable: function Iterable() {}, Iterable: function Iterable() {},
Iterator: function Iterator() {}, Iterator: function Iterator() {},
Null: function Null() {}, Null: function Null() {},
@ -3810,13 +3780,11 @@
return P._asyncStartSync($async$a_run, $async$completer); return P._asyncStartSync($async$a_run, $async$completer);
}, },
main: function () { main: function () {
var reg_exp, t1, t2, t3, t4, test_map, t5, tr, td, plist, pbody, p, a, i, b, var t1, t2, t3, t4, test_map, t5, tr, td, plist, pbody, p, a, i, b,
_s13_ = "Hello, World!"; _s13_ = "Hello, World!";
P.print(V.test_list("abc")); P.print(V.test_list("abc"));
P.print(V.test_list("")); P.print(V.test_list(""));
P.print($.$get$Dt_at()); P.print($.$get$Dt_at());
reg_exp = P.RegExp_RegExp("^\\d{1,2}$");
P.print(reg_exp._nativeRegExp.test("1"));
t1 = document; t1 = document;
t2 = t1.querySelector("#an-id"); t2 = t1.querySelector("#an-id");
t2.toString; t2.toString;
@ -4056,17 +4024,6 @@
$add: function (receiver, other) { $add: function (receiver, other) {
return receiver + other; return receiver + other;
}, },
substring$2: function (receiver, startIndex, endIndex) {
if (endIndex == null)
endIndex = receiver.length;
if (startIndex < 0)
throw H.wrapException(P.RangeError$value(startIndex, null));
if (startIndex > endIndex)
throw H.wrapException(P.RangeError$value(startIndex, null));
if (endIndex > receiver.length)
throw H.wrapException(P.RangeError$value(endIndex, null));
return receiver.substring(startIndex, endIndex);
},
toString$0: function (receiver) { toString$0: function (receiver) {
return receiver; return receiver;
}, },
@ -4535,11 +4492,6 @@
}, },
$signature: 7 $signature: 7
}; };
H.JSSyntaxRegExp.prototype = {
toString$0: function (_) {
return "RegExp/" + this.pattern + "/" + this._nativeRegExp.flags;
}
};
H.Rti.prototype = { H.Rti.prototype = {
_eval$1: function (recipe) { _eval$1: function (recipe) {
return H._Universe_evalInEnvironment(init.typeUniverse, this, recipe); return H._Universe_evalInEnvironment(init.typeUniverse, this, recipe);
@ -5236,16 +5188,6 @@
return "Exception: " + this.message; return "Exception: " + this.message;
} }
}; };
P.FormatException.prototype = {
toString$0: function (_) {
var message = this.message,
report = "" !== message ? "FormatException: " + message : "FormatException",
source = this.source;
if (source.length > 78)
source = C.JSString_methods.substring$2(source, 0, 75) + "...";
return report + "\n" + source;
}
};
P.Iterable.prototype = { P.Iterable.prototype = {
any$1: function (_, test) { any$1: function (_, test) {
var t1; var t1;
@ -5471,7 +5413,7 @@
_inherit = hunkHelpers.inherit, _inherit = hunkHelpers.inherit,
_inheritMany = hunkHelpers.inheritMany; _inheritMany = hunkHelpers.inheritMany;
_inherit(P.Object, null); _inherit(P.Object, null);
_inheritMany(P.Object, [H.JS_CONST, J.Interceptor, J.ArrayIterator, P.Error, P.Iterable, H.ListIterator, P.Iterator, H.TypeErrorDecoder, H.NullThrownFromJavaScriptException, H.ExceptionAndStackTrace, H._StackTrace, H.Closure, P.MapMixin, H.LinkedHashMapCell, H.LinkedHashMapKeyIterator, H.JSSyntaxRegExp, H.Rti, H._FunctionParameters, P._TimerImpl, P._AsyncAwaitCompleter, P.AsyncError, P._FutureListener, P._Future, P._AsyncCallbackEntry, P._StreamIterator, P._Zone, P._ListBase_Object_ListMixin, P.ListMixin, P.Duration, P.StackOverflowError, P._Exception, P.FormatException, P.Null, P._StringStackTrace, P.StringBuffer, W.CssStyleDeclarationBase, W.ImmutableListMixin, W.FixedSizeListIterator]); _inheritMany(P.Object, [H.JS_CONST, J.Interceptor, J.ArrayIterator, P.Error, P.Iterable, H.ListIterator, P.Iterator, H.TypeErrorDecoder, H.NullThrownFromJavaScriptException, H.ExceptionAndStackTrace, H._StackTrace, H.Closure, P.MapMixin, H.LinkedHashMapCell, H.LinkedHashMapKeyIterator, H.Rti, H._FunctionParameters, P._TimerImpl, P._AsyncAwaitCompleter, P.AsyncError, P._FutureListener, P._Future, P._AsyncCallbackEntry, P._StreamIterator, P._Zone, P._ListBase_Object_ListMixin, P.ListMixin, P.Duration, P.StackOverflowError, P._Exception, P.Null, P._StringStackTrace, P.StringBuffer, W.CssStyleDeclarationBase, W.ImmutableListMixin, W.FixedSizeListIterator]);
_inheritMany(J.Interceptor, [J.JSBool, J.JSNull, J.JavaScriptObject, J.JSArray, J.JSNumber, J.JSString, W.EventTarget, W._CssStyleDeclaration_Interceptor_CssStyleDeclarationBase, W.DomException, W.DomTokenList, W._NodeList_Interceptor_ListMixin]); _inheritMany(J.Interceptor, [J.JSBool, J.JSNull, J.JavaScriptObject, J.JSArray, J.JSNumber, J.JSString, W.EventTarget, W._CssStyleDeclaration_Interceptor_CssStyleDeclarationBase, W.DomException, W.DomTokenList, W._NodeList_Interceptor_ListMixin]);
_inheritMany(J.JavaScriptObject, [J.PlainJavaScriptObject, J.UnknownJavaScriptObject, J.JavaScriptFunction]); _inheritMany(J.JavaScriptObject, [J.PlainJavaScriptObject, J.UnknownJavaScriptObject, J.JavaScriptFunction]);
_inherit(J.JSUnmodifiableArray, J.JSArray); _inherit(J.JSUnmodifiableArray, J.JSArray);

View File

@ -44,6 +44,7 @@ num drawText(CanvasRenderingContext2D ctx, String txt, int x, int y, int w,
} }
class Dt { class Dt {
static String ex = b('!'); static String ex = b('!');
static String add = b('+'); static String add = b('+');
static String at = b('@'); static String at = b('@');
@ -59,6 +60,7 @@ List<String> test_list(String str) {
} }
return ["a", "b", "c"]; return ["a", "b", "c"];
} }
b_run() async { b_run() async {
@ -94,15 +96,12 @@ a_run() async {
} }
void main() { void main() {
print(test_list("abc")); print(test_list("abc"));
print(test_list("")); print(test_list(""));
print(Dt.at); print(Dt.at);
var reg_exp = RegExp(r"^\d{1,2}$");
print(reg_exp.hasMatch("1"));
// Find an element by id (an-id). // Find an element by id (an-id).
Element idElement = querySelector('#an-id')!; Element idElement = querySelector('#an-id')!;
@ -198,3 +197,4 @@ void main() {
closuer(); closuer();
print(a); print(a);
} }

View File

@ -1411,22 +1411,21 @@
cT(a, b) { cT(a, b) {
return a(b) || b return a(b) || b
}, },
js_synatax_regexp_make_native(source, multline, cast_sensitive, unicode, dot_all, global) { m7(a, b, c, d, e, f) {
var s = multline ? "m" : "", var s = b ? "m" : "",
r = cast_sensitive ? "" : "i", r = c ? "" : "i",
q = unicode ? "u" : "", q = d ? "u" : "",
p = dot_all ? "s" : "", p = e ? "s" : "",
o = global ? "g" : "", o = f ? "g" : "",
n = function (source, modifiers) { n = function (g, h) {
try { try {
return new RegExp(source, modifiers) return new RegExp(g, h)
} catch (e) { } catch (m) {
return e return m
} }
}(source, s + r + q + p + o) }(a, s + r + q + p + o)
if (n instanceof RegExp) if (n instanceof RegExp) return n
return n; throw H.h(P.jn("Illegal RegExp pattern (" + String(n) + ")", a, null))
throw H.h(P.jn("Illegal RegExp pattern (" + String(n) + ")", source, null))
}, },
iF(a, b, c) { iF(a, b, c) {
var s var s
@ -4183,7 +4182,7 @@
return H.nZ(p) return H.nZ(p)
}, },
h_(a) { h_(a) {
return new H.ct(a, H.js_synatax_regexp_make_native(a, false, true, false, false, false)) return new H.ct(a, H.m7(a, !1, !0, !1, !1, !1))
}, },
o7(a, b, c) { o7(a, b, c) {
var s = J.by(b) var s = J.by(b)
@ -9325,14 +9324,14 @@
r = s.c r = s.c
if (r != null) return r if (r != null) return r
r = s.b r = s.b
return s.c = H.js_synatax_regexp_make_native(s.a, r.multiline, !r.ignoreCase, r.unicode, r.dotAll, !0) return s.c = H.m7(s.a, r.multiline, !r.ignoreCase, r.unicode, r.dotAll, !0)
}, },
gep() { gep() {
var s = this, var s = this,
r = s.d r = s.d
if (r != null) return r if (r != null) return r
r = s.b r = s.b
return s.d = H.js_synatax_regexp_make_native(s.a + "|()", r.multiline, !r.ignoreCase, r.unicode, r.dotAll, !0) return s.d = H.m7(s.a + "|()", r.multiline, !r.ignoreCase, r.unicode, r.dotAll, !0)
}, },
eU(a) { eU(a) {
var s var s