swc_ecma_transforms_base/
native.rs

1//! Module to check if an identifier is native word.
2
3use phf::phf_set;
4
5macro_rules! native {
6    (
7        $(
8            $i:tt
9        ),*
10    ) => {
11
12        /// Is `sym` a native **class**?
13        pub fn is_native(sym: &str) -> bool {
14            static SET: phf::Set<&'static str> = phf_set! {
15                $(
16                    $i,
17                )*
18            };
19
20            SET.contains(sym)
21        }
22    };
23}
24
25native!(
26    "Array",
27    "ArrayBuffer",
28    "Atomics",
29    "BigInt",
30    "BigInt64Array",
31    "BigUint64Array",
32    "Boolean",
33    "DataView",
34    "Date",
35    "Error",
36    "EvalError",
37    "Float32Array",
38    "Float64Array",
39    "Function",
40    "Infinity",
41    "Int16Array",
42    "Int32Array",
43    "Int8Array",
44    "JSON",
45    "Map",
46    "Math",
47    "Number",
48    "Object",
49    "Promise",
50    "Proxy",
51    "RangeError",
52    "ReferenceError",
53    "Reflect",
54    "RegExp",
55    "Set",
56    "SharedArrayBuffer",
57    "String",
58    "Symbol",
59    "SyntaxError",
60    "TypeError",
61    "Uint16Array",
62    "Uint32Array",
63    "Uint8Array",
64    "Uint8ClampedArray",
65    "URIError",
66    "WeakMap",
67    "WeakSet",
68    "AbortController",
69    "AbortSignal",
70    "AnalyserNode",
71    "Animation",
72    "AnimationEffectReadOnly",
73    "AnimationEffectTiming",
74    "AnimationEffectTimingReadOnly",
75    "AnimationEvent",
76    "AnimationPlaybackEvent",
77    "AnimationTimeline",
78    "ApplicationCache",
79    "ApplicationCacheErrorEvent",
80    "Attr",
81    "Audio",
82    "AudioBuffer",
83    "AudioBufferSourceNode",
84    "AudioContext",
85    "AudioDestinationNode",
86    "AudioListener",
87    "AudioNode",
88    "AudioParam",
89    "AudioProcessingEvent",
90    "AudioScheduledSourceNode",
91    "AudioWorkletGlobalScope",
92    "AudioWorkletNode",
93    "AudioWorkletProcessor",
94    "BarProp",
95    "BaseAudioContext",
96    "BatteryManager",
97    "BeforeUnloadEvent",
98    "BiquadFilterNode",
99    "Blob",
100    "BlobEvent",
101    "BroadcastChannel",
102    "BudgetService",
103    "ByteLengthQueuingStrategy",
104    "Cache",
105    "CacheStorage",
106    "CanvasCaptureMediaStreamTrack",
107    "CanvasGradient",
108    "CanvasPattern",
109    "CanvasRenderingContext2D",
110    "ChannelMergerNode",
111    "ChannelSplitterNode",
112    "CharacterData",
113    "ClipboardEvent",
114    "CloseEvent",
115    "Comment",
116    "CompositionEvent",
117    "ConstantSourceNode",
118    "ConvolverNode",
119    "CountQueuingStrategy",
120    "Credential",
121    "CredentialsContainer",
122    "Crypto",
123    "CryptoKey",
124    "CSS",
125    "CSSConditionRule",
126    "CSSFontFaceRule",
127    "CSSGroupingRule",
128    "CSSImportRule",
129    "CSSKeyframeRule",
130    "CSSKeyframesRule",
131    "CSSMediaRule",
132    "CSSNamespaceRule",
133    "CSSPageRule",
134    "CSSRule",
135    "CSSRuleList",
136    "CSSStyleDeclaration",
137    "CSSStyleRule",
138    "CSSStyleSheet",
139    "CSSSupportsRule",
140    "CustomElementRegistry",
141    "CustomEvent",
142    "DataTransfer",
143    "DataTransferItem",
144    "DataTransferItemList",
145    "DelayNode",
146    "DeviceMotionEvent",
147    "DeviceOrientationEvent",
148    "Document",
149    "DocumentFragment",
150    "DocumentType",
151    "DOMError",
152    "DOMException",
153    "DOMImplementation",
154    "DOMMatrix",
155    "DOMMatrixReadOnly",
156    "DOMParser",
157    "DOMPoint",
158    "DOMPointReadOnly",
159    "DOMQuad",
160    "DOMRect",
161    "DOMRectReadOnly",
162    "DOMStringList",
163    "DOMStringMap",
164    "DOMTokenList",
165    "DragEvent",
166    "DynamicsCompressorNode",
167    "Element",
168    "ErrorEvent",
169    "Event",
170    "EventSource",
171    "EventTarget",
172    "File",
173    "FileList",
174    "FileReader",
175    "FocusEvent",
176    "FontFace",
177    "FontFaceSetLoadEvent",
178    "FormData",
179    "GainNode",
180    "Gamepad",
181    "GamepadButton",
182    "GamepadEvent",
183    "HashChangeEvent",
184    "Headers",
185    "History",
186    "HTMLAllCollection",
187    "HTMLAnchorElement",
188    "HTMLAreaElement",
189    "HTMLAudioElement",
190    "HTMLBaseElement",
191    "HTMLBodyElement",
192    "HTMLBRElement",
193    "HTMLButtonElement",
194    "HTMLCanvasElement",
195    "HTMLCollection",
196    "HTMLContentElement",
197    "HTMLDataElement",
198    "HTMLDataListElement",
199    "HTMLDetailsElement",
200    "HTMLDialogElement",
201    "HTMLDirectoryElement",
202    "HTMLDivElement",
203    "HTMLDListElement",
204    "HTMLDocument",
205    "HTMLElement",
206    "HTMLEmbedElement",
207    "HTMLFieldSetElement",
208    "HTMLFontElement",
209    "HTMLFormControlsCollection",
210    "HTMLFormElement",
211    "HTMLFrameElement",
212    "HTMLFrameSetElement",
213    "HTMLHeadElement",
214    "HTMLHeadingElement",
215    "HTMLHRElement",
216    "HTMLHtmlElement",
217    "HTMLIFrameElement",
218    "HTMLImageElement",
219    "HTMLInputElement",
220    "HTMLLabelElement",
221    "HTMLLegendElement",
222    "HTMLLIElement",
223    "HTMLLinkElement",
224    "HTMLMapElement",
225    "HTMLMarqueeElement",
226    "HTMLMediaElement",
227    "HTMLMenuElement",
228    "HTMLMetaElement",
229    "HTMLMeterElement",
230    "HTMLModElement",
231    "HTMLObjectElement",
232    "HTMLOListElement",
233    "HTMLOptGroupElement",
234    "HTMLOptionElement",
235    "HTMLOptionsCollection",
236    "HTMLOutputElement",
237    "HTMLParagraphElement",
238    "HTMLParamElement",
239    "HTMLPictureElement",
240    "HTMLPreElement",
241    "HTMLProgressElement",
242    "HTMLQuoteElement",
243    "HTMLScriptElement",
244    "HTMLSelectElement",
245    "HTMLShadowElement",
246    "HTMLSlotElement",
247    "HTMLSourceElement",
248    "HTMLSpanElement",
249    "HTMLStyleElement",
250    "HTMLTableCaptionElement",
251    "HTMLTableCellElement",
252    "HTMLTableColElement",
253    "HTMLTableElement",
254    "HTMLTableRowElement",
255    "HTMLTableSectionElement",
256    "HTMLTemplateElement",
257    "HTMLTextAreaElement",
258    "HTMLTimeElement",
259    "HTMLTitleElement",
260    "HTMLTrackElement",
261    "HTMLUListElement",
262    "HTMLUnknownElement",
263    "HTMLVideoElement",
264    "IDBCursor",
265    "IDBCursorWithValue",
266    "IDBDatabase",
267    "IDBFactory",
268    "IDBIndex",
269    "IDBKeyRange",
270    "IDBObjectStore",
271    "IDBOpenDBRequest",
272    "IDBRequest",
273    "IDBTransaction",
274    "IDBVersionChangeEvent",
275    "IdleDeadline",
276    "IIRFilterNode",
277    "Image",
278    "ImageBitmap",
279    "ImageBitmapRenderingContext",
280    "ImageCapture",
281    "ImageData",
282    "InputEvent",
283    "IntersectionObserver",
284    "IntersectionObserverEntry",
285    "Intl",
286    "KeyboardEvent",
287    "KeyframeEffect",
288    "KeyframeEffectReadOnly",
289    "Location",
290    "MediaDeviceInfo",
291    "MediaDevices",
292    "MediaElementAudioSourceNode",
293    "MediaEncryptedEvent",
294    "MediaError",
295    "MediaKeyMessageEvent",
296    "MediaKeySession",
297    "MediaKeyStatusMap",
298    "MediaKeySystemAccess",
299    "MediaList",
300    "MediaQueryList",
301    "MediaQueryListEvent",
302    "MediaRecorder",
303    "MediaSettingsRange",
304    "MediaSource",
305    "MediaStream",
306    "MediaStreamAudioDestinationNode",
307    "MediaStreamAudioSourceNode",
308    "MediaStreamEvent",
309    "MediaStreamTrack",
310    "MediaStreamTrackEvent",
311    "MessageChannel",
312    "MessageEvent",
313    "MessagePort",
314    "MIDIAccess",
315    "MIDIConnectionEvent",
316    "MIDIInput",
317    "MIDIInputMap",
318    "MIDIMessageEvent",
319    "MIDIOutput",
320    "MIDIOutputMap",
321    "MIDIPort",
322    "MimeType",
323    "MimeTypeArray",
324    "MouseEvent",
325    "MutationEvent",
326    "MutationObserver",
327    "MutationRecord",
328    "NamedNodeMap",
329    "NavigationPreloadManager",
330    "Navigator",
331    "NetworkInformation",
332    "Node",
333    "NodeFilter",
334    "NodeIterator",
335    "NodeList",
336    "Notification",
337    "OfflineAudioCompletionEvent",
338    "OfflineAudioContext",
339    "OffscreenCanvas",
340    "Option",
341    "OscillatorNode",
342    "PageTransitionEvent",
343    "PannerNode",
344    "Path2D",
345    "PaymentAddress",
346    "PaymentRequest",
347    "PaymentRequestUpdateEvent",
348    "PaymentResponse",
349    "Performance",
350    "PerformanceEntry",
351    "PerformanceLongTaskTiming",
352    "PerformanceMark",
353    "PerformanceMeasure",
354    "PerformanceNavigation",
355    "PerformanceNavigationTiming",
356    "PerformanceObserver",
357    "PerformanceObserverEntryList",
358    "PerformancePaintTiming",
359    "PerformanceResourceTiming",
360    "PerformanceTiming",
361    "PeriodicWave",
362    "Permissions",
363    "PermissionStatus",
364    "PhotoCapabilities",
365    "Plugin",
366    "PluginArray",
367    "PointerEvent",
368    "PopStateEvent",
369    "Presentation",
370    "PresentationAvailability",
371    "PresentationConnection",
372    "PresentationConnectionAvailableEvent",
373    "PresentationConnectionCloseEvent",
374    "PresentationConnectionList",
375    "PresentationReceiver",
376    "PresentationRequest",
377    "ProcessingInstruction",
378    "ProgressEvent",
379    "PromiseRejectionEvent",
380    "PushManager",
381    "PushSubscription",
382    "PushSubscriptionOptions",
383    "RadioNodeList",
384    "Range",
385    "ReadableStream",
386    "RemotePlayback",
387    "Request",
388    "ResizeObserver",
389    "ResizeObserverEntry",
390    "Response",
391    "RTCCertificate",
392    "RTCDataChannel",
393    "RTCDataChannelEvent",
394    "RTCDtlsTransport",
395    "RTCIceCandidate",
396    "RTCIceGatherer",
397    "RTCIceTransport",
398    "RTCPeerConnection",
399    "RTCPeerConnectionIceEvent",
400    "RTCRtpContributingSource",
401    "RTCRtpReceiver",
402    "RTCRtpSender",
403    "RTCSctpTransport",
404    "RTCSessionDescription",
405    "RTCStatsReport",
406    "RTCTrackEvent",
407    "Screen",
408    "ScreenOrientation",
409    "ScriptProcessorNode",
410    "SecurityPolicyViolationEvent",
411    "Selection",
412    "ServiceWorker",
413    "ServiceWorkerContainer",
414    "ServiceWorkerRegistration",
415    "ShadowRoot",
416    "SharedWorker",
417    "SourceBuffer",
418    "SourceBufferList",
419    "SpeechSynthesisEvent",
420    "SpeechSynthesisUtterance",
421    "StaticRange",
422    "StereoPannerNode",
423    "Storage",
424    "StorageEvent",
425    "StorageManager",
426    "StyleSheet",
427    "StyleSheetList",
428    "SubtleCrypto",
429    "SVGAElement",
430    "SVGAngle",
431    "SVGAnimatedAngle",
432    "SVGAnimatedBoolean",
433    "SVGAnimatedEnumeration",
434    "SVGAnimatedInteger",
435    "SVGAnimatedLength",
436    "SVGAnimatedLengthList",
437    "SVGAnimatedNumber",
438    "SVGAnimatedNumberList",
439    "SVGAnimatedPreserveAspectRatio",
440    "SVGAnimatedRect",
441    "SVGAnimatedString",
442    "SVGAnimatedTransformList",
443    "SVGAnimateElement",
444    "SVGAnimateMotionElement",
445    "SVGAnimateTransformElement",
446    "SVGAnimationElement",
447    "SVGCircleElement",
448    "SVGClipPathElement",
449    "SVGComponentTransferFunctionElement",
450    "SVGDefsElement",
451    "SVGDescElement",
452    "SVGDiscardElement",
453    "SVGElement",
454    "SVGEllipseElement",
455    "SVGFEBlendElement",
456    "SVGFEColorMatrixElement",
457    "SVGFEComponentTransferElement",
458    "SVGFECompositeElement",
459    "SVGFEConvolveMatrixElement",
460    "SVGFEDiffuseLightingElement",
461    "SVGFEDisplacementMapElement",
462    "SVGFEDistantLightElement",
463    "SVGFEDropShadowElement",
464    "SVGFEFloodElement",
465    "SVGFEFuncAElement",
466    "SVGFEFuncBElement",
467    "SVGFEFuncGElement",
468    "SVGFEFuncRElement",
469    "SVGFEGaussianBlurElement",
470    "SVGFEImageElement",
471    "SVGFEMergeElement",
472    "SVGFEMergeNodeElement",
473    "SVGFEMorphologyElement",
474    "SVGFEOffsetElement",
475    "SVGFEPointLightElement",
476    "SVGFESpecularLightingElement",
477    "SVGFESpotLightElement",
478    "SVGFETileElement",
479    "SVGFETurbulenceElement",
480    "SVGFilterElement",
481    "SVGForeignObjectElement",
482    "SVGGElement",
483    "SVGGeometryElement",
484    "SVGGradientElement",
485    "SVGGraphicsElement",
486    "SVGImageElement",
487    "SVGLength",
488    "SVGLengthList",
489    "SVGLinearGradientElement",
490    "SVGLineElement",
491    "SVGMarkerElement",
492    "SVGMaskElement",
493    "SVGMatrix",
494    "SVGMetadataElement",
495    "SVGMPathElement",
496    "SVGNumber",
497    "SVGNumberList",
498    "SVGPathElement",
499    "SVGPatternElement",
500    "SVGPoint",
501    "SVGPointList",
502    "SVGPolygonElement",
503    "SVGPolylineElement",
504    "SVGPreserveAspectRatio",
505    "SVGRadialGradientElement",
506    "SVGRect",
507    "SVGRectElement",
508    "SVGScriptElement",
509    "SVGSetElement",
510    "SVGStopElement",
511    "SVGStringList",
512    "SVGStyleElement",
513    "SVGSVGElement",
514    "SVGSwitchElement",
515    "SVGSymbolElement",
516    "SVGTextContentElement",
517    "SVGTextElement",
518    "SVGTextPathElement",
519    "SVGTextPositioningElement",
520    "SVGTitleElement",
521    "SVGTransform",
522    "SVGTransformList",
523    "SVGTSpanElement",
524    "SVGUnitTypes",
525    "SVGUseElement",
526    "SVGViewElement",
527    "TaskAttributionTiming",
528    "Text",
529    "TextDecoder",
530    "TextEncoder",
531    "TextEvent",
532    "TextMetrics",
533    "TextTrack",
534    "TextTrackCue",
535    "TextTrackCueList",
536    "TextTrackList",
537    "TimeRanges",
538    "Touch",
539    "TouchEvent",
540    "TouchList",
541    "TrackEvent",
542    "TransitionEvent",
543    "TreeWalker",
544    "UIEvent",
545    "URL",
546    "URLSearchParams",
547    "ValidityState",
548    "VisualViewport",
549    "VTTCue",
550    "WaveShaperNode",
551    "WebAssembly",
552    "WebGL2RenderingContext",
553    "WebGLActiveInfo",
554    "WebGLBuffer",
555    "WebGLContextEvent",
556    "WebGLFramebuffer",
557    "WebGLProgram",
558    "WebGLQuery",
559    "WebGLRenderbuffer",
560    "WebGLRenderingContext",
561    "WebGLSampler",
562    "WebGLShader",
563    "WebGLShaderPrecisionFormat",
564    "WebGLSync",
565    "WebGLTexture",
566    "WebGLTransformFeedback",
567    "WebGLUniformLocation",
568    "WebGLVertexArrayObject",
569    "WebSocket",
570    "WheelEvent",
571    "Window",
572    "Worker",
573    "WritableStream",
574    "XMLDocument",
575    "XMLHttpRequest",
576    "XMLHttpRequestEventTarget",
577    "XMLHttpRequestUpload",
578    "XMLSerializer",
579    "XPathEvaluator",
580    "XPathExpression",
581    "XPathResult",
582    "XSLTProcessor"
583);