OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 } | 45 } |
46 | 46 |
47 pattern = IS_UNDEFINED(pattern) ? '' : ToString(pattern); | 47 pattern = IS_UNDEFINED(pattern) ? '' : ToString(pattern); |
48 flags = IS_UNDEFINED(flags) ? '' : ToString(flags); | 48 flags = IS_UNDEFINED(flags) ? '' : ToString(flags); |
49 | 49 |
50 var global = false; | 50 var global = false; |
51 var ignoreCase = false; | 51 var ignoreCase = false; |
52 var multiline = false; | 52 var multiline = false; |
53 | 53 |
54 for (var i = 0; i < flags.length; i++) { | 54 for (var i = 0; i < flags.length; i++) { |
55 var c = StringCharAt.call(flags, i); | 55 var c = %_CallFunction(flags, i, StringCharAt); |
56 switch (c) { | 56 switch (c) { |
57 case 'g': | 57 case 'g': |
58 // Allow duplicate flags to be consistent with JSC and others. | 58 // Allow duplicate flags to be consistent with JSC and others. |
59 global = true; | 59 global = true; |
60 break; | 60 break; |
61 case 'i': | 61 case 'i': |
62 ignoreCase = true; | 62 ignoreCase = true; |
63 break; | 63 break; |
64 case 'm': | 64 case 'm': |
65 multiline = true; | 65 multiline = true; |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); | 474 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); |
475 | 475 |
476 for (var i = 1; i < 10; ++i) { | 476 for (var i = 1; i < 10; ++i) { |
477 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D
ELETE); | 477 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D
ELETE); |
478 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); | 478 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); |
479 } | 479 } |
480 } | 480 } |
481 | 481 |
482 | 482 |
483 SetupRegExp(); | 483 SetupRegExp(); |
OLD | NEW |