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 more known globals #4886

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
49 changes: 25 additions & 24 deletions src/ast/nodes/shared/knownGlobals.ts
Expand Up @@ -104,6 +104,7 @@ const knownGlobals: GlobalDescription = {
// Common globals
__proto__: null,
[ValueProperties]: IMPURE,
AggregateError: PC,
Array: {
__proto__: null,
[ValueProperties]: IMPURE,
Expand Down Expand Up @@ -214,7 +215,9 @@ const knownGlobals: GlobalDescription = {
// deoptimizes everything anyway
defineProperty: MUTATES_ARG_WITHOUT_ACCESSOR,
defineProperties: MUTATES_ARG_WITHOUT_ACCESSOR,
entries: PF,
freeze: MUTATES_ARG_WITHOUT_ACCESSOR,
fromEntries: PF,
getOwnPropertyDescriptor: PF,
getOwnPropertyDescriptors: PF,
getOwnPropertyNames: PF,
Expand All @@ -226,8 +229,6 @@ const knownGlobals: GlobalDescription = {
isFrozen: PF,
isSealed: PF,
keys: PF,
fromEntries: PF,
entries: PF,
prototype: O
},
parseFloat: PF,
Expand Down Expand Up @@ -289,30 +290,10 @@ const knownGlobals: GlobalDescription = {
URIError: PC,
valueOf: O,
WeakMap: PC,
WeakRef: PC,
WeakSet: PC,

// Additional globals shared by Node and Browser that are not strictly part of the language
clearInterval: C,
clearTimeout: C,
console: O,
Intl: {
__proto__: null,
[ValueProperties]: IMPURE,
Collator: INTL_MEMBER,
DateTimeFormat: INTL_MEMBER,
ListFormat: INTL_MEMBER,
NumberFormat: INTL_MEMBER,
PluralRules: INTL_MEMBER,
RelativeTimeFormat: INTL_MEMBER
},
setInterval: C,
setTimeout: C,
TextDecoder: C,
TextEncoder: C,
URL: C,
URLSearchParams: C,

// Browser specific globals
// Web API globals shared by Browsers, Node.js, WinterCG (Cloudflare Workers, Deno and others)
AbortController: C,
AbortSignal: C,
addEventListener: O,
Expand Down Expand Up @@ -359,6 +340,8 @@ const knownGlobals: GlobalDescription = {
ChannelMergerNode: C,
ChannelSplitterNode: C,
CharacterData: C,
clearInterval: C,
clearTimeout: C,
clientInformation: O,
ClipboardEvent: C,
close: O,
Expand All @@ -367,6 +350,7 @@ const knownGlobals: GlobalDescription = {
Comment: C,
CompositionEvent: C,
confirm: O,
console: O,
ConstantSourceNode: C,
ConvolverNode: C,
CountQueuingStrategy: C,
Expand Down Expand Up @@ -554,6 +538,16 @@ const knownGlobals: GlobalDescription = {
InputEvent: C,
IntersectionObserver: C,
IntersectionObserverEntry: C,
Intl: {
__proto__: null,
[ValueProperties]: IMPURE,
Collator: INTL_MEMBER,
DateTimeFormat: INTL_MEMBER,
ListFormat: INTL_MEMBER,
NumberFormat: INTL_MEMBER,
PluralRules: INTL_MEMBER,
RelativeTimeFormat: INTL_MEMBER
},
isSecureContext: O,
KeyboardEvent: C,
KeyframeEffect: C,
Expand Down Expand Up @@ -723,6 +717,8 @@ const knownGlobals: GlobalDescription = {
ServiceWorkerContainer: C,
ServiceWorkerRegistration: C,
sessionStorage: O,
setInterval: C,
setTimeout: C,
ShadowRoot: C,
SharedWorker: C,
SourceBuffer: C,
Expand Down Expand Up @@ -858,6 +854,11 @@ const knownGlobals: GlobalDescription = {
TransitionEvent: C,
TreeWalker: C,
UIEvent: C,
URL: C,
URLPattern: C,
URLSearchParams: C,
TextDecoder: C,
TextEncoder: C,
ValidityState: C,
visualViewport: O,
VisualViewport: C,
Expand Down