CommonPropertyNames.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. /*
  2. * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/DeprecatedFlyString.h>
  8. #include <LibJS/Forward.h>
  9. #include <LibJS/Runtime/PropertyKey.h>
  10. namespace JS {
  11. #define ENUMERATE_STANDARD_PROPERTY_NAMES(P) \
  12. P(__proto__) \
  13. P(__defineGetter__) \
  14. P(__defineSetter__) \
  15. P(__lookupGetter__) \
  16. P(__lookupSetter__) \
  17. P($1) \
  18. P($2) \
  19. P($3) \
  20. P($4) \
  21. P($5) \
  22. P($6) \
  23. P($7) \
  24. P($8) \
  25. P($9) \
  26. P(Atomics) \
  27. P(BYTES_PER_ELEMENT) \
  28. P(BigInt) \
  29. P(Boolean) \
  30. P(E) \
  31. P(EPSILON) \
  32. P(Function) \
  33. P(Infinity) \
  34. P(Intl) \
  35. P(JSON) \
  36. P(LN10) \
  37. P(LN2) \
  38. P(LOG10E) \
  39. P(LOG2E) \
  40. P(MAX_SAFE_INTEGER) \
  41. P(MAX_VALUE) \
  42. P(MIN_SAFE_INTEGER) \
  43. P(MIN_VALUE) \
  44. P(Math) \
  45. P(NEGATIVE_INFINITY) \
  46. P(NaN) \
  47. P(Now) \
  48. P(Number) \
  49. P(PI) \
  50. P(POSITIVE_INFINITY) \
  51. P(Proxy) \
  52. P(Reflect) \
  53. P(RegExp) \
  54. P(SQRT1_2) \
  55. P(SQRT2) \
  56. P(String) \
  57. P(Symbol) \
  58. P(Temporal) \
  59. P(UTC) \
  60. P(abs) \
  61. P(acos) \
  62. P(acosh) \
  63. P(add) \
  64. P(adopt) \
  65. P(all) \
  66. P(allSettled) \
  67. P(anchor) \
  68. P(any) \
  69. P(apply) \
  70. P(arguments) \
  71. P(asIntN) \
  72. P(asUintN) \
  73. P(asin) \
  74. P(asinh) \
  75. P(assert) \
  76. P(assign) \
  77. P(at) \
  78. P(atan) \
  79. P(atan2) \
  80. P(atanh) \
  81. P(baseName) \
  82. P(big) \
  83. P(bind) \
  84. P(blank) \
  85. P(blink) \
  86. P(bold) \
  87. P(buffer) \
  88. P(byteLength) \
  89. P(byteOffset) \
  90. P(calendar) \
  91. P(calendarName) \
  92. P(calendars) \
  93. P(call) \
  94. P(callee) \
  95. P(caller) \
  96. P(caseFirst) \
  97. P(cause) \
  98. P(cbrt) \
  99. P(ceil) \
  100. P(charAt) \
  101. P(charCodeAt) \
  102. P(cleanupSome) \
  103. P(clear) \
  104. P(clz32) \
  105. P(codePointAt) \
  106. P(collation) \
  107. P(collations) \
  108. P(compactDisplay) \
  109. P(compareExchange) \
  110. P(compile) \
  111. P(concat) \
  112. P(configurable) \
  113. P(console) \
  114. P(construct) \
  115. P(constructor) \
  116. P(containing) \
  117. P(compare) \
  118. P(copyWithin) \
  119. P(cos) \
  120. P(cosh) \
  121. P(count) \
  122. P(countReset) \
  123. P(create) \
  124. P(currency) \
  125. P(currencyDisplay) \
  126. P(currencySign) \
  127. P(dateAdd) \
  128. P(dateFromFields) \
  129. P(dateStyle) \
  130. P(dateUntil) \
  131. P(day) \
  132. P(dayOfWeek) \
  133. P(dayOfYear) \
  134. P(dayPeriod) \
  135. P(days) \
  136. P(daysDisplay) \
  137. P(daysInMonth) \
  138. P(daysInWeek) \
  139. P(daysInYear) \
  140. P(debug) \
  141. P(decodeURI) \
  142. P(decodeURIComponent) \
  143. P(defer) \
  144. P(defineProperties) \
  145. P(defineProperty) \
  146. P(deleteProperty) \
  147. P(deref) \
  148. P(description) \
  149. P(detached) \
  150. P(difference) \
  151. P(dir) \
  152. P(direction) \
  153. P(disambiguation) \
  154. P(disposed) \
  155. P(done) \
  156. P(dotAll) \
  157. P(drop) \
  158. P(encodeURI) \
  159. P(encodeURIComponent) \
  160. P(endsWith) \
  161. P(entries) \
  162. P(enumerable) \
  163. P(epochMicroseconds) \
  164. P(epochMilliseconds) \
  165. P(epochNanoseconds) \
  166. P(epochSeconds) \
  167. P(equals) \
  168. P(era) \
  169. P(eraYear) \
  170. P(error) \
  171. P(errors) \
  172. P(escape) \
  173. P(eval) \
  174. P(evaluate) \
  175. P(every) \
  176. P(exchange) \
  177. P(exec) \
  178. P(exp) \
  179. P(expm1) \
  180. P(fallback) \
  181. P(fields) \
  182. P(fill) \
  183. P(filter) \
  184. P(finally) \
  185. P(find) \
  186. P(findLast) \
  187. P(findLastIndex) \
  188. P(findIndex) \
  189. P(firstDay) \
  190. P(fixed) \
  191. P(flags) \
  192. P(flat) \
  193. P(flatMap) \
  194. P(floor) \
  195. P(fontcolor) \
  196. P(fontsize) \
  197. P(forEach) \
  198. P(format) \
  199. P(formatMatcher) \
  200. P(formatRange) \
  201. P(formatRangeToParts) \
  202. P(formatToParts) \
  203. P(fractionalDigits) \
  204. P(fractionalSecondDigits) \
  205. P(freeze) \
  206. P(from) \
  207. P(fromAsync) \
  208. P(fromCharCode) \
  209. P(fromCodePoint) \
  210. P(fromEntries) \
  211. P(fromEpochMicroseconds) \
  212. P(fromEpochMilliseconds) \
  213. P(fromEpochNanoseconds) \
  214. P(fromEpochSeconds) \
  215. P(fround) \
  216. P(gc) \
  217. P(get) \
  218. P(getBigInt64) \
  219. P(getBigUint64) \
  220. P(getCanonicalLocales) \
  221. P(getDate) \
  222. P(getDay) \
  223. P(getFloat32) \
  224. P(getFloat64) \
  225. P(getFullYear) \
  226. P(getHours) \
  227. P(getInstantFor) \
  228. P(getInt8) \
  229. P(getInt16) \
  230. P(getInt32) \
  231. P(getISOFields) \
  232. P(getMilliseconds) \
  233. P(getMinutes) \
  234. P(getMonth) \
  235. P(getNextTransition) \
  236. P(getOffsetNanosecondsFor) \
  237. P(getOffsetStringFor) \
  238. P(getOwnPropertyDescriptor) \
  239. P(getOwnPropertyDescriptors) \
  240. P(getOwnPropertyNames) \
  241. P(getOwnPropertySymbols) \
  242. P(getPlainDateTimeFor) \
  243. P(getPossibleInstantsFor) \
  244. P(getPreviousTransition) \
  245. P(getPrototypeOf) \
  246. P(getSeconds) \
  247. P(getTime) \
  248. P(getTimezoneOffset) \
  249. P(getUint8) \
  250. P(getUint16) \
  251. P(getUint32) \
  252. P(getUTCDate) \
  253. P(getUTCDay) \
  254. P(getUTCFullYear) \
  255. P(getUTCHours) \
  256. P(getUTCMilliseconds) \
  257. P(getUTCMinutes) \
  258. P(getUTCMonth) \
  259. P(getUTCSeconds) \
  260. P(getYear) \
  261. P(global) \
  262. P(globalThis) \
  263. P(granularity) \
  264. P(group) \
  265. P(groupBy) \
  266. P(groupCollapsed) \
  267. P(groupEnd) \
  268. P(groups) \
  269. P(has) \
  270. P(hasIndices) \
  271. P(hasOwn) \
  272. P(hasOwnProperty) \
  273. P(hour) \
  274. P(hour12) \
  275. P(hourCycle) \
  276. P(hourCycles) \
  277. P(hours) \
  278. P(hoursDisplay) \
  279. P(hoursInDay) \
  280. P(hypot) \
  281. P(id) \
  282. P(ignoreCase) \
  283. P(ignorePunctuation) \
  284. P(imul) \
  285. P(importValue) \
  286. P(includes) \
  287. P(index) \
  288. P(indexOf) \
  289. P(indices) \
  290. P(info) \
  291. P(inLeapYear) \
  292. P(input) \
  293. P(instant) \
  294. P(intersection) \
  295. P(is) \
  296. P(isArray) \
  297. P(isDisjointFrom) \
  298. P(isExtensible) \
  299. P(isFinite) \
  300. P(isFrozen) \
  301. P(isInteger) \
  302. P(isLockFree) \
  303. P(isNaN) \
  304. P(isPrototypeOf) \
  305. P(isSafeInteger) \
  306. P(isSealed) \
  307. P(isSubsetOf) \
  308. P(isSupersetOf) \
  309. P(isView) \
  310. P(isoDay) \
  311. P(isoHour) \
  312. P(isoMicrosecond) \
  313. P(isoMillisecond) \
  314. P(isoMinute) \
  315. P(isoMonth) \
  316. P(isoNanosecond) \
  317. P(isoSecond) \
  318. P(isoYear) \
  319. P(isWellFormed) \
  320. P(isWordLike) \
  321. P(italics) \
  322. P(join) \
  323. P(keyFor) \
  324. P(keys) \
  325. P(language) \
  326. P(languageDisplay) \
  327. P(largestUnit) \
  328. P(lastIndex) \
  329. P(lastIndexOf) \
  330. P(length) \
  331. P(link) \
  332. P(load) \
  333. P(locale) \
  334. P(localeCompare) \
  335. P(localeMatcher) \
  336. P(log) \
  337. P(log1p) \
  338. P(log2) \
  339. P(log10) \
  340. P(lastMatch) \
  341. P(lastParen) \
  342. P(leftContext) \
  343. P(map) \
  344. P(max) \
  345. P(maximize) \
  346. P(mergeFields) \
  347. P(message) \
  348. P(microsecond) \
  349. P(microseconds) \
  350. P(microsecondsDisplay) \
  351. P(millisecond) \
  352. P(milliseconds) \
  353. P(millisecondsDisplay) \
  354. P(min) \
  355. P(minimalDays) \
  356. P(minimize) \
  357. P(maximumFractionDigits) \
  358. P(maximumSignificantDigits) \
  359. P(minimumFractionDigits) \
  360. P(minimumIntegerDigits) \
  361. P(minimumSignificantDigits) \
  362. P(minute) \
  363. P(minutes) \
  364. P(minutesDisplay) \
  365. P(month) \
  366. P(monthCode) \
  367. P(monthDayFromFields) \
  368. P(months) \
  369. P(monthsDisplay) \
  370. P(monthsInYear) \
  371. P(move) \
  372. P(multiline) \
  373. P(name) \
  374. P(nanosecond) \
  375. P(nanoseconds) \
  376. P(nanosecondsDisplay) \
  377. P(negated) \
  378. P(next) \
  379. P(normalize) \
  380. P(notation) \
  381. P(now) \
  382. P(numberingSystem) \
  383. P(numberingSystems) \
  384. P(numeric) \
  385. P(of) \
  386. P(offset) \
  387. P(offsetNanoseconds) \
  388. P(overflow) \
  389. P(ownKeys) \
  390. P(padEnd) \
  391. P(padStart) \
  392. P(parse) \
  393. P(parseFloat) \
  394. P(parseInt) \
  395. P(plainDate) \
  396. P(plainDateISO) \
  397. P(plainDateTime) \
  398. P(plainDateTimeISO) \
  399. P(plainTime) \
  400. P(plainTimeISO) \
  401. P(pluralCategories) \
  402. P(pop) \
  403. P(pow) \
  404. P(preventExtensions) \
  405. P(promise) \
  406. P(propertyIsEnumerable) \
  407. P(prototype) \
  408. P(proxy) \
  409. P(push) \
  410. P(race) \
  411. P(random) \
  412. P(raw) \
  413. P(reason) \
  414. P(reduce) \
  415. P(reduceRight) \
  416. P(region) \
  417. P(reject) \
  418. P(relativeTo) \
  419. P(repeat) \
  420. P(resolve) \
  421. P(resolvedOptions) \
  422. P(reverse) \
  423. P(revocable) \
  424. P(revoke) \
  425. P(round) \
  426. P(roundingIncrement) \
  427. P(roundingMode) \
  428. P(roundingPriority) \
  429. P(rightContext) \
  430. P(script) \
  431. P(seal) \
  432. P(second) \
  433. P(seconds) \
  434. P(secondsDisplay) \
  435. P(segment) \
  436. P(select) \
  437. P(selectRange) \
  438. P(sensitivity) \
  439. P(set) \
  440. P(setBigInt64) \
  441. P(setBigUint64) \
  442. P(setDate) \
  443. P(setFloat32) \
  444. P(setFloat64) \
  445. P(setFullYear) \
  446. P(setHours) \
  447. P(setInt8) \
  448. P(setInt16) \
  449. P(setInt32) \
  450. P(setMilliseconds) \
  451. P(setMinutes) \
  452. P(setMonth) \
  453. P(setPrototypeOf) \
  454. P(setSeconds) \
  455. P(setTime) \
  456. P(setUint8) \
  457. P(setUint16) \
  458. P(setUint32) \
  459. P(setUTCDate) \
  460. P(setUTCFullYear) \
  461. P(setUTCHours) \
  462. P(setUTCMilliseconds) \
  463. P(setUTCMinutes) \
  464. P(setUTCMonth) \
  465. P(setUTCSeconds) \
  466. P(setYear) \
  467. P(shift) \
  468. P(sign) \
  469. P(signDisplay) \
  470. P(sin) \
  471. P(since) \
  472. P(sinh) \
  473. P(size) \
  474. P(slice) \
  475. P(small) \
  476. P(smallestUnit) \
  477. P(some) \
  478. P(sort) \
  479. P(source) \
  480. P(splice) \
  481. P(sqrt) \
  482. P(stack) \
  483. P(startOfDay) \
  484. P(startsWith) \
  485. P(status) \
  486. P(sticky) \
  487. P(store) \
  488. P(strike) \
  489. P(stringify) \
  490. P(style) \
  491. P(sub) \
  492. P(subarray) \
  493. P(substr) \
  494. P(substring) \
  495. P(subtract) \
  496. P(sup) \
  497. P(suppressed) \
  498. P(supportedLocalesOf) \
  499. P(supportedValuesOf) \
  500. P(symmetricDifference) \
  501. P(take) \
  502. P(tan) \
  503. P(tanh) \
  504. P(test) \
  505. P(textInfo) \
  506. P(then) \
  507. P(time) \
  508. P(timeEnd) \
  509. P(timeLog) \
  510. P(timeStyle) \
  511. P(timeZone) \
  512. P(timeZoneName) \
  513. P(timeZones) \
  514. P(toArray) \
  515. P(toDateString) \
  516. P(toExponential) \
  517. P(toFixed) \
  518. P(toGMTString) \
  519. P(toInstant) \
  520. P(toISOString) \
  521. P(toJSON) \
  522. P(toLocaleDateString) \
  523. P(toLocaleLowerCase) \
  524. P(toLocaleString) \
  525. P(toLocaleTimeString) \
  526. P(toLocaleUpperCase) \
  527. P(toLowerCase) \
  528. P(toPlainDate) \
  529. P(toPlainDateTime) \
  530. P(toPlainMonthDay) \
  531. P(toPlainTime) \
  532. P(toPlainYearMonth) \
  533. P(toPrecision) \
  534. P(toReversed) \
  535. P(toSorted) \
  536. P(toSpliced) \
  537. P(toString) \
  538. P(total) \
  539. P(toTemporalInstant) \
  540. P(toTimeString) \
  541. P(toUpperCase) \
  542. P(toUTCString) \
  543. P(toWellFormed) \
  544. P(toZonedDateTime) \
  545. P(toZonedDateTimeISO) \
  546. P(trace) \
  547. P(trailingZeroDisplay) \
  548. P(transfer) \
  549. P(transferToFixedLength) \
  550. P(trim) \
  551. P(trimEnd) \
  552. P(trimLeft) \
  553. P(trimRight) \
  554. P(trimStart) \
  555. P(trunc) \
  556. P(type) \
  557. P(undefined) \
  558. P(unescape) \
  559. P(unicode) \
  560. P(unicodeSets) \
  561. P(unit) \
  562. P(unitDisplay) \
  563. P(unregister) \
  564. P(unshift) \
  565. P(until) \
  566. P(usage) \
  567. P(use) \
  568. P(useGrouping) \
  569. P(value) \
  570. P(valueOf) \
  571. P(values) \
  572. P(warn) \
  573. P(weekInfo) \
  574. P(weekOfYear) \
  575. P(weekday) \
  576. P(weekend) \
  577. P(weeks) \
  578. P(weeksDisplay) \
  579. P(with) \
  580. P(withCalendar) \
  581. P(withPlainDate) \
  582. P(withPlainTime) \
  583. P(withResolvers) \
  584. P(withTimeZone) \
  585. P(writable) \
  586. P(year) \
  587. P(yearMonthFromFields) \
  588. P(yearOfWeek) \
  589. P(years) \
  590. P(yearsDisplay) \
  591. P(zonedDateTime) \
  592. P(zonedDateTimeISO)
  593. struct CommonPropertyNames {
  594. PropertyKey and_ { "and", PropertyKey::StringMayBeNumber::No };
  595. PropertyKey catch_ { "catch", PropertyKey::StringMayBeNumber::No };
  596. PropertyKey delete_ { "delete", PropertyKey::StringMayBeNumber::No };
  597. PropertyKey for_ { "for", PropertyKey::StringMayBeNumber::No };
  598. PropertyKey or_ { "or", PropertyKey::StringMayBeNumber::No };
  599. PropertyKey register_ { "register", PropertyKey::StringMayBeNumber::No };
  600. PropertyKey return_ { "return", PropertyKey::StringMayBeNumber::No };
  601. PropertyKey throw_ { "throw", PropertyKey::StringMayBeNumber::No };
  602. PropertyKey union_ { "union", PropertyKey::StringMayBeNumber::No };
  603. PropertyKey xor_ { "xor", PropertyKey::StringMayBeNumber::No };
  604. PropertyKey inputAlias { "$_", PropertyKey::StringMayBeNumber::No };
  605. PropertyKey lastMatchAlias { "$&", PropertyKey::StringMayBeNumber::No };
  606. PropertyKey lastParenAlias { "$+", PropertyKey::StringMayBeNumber::No };
  607. PropertyKey leftContextAlias { "$`", PropertyKey::StringMayBeNumber::No };
  608. PropertyKey rightContextAlias { "$'", PropertyKey::StringMayBeNumber::No };
  609. #define __ENUMERATE(x) PropertyKey x { #x, PropertyKey::StringMayBeNumber::No };
  610. ENUMERATE_STANDARD_PROPERTY_NAMES(__ENUMERATE)
  611. #undef __ENUMERATE
  612. #define __JS_ENUMERATE(x, a, b, c, t) PropertyKey x { #x, PropertyKey::StringMayBeNumber::No };
  613. JS_ENUMERATE_BUILTIN_TYPES
  614. #undef __JS_ENUMERATE
  615. #define __JS_ENUMERATE(x, a, b, c) PropertyKey x { #x, PropertyKey::StringMayBeNumber::No };
  616. JS_ENUMERATE_INTL_OBJECTS
  617. #undef __JS_ENUMERATE
  618. #define __JS_ENUMERATE(x, a, b, c) PropertyKey x { #x, PropertyKey::StringMayBeNumber::No };
  619. JS_ENUMERATE_TEMPORAL_OBJECTS
  620. #undef __JS_ENUMERATE
  621. #define __JS_ENUMERATE(x, a) PropertyKey x { #x, PropertyKey::StringMayBeNumber::No };
  622. JS_ENUMERATE_WELL_KNOWN_SYMBOLS
  623. #undef __JS_ENUMERATE
  624. };
  625. }