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

GetIntrinsic: remove from PlainDate, add monkeypatching test #105

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ tsc-out/
.vscode/*
!.vscode/launch.json
*.tgz
.DS_Store
6 changes: 1 addition & 5 deletions lib/calendar.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { DEBUG } from './debug';
import * as ES from './ecmascript';
import { GetIntrinsic, MakeIntrinsicClass, DefineIntrinsic } from './intrinsicclass';
import {
CALENDAR_ID,
ISO_YEAR,
Expand Down Expand Up @@ -28,6 +27,7 @@ import type {
CalendarReturn as Return,
FieldRecord
} from './internaltypes';
import { Duration } from './duration';

const ArrayIncludes = Array.prototype.includes;
const ArrayPrototypePush = Array.prototype.push;
Expand Down Expand Up @@ -244,7 +244,6 @@ export class Calendar implements Temporal.Calendar {
'day'
);
const { years, months, weeks, days } = impl[GetSlot(this, CALENDAR_ID)].dateUntil(one, two, largestUnit);
const Duration = GetIntrinsic('%Temporal.Duration%');
return new Duration(years, months, weeks, days, 0, 0, 0, 0, 0, 0);
}
year(dateParam: Params['year'][0]): Return['year'] {
Expand Down Expand Up @@ -344,9 +343,6 @@ export class Calendar implements Temporal.Calendar {
[Symbol.toStringTag]!: 'Temporal.Calendar';
}

MakeIntrinsicClass(Calendar, 'Temporal.Calendar');
DefineIntrinsic('Temporal.Calendar.from', Calendar.from);

/**
* Implementation for the ISO 8601 calendar. This is the only calendar that's
* guaranteed to be supported by all ECMAScript implementations, including those
Expand Down
3 changes: 0 additions & 3 deletions lib/duration.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { DEBUG } from './debug';
import * as ES from './ecmascript';
import { MakeIntrinsicClass } from './intrinsicclass';
import {
YEARS,
MONTHS,
Expand Down Expand Up @@ -452,5 +451,3 @@ export class Duration implements Temporal.Duration {
}
[Symbol.toStringTag]!: 'Temporal.Duration';
}

MakeIntrinsicClass(Duration, 'Temporal.Duration');
Loading