mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1011 B
35 lines
1011 B
// Copyright 2014 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
'use strict';
|
|
|
|
var $RegExp = global.RegExp;
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// ES6 draft 12-06-13, section 21.2.5.3
|
|
// + https://bugs.ecmascript.org/show_bug.cgi?id=3423
|
|
function RegExpGetFlags() {
|
|
if (!IS_SPEC_OBJECT(this)) {
|
|
throw MakeTypeError('flags_getter_non_object',
|
|
[%ToString(this)]);
|
|
}
|
|
var result = '';
|
|
if (this.global) result += 'g';
|
|
if (this.ignoreCase) result += 'i';
|
|
if (this.multiline) result += 'm';
|
|
if (this.unicode) result += 'u';
|
|
if (this.sticky) result += 'y';
|
|
return result;
|
|
}
|
|
|
|
function ExtendRegExpPrototype() {
|
|
%CheckIsBootstrapping();
|
|
|
|
%DefineAccessorPropertyUnchecked($RegExp.prototype, 'flags', RegExpGetFlags,
|
|
null, DONT_ENUM);
|
|
%SetNativeFlag(RegExpGetFlags);
|
|
}
|
|
|
|
ExtendRegExpPrototype();
|
|
|