mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-29 01:34:29 +01:00
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:
13 files changed
+3004
-31
No files matched your search
@@ -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",
|
||||
|
||||
@@ -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!(
|
||||
|
||||
Reference in new issue
Block a user