Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add spec edition 15 to the tester #3957

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions tests/tester/src/edition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,12 @@ static FEATURE_EDITION: phf::Map<&'static str, SpecEdition> = phf::phf_map! {
// https://github.com/tc39/proposal-atomics-microwait
"Atomics.pause" => SpecEdition::ESNext,

// Part of the next ES15 edition
"Atomics.waitAsync" => SpecEdition::ESNext,
"regexp-v-flag" => SpecEdition::ESNext,
"String.prototype.isWellFormed" => SpecEdition::ESNext,
"String.prototype.toWellFormed" => SpecEdition::ESNext,
"resizable-arraybuffer" => SpecEdition::ESNext,
"promise-with-resolvers" => SpecEdition::ESNext,
"array-grouping" => SpecEdition::ESNext,
"set-methods" => SpecEdition::ESNext,

// Standard language features
"AggregateError" => SpecEdition::ES12,
"Atomics.waitAsync" => SpecEdition::ES15,
"align-detached-buffer-semantics-with-web-reality" => SpecEdition::ES12,
"arbitrary-module-namespace-names" => SpecEdition::ES13,
"array-grouping" => SpecEdition::ES15,
"ArrayBuffer" => SpecEdition::ES6,
"array-find-from-last" => SpecEdition::ES14,
"Array.prototype.at" => SpecEdition::ES13,
Expand Down Expand Up @@ -216,6 +208,7 @@ static FEATURE_EDITION: phf::Map<&'static str, SpecEdition> = phf::phf_map! {
"Promise.any" => SpecEdition::ES12,
"Promise.prototype.finally" => SpecEdition::ES9,
"Proxy" => SpecEdition::ES6,
"promise-with-resolvers" => SpecEdition::ES15,
"proxy-missing-checks" => SpecEdition::ES6,
"Reflect" => SpecEdition::ES6,
"Reflect.construct" => SpecEdition::ES6,
Expand All @@ -226,6 +219,8 @@ static FEATURE_EDITION: phf::Map<&'static str, SpecEdition> = phf::phf_map! {
"regexp-match-indices" => SpecEdition::ES13,
"regexp-named-groups" => SpecEdition::ES9,
"regexp-unicode-property-escapes" => SpecEdition::ES9,
"regexp-v-flag" => SpecEdition::ES15,
"resizable-arraybuffer" => SpecEdition::ES15,
"rest-parameters" => SpecEdition::ES6,
"Set" => SpecEdition::ES6,
"SharedArrayBuffer" => SpecEdition::ES8,
Expand All @@ -234,10 +229,13 @@ static FEATURE_EDITION: phf::Map<&'static str, SpecEdition> = phf::phf_map! {
"String.prototype.at" => SpecEdition::ES13,
"String.prototype.endsWith" => SpecEdition::ES6,
"String.prototype.includes" => SpecEdition::ES6,
"String.prototype.isWellFormed" => SpecEdition::ES15,
"String.prototype.matchAll" => SpecEdition::ES11,
"String.prototype.replaceAll" => SpecEdition::ES12,
"String.prototype.toWellFormed" => SpecEdition::ES15,
"String.prototype.trimEnd" => SpecEdition::ES10,
"String.prototype.trimStart" => SpecEdition::ES10,
"set-methods" => SpecEdition::ES15,
"super" => SpecEdition::ES6,
"Symbol" => SpecEdition::ES6,
"symbols-as-weakmap-keys" => SpecEdition::ES14,
Expand Down Expand Up @@ -335,6 +333,10 @@ pub(crate) enum SpecEdition {
///
/// <https://262.ecma-international.org/14.0>
ES14,
/// ECMAScript 15th Edition
///
/// <https://262.ecma-international.org/15.0>
ES15,
/// The edition being worked on right now.
///
/// A draft is currently available [here](https://tc39.es/ecma262).
Expand Down Expand Up @@ -398,6 +400,7 @@ impl SpecEdition {
Self::ES12,
Self::ES13,
Self::ES14,
Self::ES15,
Self::ESNext,
]
.into_iter()
Expand Down
10 changes: 10 additions & 0 deletions tests/tester/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ struct VersionedStats {
es12: Statistics,
es13: Statistics,
es14: Statistics,
es15: Statistics,
}

impl<'de> Deserialize<'de> for VersionedStats {
Expand All @@ -626,6 +627,8 @@ impl<'de> Deserialize<'de> for VersionedStats {
es13: Statistics,
#[serde(default)]
es14: Option<Statistics>,
#[serde(default)]
es15: Option<Statistics>,
}

let inner = Inner::deserialize(deserializer)?;
Expand All @@ -641,8 +644,10 @@ impl<'de> Deserialize<'de> for VersionedStats {
es12,
es13,
es14,
es15,
} = inner;
let es14 = es14.unwrap_or(es13);
let es15 = es15.unwrap_or(es14);

Ok(Self {
es5,
Expand All @@ -655,6 +660,7 @@ impl<'de> Deserialize<'de> for VersionedStats {
es12,
es13,
es14,
es15,
})
}
}
Expand Down Expand Up @@ -684,6 +690,7 @@ impl VersionedStats {
SpecEdition::ES12 => self.es12,
SpecEdition::ES13 => self.es13,
SpecEdition::ES14 => self.es14,
SpecEdition::ES15 => self.es15,
SpecEdition::ESNext => return None,
};
Some(stats)
Expand All @@ -703,6 +710,7 @@ impl VersionedStats {
SpecEdition::ES12 => &mut self.es12,
SpecEdition::ES13 => &mut self.es13,
SpecEdition::ES14 => &mut self.es14,
SpecEdition::ES15 => &mut self.es15,
SpecEdition::ESNext => return None,
};
Some(stats)
Expand All @@ -724,6 +732,7 @@ impl Add for VersionedStats {
es12: self.es12 + rhs.es12,
es13: self.es13 + rhs.es13,
es14: self.es14 + rhs.es14,
es15: self.es15 + rhs.es15,
}
}
}
Expand All @@ -740,6 +749,7 @@ impl AddAssign for VersionedStats {
self.es12 += rhs.es12;
self.es13 += rhs.es13;
self.es14 += rhs.es14;
self.es15 += rhs.es15;
}
}

Expand Down
Loading