forked from riscv-collab/v8
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[intl] Implement ECMA402 PR500 Use OrdinaryHasInstance
Implement tc39/ecma402#500 For the legacy [optional] Unwrap*Format steps, use OrdinaryHasInstance instead of InstanceofOperator. ECMA402 agree w/ PR500 on 2021-1-14 Bug: v8:10981 Change-Id: Ic697aa245b11fecaf998127c009e59a821aaa01e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2444092 Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Reviewed-by: Shu-yu Guo <syg@chromium.org> Commit-Queue: Frank Tang <ftang@chromium.org> Cr-Commit-Position: refs/heads/master@{#72303}
- Loading branch information
1 parent
89ea6ca
commit c2795bd
Showing
5 changed files
with
44 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
test/intl/date-format/UnwrapDateTimeFormatUseOrdinaryHasInstance.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2020 the V8 project authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
// Verify ECMA402 PR 500 Use OrdinaryHasInstance in normative optional steps | ||
// https://github.com/tc39/ecma402/pull/500 | ||
|
||
Object.defineProperty(Intl.DateTimeFormat, Symbol.hasInstance, { | ||
get() { throw new Error("Intl.DateTimeFormat[@@hasInstance] lookup"); } | ||
}); | ||
|
||
var dtf; | ||
assertDoesNotThrow(() => dtf = new Intl.DateTimeFormat()); | ||
assertDoesNotThrow(() => dtf.format(new Date())); | ||
assertDoesNotThrow(() => dtf.resolvedOptions()); |
15 changes: 15 additions & 0 deletions
15
test/intl/number-format/UnwrapNumberFormatUseOrdinaryHasInstance.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2020 the V8 project authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
// Verify ECMA402 PR 500 Use OrdinaryHasInstance in normative optional steps | ||
// https://github.com/tc39/ecma402/pull/500 | ||
|
||
Object.defineProperty(Intl.NumberFormat, Symbol.hasInstance, { | ||
get() { throw new Error("Intl.NumberFormat[@@hasInstance] lookup"); } | ||
}); | ||
|
||
var nf; | ||
assertDoesNotThrow(() => nf = new Intl.NumberFormat()); | ||
assertDoesNotThrow(() => nf.format(123)); | ||
assertDoesNotThrow(() => nf.resolvedOptions()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters