|
@@ -925,6 +925,16 @@ module StdEReg = struct
|
|
|
end
|
|
|
)
|
|
|
|
|
|
+ let matchedNum = vifun0 (fun vthis ->
|
|
|
+ let this = this vthis in
|
|
|
+ if Array.length this.r_groups = 0 then
|
|
|
+ vint 0
|
|
|
+ else begin
|
|
|
+ let substrings = this.r_groups.(0) in
|
|
|
+ vint (num_of_subs substrings)
|
|
|
+ end
|
|
|
+ )
|
|
|
+
|
|
|
let replace = vifun2 (fun vthis s by ->
|
|
|
let this = this vthis in
|
|
|
let s = decode_string s in
|
|
@@ -1554,6 +1564,10 @@ module StdIntMap = struct
|
|
|
RuntimeIntHashtbl.clear (this vthis);
|
|
|
vnull
|
|
|
)
|
|
|
+
|
|
|
+ let size = vifun0 (fun vthis ->
|
|
|
+ vint (RuntimeIntHashtbl.size (this vthis))
|
|
|
+ )
|
|
|
end
|
|
|
|
|
|
module StdStringMap = struct
|
|
@@ -1613,6 +1627,10 @@ module StdStringMap = struct
|
|
|
RuntimeStringHashtbl.clear (this vthis);
|
|
|
vnull
|
|
|
)
|
|
|
+
|
|
|
+ let size = vifun0 (fun vthis ->
|
|
|
+ vint (RuntimeStringHashtbl.size (this vthis))
|
|
|
+ )
|
|
|
end
|
|
|
|
|
|
module StdObjectMap = struct
|
|
@@ -1671,6 +1689,10 @@ module StdObjectMap = struct
|
|
|
ValueHashtbl.reset (this vthis);
|
|
|
vnull
|
|
|
)
|
|
|
+
|
|
|
+ let size = vifun0 (fun vthis ->
|
|
|
+ vint (ValueHashtbl.length (this vthis))
|
|
|
+ )
|
|
|
end
|
|
|
|
|
|
let random = Random.State.make_self_init()
|
|
@@ -3205,6 +3227,7 @@ let init_maps builtins =
|
|
|
"set",StdIntMap.set;
|
|
|
"toString",StdIntMap.toString;
|
|
|
"clear",StdIntMap.clear;
|
|
|
+ "size",StdIntMap.size;
|
|
|
];
|
|
|
init_fields builtins (["haxe";"ds"],"ObjectMap") [] [
|
|
|
"copy",StdObjectMap.copy;
|
|
@@ -3217,6 +3240,7 @@ let init_maps builtins =
|
|
|
"set",StdObjectMap.set;
|
|
|
"toString",StdObjectMap.toString;
|
|
|
"clear",StdObjectMap.clear;
|
|
|
+ "size",StdObjectMap.size;
|
|
|
];
|
|
|
init_fields builtins (["haxe";"ds"],"StringMap") [] [
|
|
|
"copy",StdStringMap.copy;
|
|
@@ -3229,6 +3253,7 @@ let init_maps builtins =
|
|
|
"set",StdStringMap.set;
|
|
|
"toString",StdStringMap.toString;
|
|
|
"clear",StdStringMap.clear;
|
|
|
+ "size",StdStringMap.size;
|
|
|
]
|
|
|
|
|
|
let init_constructors builtins =
|
|
@@ -3500,6 +3525,7 @@ let init_standard_library builtins =
|
|
|
"matchedPos",StdEReg.matchedPos;
|
|
|
"matchedRight",StdEReg.matchedRight;
|
|
|
"matchSub",StdEReg.matchSub;
|
|
|
+ "matchedNum",StdEReg.matchedNum;
|
|
|
"replace",StdEReg.replace;
|
|
|
"split",StdEReg.split;
|
|
|
];
|