From d6155b6ef2096813d1af8d0ffdb51339e4cb99ad Mon Sep 17 00:00:00 2001 From: Peter Hoddie Date: Sat, 21 Sep 2024 17:51:42 -0700 Subject: [PATCH] add verifyPrimordialProperty --- harness/propertyHelper.js | 8 ++++++++ tools/lint/lib/checks/harness.py | 2 ++ tools/lint/test/fixtures/harness/propertyHelper.js | 8 ++++++++ 3 files changed, 18 insertions(+) diff --git a/harness/propertyHelper.js b/harness/propertyHelper.js index 8dbed5aee6..5637454b5f 100644 --- a/harness/propertyHelper.js +++ b/harness/propertyHelper.js @@ -13,6 +13,7 @@ defines: - verifyNotEnumerable # deprecated - verifyConfigurable # deprecated - verifyNotConfigurable # deprecated + - verifyPrimordialProperty ---*/ // @ts-check @@ -280,3 +281,10 @@ function verifyNotConfigurable(obj, name) { throw new Test262Error("Expected obj[" + String(name) + "] NOT to be configurable, but was."); } } + +/** + * Use this function to verify the properties of a primordial object. + * For non-primordial objects, use verifyProperty. + * See: https://github.com/tc39/how-we-work/blob/main/terminology.md#primordial + */ +var verifyPrimordialProperty = verifyProperty; diff --git a/tools/lint/lib/checks/harness.py b/tools/lint/lib/checks/harness.py index 9c77013ab4..c885182da7 100644 --- a/tools/lint/lib/checks/harness.py +++ b/tools/lint/lib/checks/harness.py @@ -9,5 +9,7 @@ class CheckHarness(Check): def run(self, name, meta, source): if 'verifyConfigurable(' in source and 'verifyProperty(' in source: return 'verifyConfigurable & verifyProperty may not be used in the same file' + elif 'verifyConfigurable(' in source and 'verifyPrimordialProperty(' in source: + return 'verifyConfigurable & verifyPrimordialProperty may not be used in the same file' else: return diff --git a/tools/lint/test/fixtures/harness/propertyHelper.js b/tools/lint/test/fixtures/harness/propertyHelper.js index 2b8776d72d..a74855a141 100644 --- a/tools/lint/test/fixtures/harness/propertyHelper.js +++ b/tools/lint/test/fixtures/harness/propertyHelper.js @@ -13,6 +13,7 @@ defines: - verifyNotEnumerable - verifyConfigurable - verifyNotConfigurable + - verifyPrimordialProperty ---*/ // @ts-check @@ -227,3 +228,10 @@ function verifyNotConfigurable(obj, name) { throw new Test262Error("Expected obj[" + String(name) + "] NOT to be configurable, but was."); } } + +/** + * Use this function to verify the properties of a primordial object. + * For non-primordial objects, use verifyProperty. + * See: https://github.com/tc39/how-we-work/blob/main/terminology.md#primordial + */ +var verifyPrimordialProperty = verifyProperty;