Compare commits
2 Commits
a0447650ae
...
014c22d7ff
Author | SHA1 | Date | |
---|---|---|---|
014c22d7ff | |||
dd7e9e63a7 |
@ -1081,6 +1081,23 @@
|
|||||||
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, "\\$&");
|
||||||
@ -1174,6 +1191,12 @@
|
|||||||
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;
|
||||||
@ -3482,6 +3505,9 @@
|
|||||||
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())
|
||||||
@ -3589,6 +3615,10 @@
|
|||||||
_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() {},
|
||||||
@ -3780,11 +3810,13 @@
|
|||||||
return P._asyncStartSync($async$a_run, $async$completer);
|
return P._asyncStartSync($async$a_run, $async$completer);
|
||||||
},
|
},
|
||||||
main: function () {
|
main: function () {
|
||||||
var t1, t2, t3, t4, test_map, t5, tr, td, plist, pbody, p, a, i, b,
|
var reg_exp, 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;
|
||||||
@ -4024,6 +4056,17 @@
|
|||||||
$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;
|
||||||
},
|
},
|
||||||
@ -4492,6 +4535,11 @@
|
|||||||
},
|
},
|
||||||
$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);
|
||||||
@ -5188,6 +5236,16 @@
|
|||||||
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;
|
||||||
@ -5413,7 +5471,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.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(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(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);
|
||||||
|
@ -44,7 +44,6 @@ 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('@');
|
||||||
@ -60,7 +59,6 @@ List<String> test_list(String str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ["a", "b", "c"];
|
return ["a", "b", "c"];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
b_run() async {
|
b_run() async {
|
||||||
@ -70,7 +68,7 @@ b_run() async {
|
|||||||
print("object after 1s");
|
print("object after 1s");
|
||||||
}
|
}
|
||||||
|
|
||||||
md5run() async{
|
md5run() async {
|
||||||
print("object in md5run");
|
print("object in md5run");
|
||||||
await Future.delayed(Duration(milliseconds: 1000));
|
await Future.delayed(Duration(milliseconds: 1000));
|
||||||
print("object in md5run after 1s");
|
print("object in md5run after 1s");
|
||||||
@ -88,7 +86,7 @@ async_catch() async {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
a_run() async{
|
a_run() async {
|
||||||
print("object");
|
print("object");
|
||||||
await md5run();
|
await md5run();
|
||||||
await b_run();
|
await b_run();
|
||||||
@ -96,19 +94,22 @@ 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')!;
|
||||||
|
|
||||||
// Find an element by class (a-class).
|
// Find an element by class (a-class).
|
||||||
Element classElement = querySelector('.a-class')!;
|
Element classElement = querySelector('.a-class')!;
|
||||||
|
|
||||||
// Find all elements by tag (<div>).
|
// Find all elements by tag (<div>).
|
||||||
List<Element> divElements = querySelectorAll('div');
|
List<Element> divElements = querySelectorAll('div');
|
||||||
|
|
||||||
Map<String, int> test_map = {
|
Map<String, int> test_map = {
|
||||||
@ -197,4 +198,3 @@ void main() {
|
|||||||
closuer();
|
closuer();
|
||||||
print(a);
|
print(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1411,21 +1411,22 @@
|
|||||||
cT(a, b) {
|
cT(a, b) {
|
||||||
return a(b) || b
|
return a(b) || b
|
||||||
},
|
},
|
||||||
m7(a, b, c, d, e, f) {
|
js_synatax_regexp_make_native(source, multline, cast_sensitive, unicode, dot_all, global) {
|
||||||
var s = b ? "m" : "",
|
var s = multline ? "m" : "",
|
||||||
r = c ? "" : "i",
|
r = cast_sensitive ? "" : "i",
|
||||||
q = d ? "u" : "",
|
q = unicode ? "u" : "",
|
||||||
p = e ? "s" : "",
|
p = dot_all ? "s" : "",
|
||||||
o = f ? "g" : "",
|
o = global ? "g" : "",
|
||||||
n = function (g, h) {
|
n = function (source, modifiers) {
|
||||||
try {
|
try {
|
||||||
return new RegExp(g, h)
|
return new RegExp(source, modifiers)
|
||||||
} catch (m) {
|
} catch (e) {
|
||||||
return m
|
return e
|
||||||
}
|
}
|
||||||
}(a, s + r + q + p + o)
|
}(source, s + r + q + p + o)
|
||||||
if (n instanceof RegExp) return n
|
if (n instanceof RegExp)
|
||||||
throw H.h(P.jn("Illegal RegExp pattern (" + String(n) + ")", a, null))
|
return n;
|
||||||
|
throw H.h(P.jn("Illegal RegExp pattern (" + String(n) + ")", source, null))
|
||||||
},
|
},
|
||||||
iF(a, b, c) {
|
iF(a, b, c) {
|
||||||
var s
|
var s
|
||||||
@ -4182,7 +4183,7 @@
|
|||||||
return H.nZ(p)
|
return H.nZ(p)
|
||||||
},
|
},
|
||||||
h_(a) {
|
h_(a) {
|
||||||
return new H.ct(a, H.m7(a, !1, !0, !1, !1, !1))
|
return new H.ct(a, H.js_synatax_regexp_make_native(a, false, true, false, false, false))
|
||||||
},
|
},
|
||||||
o7(a, b, c) {
|
o7(a, b, c) {
|
||||||
var s = J.by(b)
|
var s = J.by(b)
|
||||||
@ -9324,14 +9325,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.m7(s.a, r.multiline, !r.ignoreCase, r.unicode, r.dotAll, !0)
|
return s.c = H.js_synatax_regexp_make_native(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.m7(s.a + "|()", r.multiline, !r.ignoreCase, r.unicode, r.dotAll, !0)
|
return s.d = H.js_synatax_regexp_make_native(s.a + "|()", r.multiline, !r.ignoreCase, r.unicode, r.dotAll, !0)
|
||||||
},
|
},
|
||||||
eU(a) {
|
eU(a) {
|
||||||
var s
|
var s
|
||||||
|
Loading…
Reference in New Issue
Block a user