| | |
| | | var global = require('../internals/global'); |
| | | var DESCRIPTORS = require('../internals/descriptors'); |
| | | var UNSUPPORTED_DOT_ALL = require('../internals/regexp-unsupported-dot-all'); |
| | | var defineProperty = require('../internals/object-define-property').f; |
| | | var classof = require('../internals/classof-raw'); |
| | | var defineBuiltInAccessor = require('../internals/define-built-in-accessor'); |
| | | var getInternalState = require('../internals/internal-state').get; |
| | | |
| | | var RegExpPrototype = RegExp.prototype; |
| | | var TypeError = global.TypeError; |
| | | |
| | | // `RegExp.prototype.dotAll` getter |
| | | // https://tc39.es/ecma262/#sec-get-regexp.prototype.dotall |
| | | if (DESCRIPTORS && UNSUPPORTED_DOT_ALL) { |
| | | defineProperty(RegExpPrototype, 'dotAll', { |
| | | defineBuiltInAccessor(RegExpPrototype, 'dotAll', { |
| | | configurable: true, |
| | | get: function () { |
| | | get: function dotAll() { |
| | | if (this === RegExpPrototype) return undefined; |
| | | // We can't use InternalStateModule.getterFor because |
| | | // we don't add metadata for regexps created by a literal. |
| | | if (this instanceof RegExp) { |
| | | if (classof(this) === 'RegExp') { |
| | | return !!getInternalState(this).dotAll; |
| | | } |
| | | throw TypeError('Incompatible receiver, RegExp required'); |