Merge pull request #9072 from dotCooCoo/feat/js-es2015-collections-typed-arrays

JavaScript: ES2015 realms have Map, Set, WeakMap, WeakSet and typed arrays
This commit is contained in:
.CooCoo authored and GitHub committed 2026-11-27 23:55:19 -08:00
commit bbefa3c8e3
13 files changed
+3004 -31

No files matched your search

+18 -2
View File
@@ -92,8 +92,9 @@ pub(crate) const APP_METHODS: &[&str] = &["executeMenuCommand", "doScript", "loa
/// Text an action set written out at run time holds.
pub(crate) const ACTION_TEXT: &str = "/actionCount";
/// Constructors of the language (ECMA-262 3rd edition, section 15) and of E4X (ECMA-357 2nd edition,
/// section 13), and the platform's own: `new` of these is no document-model type.
/// Constructors of the language (ECMA-262 3rd edition, section 15, and the collections and binary
/// data of the 6th edition, sections 22.2 to 24.2) and of E4X (ECMA-357 2nd edition, section 13), and
/// the platform's own: `new` of these is no document-model type.
pub(crate) const CONSTRUCTORS: &[&str] = &[
"Object",
"Function",
@@ -110,6 +111,21 @@ pub(crate) const CONSTRUCTORS: &[&str] = &[
"SyntaxError",
"TypeError",
"URIError",
"Map",
"Set",
"WeakMap",
"WeakSet",
"ArrayBuffer",
"DataView",
"Int8Array",
"Uint8Array",
"Uint8ClampedArray",
"Int16Array",
"Uint16Array",
"Int32Array",
"Uint32Array",
"Float32Array",
"Float64Array",
"Namespace",
"QName",
"XML",
+11
View File
@@ -1615,6 +1615,17 @@ fn type_names_compared_or_created_are_listed() {
assert_eq!(r.needs, [Need::Dom]);
}
#[test]
fn collections_and_typed_arrays_are_not_type_names() {
let r = report(concat!(
"var m = new Map(), s = new Set(), wm = new WeakMap(), ws = new WeakSet();\n",
"var b = new ArrayBuffer(8), v = new DataView(b), u = new Uint8Array(b), c = new Uint8ClampedArray(2);\n",
"var i = [new Int8Array(1), new Int16Array(1), new Uint16Array(1), new Int32Array(1), new Uint32Array(1)];\n",
"var f = [new Float32Array(1), new Float64Array(1)];\n",
));
assert!(r.types.is_empty(), "{:?}", r.types.iter().map(|t| t.name.as_str()).collect::<Vec<_>>());
}
#[test]
fn menu_commands_are_counted_with_their_lines() {
let r = report(concat!(