Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(708)

Side by Side Diff: src/regexp-delay.js

Issue 6223: Make sure that the name accessor on functions return the expected... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mirror-delay.js ('k') | src/runtime.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } else { // RegExp is being recompiled via RegExp.prototype.compile. 94 } else { // RegExp is being recompiled via RegExp.prototype.compile.
95 %IgnoreAttributesAndSetProperty(object, 'source', pattern); 95 %IgnoreAttributesAndSetProperty(object, 'source', pattern);
96 %IgnoreAttributesAndSetProperty(object, 'global', global); 96 %IgnoreAttributesAndSetProperty(object, 'global', global);
97 %IgnoreAttributesAndSetProperty(object, 'ignoreCase', ignoreCase); 97 %IgnoreAttributesAndSetProperty(object, 'ignoreCase', ignoreCase);
98 %IgnoreAttributesAndSetProperty(object, 'multiline', multiline); 98 %IgnoreAttributesAndSetProperty(object, 'multiline', multiline);
99 %IgnoreAttributesAndSetProperty(object, 'lastIndex', 0); 99 %IgnoreAttributesAndSetProperty(object, 'lastIndex', 0);
100 } 100 }
101 101
102 // Call internal function to compile the pattern. 102 // Call internal function to compile the pattern.
103 %RegExpCompile(object, pattern, flags); 103 %RegExpCompile(object, pattern, flags);
104 }; 104 }
105 105
106 106
107 function RegExpConstructor(pattern, flags) { 107 function RegExpConstructor(pattern, flags) {
108 if (%IsConstructCall()) { 108 if (%IsConstructCall()) {
109 DoConstructRegExp(this, pattern, flags, true); 109 DoConstructRegExp(this, pattern, flags, true);
110 } else { 110 } else {
111 // RegExp : Called as function; see ECMA-262, section 15.10.3.1. 111 // RegExp : Called as function; see ECMA-262, section 15.10.3.1.
112 if (IS_REGEXP(pattern) && IS_UNDEFINED(flags)) { 112 if (IS_REGEXP(pattern) && IS_UNDEFINED(flags)) {
113 return pattern; 113 return pattern;
114 } 114 }
115 return new $RegExp(pattern, flags); 115 return new $RegExp(pattern, flags);
116 } 116 }
117 }; 117 }
118 118
119 119
120 // Deprecated RegExp.prototype.compile method. We behave like the constructor 120 // Deprecated RegExp.prototype.compile method. We behave like the constructor
121 // were called again. In SpiderMonkey, this method returns the regexp object. 121 // were called again. In SpiderMonkey, this method returns the regexp object.
122 // In KJS, it returns undefined. For compatibility with KJS, we match their 122 // In KJS, it returns undefined. For compatibility with KJS, we match their
123 // behavior. 123 // behavior.
124 function CompileRegExp(pattern, flags) { 124 function CompileRegExp(pattern, flags) {
125 // Both KJS and SpiderMonkey treat a missing pattern argument as the 125 // Both KJS and SpiderMonkey treat a missing pattern argument as the
126 // empty subject string, and an actual undefined value passed as the 126 // empty subject string, and an actual undefined value passed as the
127 // patter as the string 'undefined'. Note that KJS is inconsistent 127 // patter as the string 'undefined'. Note that KJS is inconsistent
128 // here, treating undefined values differently in 128 // here, treating undefined values differently in
129 // RegExp.prototype.compile and in the constructor, where they are 129 // RegExp.prototype.compile and in the constructor, where they are
130 // the empty string. For compatibility with KJS, we match their 130 // the empty string. For compatibility with KJS, we match their
131 // behavior. 131 // behavior.
132 if (IS_UNDEFINED(pattern) && %_ArgumentsLength() != 0) { 132 if (IS_UNDEFINED(pattern) && %_ArgumentsLength() != 0) {
133 DoConstructRegExp(this, 'undefined', flags, false); 133 DoConstructRegExp(this, 'undefined', flags, false);
134 } else { 134 } else {
135 DoConstructRegExp(this, pattern, flags, false); 135 DoConstructRegExp(this, pattern, flags, false);
136 } 136 }
137 } 137 }
138 138
139 139
140 // DoRegExpExec and DoRegExpExecGlobal are wrappers around the runtime 140 // DoRegExpExec and DoRegExpExecGlobal are wrappers around the runtime
141 // %RegExp and %RegExpGlobal functions that ensure that the static 141 // %RegExp and %RegExpGlobal functions that ensure that the static
142 // properties of the RegExp constructor are set. 142 // properties of the RegExp constructor are set.
143 function DoRegExpExec(regexp, string, index) { 143 function DoRegExpExec(regexp, string, index) {
144 var matchIndices = %RegExpExec(regexp, string, index); 144 var matchIndices = %RegExpExec(regexp, string, index);
145 if (!IS_NULL(matchIndices)) { 145 if (!IS_NULL(matchIndices)) {
146 regExpCaptures = matchIndices; 146 regExpCaptures = matchIndices;
147 regExpSubject = regexp_input = string; 147 regExpSubject = regExpInput = string;
148 } 148 }
149 return matchIndices; 149 return matchIndices;
150 }; 150 }
151
151 152
152 function DoRegExpExecGlobal(regexp, string) { 153 function DoRegExpExecGlobal(regexp, string) {
153 // Here, matchIndices is an array of arrays of substring indices. 154 // Here, matchIndices is an array of arrays of substring indices.
154 var matchIndices = %RegExpExecGlobal(regexp, string); 155 var matchIndices = %RegExpExecGlobal(regexp, string);
155 if (matchIndices.length != 0) { 156 if (matchIndices.length != 0) {
156 regExpCaptures = matchIndices[matchIndices.length - 1]; 157 regExpCaptures = matchIndices[matchIndices.length - 1];
157 regExpSubject = regexp_input = string; 158 regExpSubject = regExpInput = string;
158 } 159 }
159 return matchIndices; 160 return matchIndices;
160 }; 161 }
161 162
162 163
163 function RegExpExec(string) { 164 function RegExpExec(string) {
164 if (%_ArgumentsLength() == 0) { 165 if (%_ArgumentsLength() == 0) {
165 string = regexp_input; 166 string = regExpInput;
166 } 167 }
167 var s = ToString(string); 168 var s = ToString(string);
168 var length = s.length; 169 var length = s.length;
169 var lastIndex = this.lastIndex; 170 var lastIndex = this.lastIndex;
170 var i = this.global ? TO_INTEGER(lastIndex) : 0; 171 var i = this.global ? TO_INTEGER(lastIndex) : 0;
171 172
172 if (i < 0 || i > s.length) { 173 if (i < 0 || i > s.length) {
173 this.lastIndex = 0; 174 this.lastIndex = 0;
174 return null; 175 return null;
175 } 176 }
(...skipping 20 matching lines...) Expand all
196 // property from the global object since this may change. 197 // property from the global object since this may change.
197 result[i] = void 0; 198 result[i] = void 0;
198 } 199 }
199 } 200 }
200 201
201 if (this.global) 202 if (this.global)
202 this.lastIndex = matchIndices[1]; 203 this.lastIndex = matchIndices[1];
203 result.index = matchIndices[0]; 204 result.index = matchIndices[0];
204 result.input = s; 205 result.input = s;
205 return result; 206 return result;
206 }; 207 }
207 208
208 209
209 function RegExpTest(string) { 210 function RegExpTest(string) {
210 var result = (%_ArgumentsLength() == 0) ? this.exec() : this.exec(string); 211 var result = (%_ArgumentsLength() == 0) ? this.exec() : this.exec(string);
211 return result != null; 212 return result != null;
212 }; 213 }
213 214
214 215
215 function RegExpToString() { 216 function RegExpToString() {
216 // If this.source is an empty string, output /(?:)/. 217 // If this.source is an empty string, output /(?:)/.
217 // http://bugzilla.mozilla.org/show_bug.cgi?id=225550 218 // http://bugzilla.mozilla.org/show_bug.cgi?id=225550
218 // ecma_2/RegExp/properties-001.js. 219 // ecma_2/RegExp/properties-001.js.
219 var src = this.source ? this.source : '(?:)'; 220 var src = this.source ? this.source : '(?:)';
220 var result = '/' + src + '/'; 221 var result = '/' + src + '/';
221 if (this.global) 222 if (this.global)
222 result += 'g'; 223 result += 'g';
223 if (this.ignoreCase) 224 if (this.ignoreCase)
224 result += 'i'; 225 result += 'i';
225 if (this.multiline) 226 if (this.multiline)
226 result += 'm'; 227 result += 'm';
227 return result; 228 return result;
228 }; 229 }
229 230
230 231
231 // Getters for the static properties lastMatch, lastParen, leftContext, and 232 // Getters for the static properties lastMatch, lastParen, leftContext, and
232 // rightContext of the RegExp constructor. The properties are computed based 233 // rightContext of the RegExp constructor. The properties are computed based
233 // on the captures array of the last successful match and the subject string 234 // on the captures array of the last successful match and the subject string
234 // of the last successful match. 235 // of the last successful match.
235 function RegExpGetLastMatch() { 236 function RegExpGetLastMatch() {
236 return regExpSubject.slice(regExpCaptures[0], regExpCaptures[1]); 237 return regExpSubject.slice(regExpCaptures[0], regExpCaptures[1]);
237 }; 238 }
239
238 240
239 function RegExpGetLastParen() { 241 function RegExpGetLastParen() {
240 var length = regExpCaptures.length; 242 var length = regExpCaptures.length;
241 if (length <= 2) return ''; // There were no captures. 243 if (length <= 2) return ''; // There were no captures.
242 // We match the SpiderMonkey behavior: return the substring defined by the 244 // We match the SpiderMonkey behavior: return the substring defined by the
243 // last pair (after the first pair) of elements of the capture array even if 245 // last pair (after the first pair) of elements of the capture array even if
244 // it is empty. 246 // it is empty.
245 return regExpSubject.slice(regExpCaptures[length - 2], 247 return regExpSubject.slice(regExpCaptures[length - 2],
246 regExpCaptures[length - 1]); 248 regExpCaptures[length - 1]);
247 }; 249 }
250
248 251
249 function RegExpGetLeftContext() { 252 function RegExpGetLeftContext() {
250 return regExpSubject.slice(0, regExpCaptures[0]); 253 return regExpSubject.slice(0, regExpCaptures[0]);
251 }; 254 }
255
252 256
253 function RegExpGetRightContext() { 257 function RegExpGetRightContext() {
254 return regExpSubject.slice(regExpCaptures[1], regExpSubject.length); 258 return regExpSubject.slice(regExpCaptures[1], regExpSubject.length);
255 }; 259 }
256 260
257 261
258 // The properties $1..$9 are the first nine capturing substrings of the last 262 // The properties $1..$9 are the first nine capturing substrings of the last
259 // successful match, or ''. The function RegExpMakeCaptureGetter will be 263 // successful match, or ''. The function RegExpMakeCaptureGetter will be
260 // called with an index greater than or equal to 1 but it actually works for 264 // called with an index greater than or equal to 1 but it actually works for
261 // any non-negative index. 265 // any non-negative index.
262 function RegExpMakeCaptureGetter(n) { 266 function RegExpMakeCaptureGetter(n) {
263 return function() { 267 return function() {
264 var index = n * 2; 268 var index = n * 2;
265 if (index >= regExpCaptures.length) return ''; 269 if (index >= regExpCaptures.length) return '';
266 var matchStart = regExpCaptures[index]; 270 var matchStart = regExpCaptures[index];
267 var matchEnd = regExpCaptures[index + 1]; 271 var matchEnd = regExpCaptures[index + 1];
268 if (matchStart == -1 || matchEnd == -1) return ''; 272 if (matchStart == -1 || matchEnd == -1) return '';
269 return regExpSubject.slice(matchStart, matchEnd); 273 return regExpSubject.slice(matchStart, matchEnd);
270 }; 274 };
271 }; 275 }
272 276
273 277
274 // Properties of the builtins object for recording the result of the last 278 // Properties of the builtins object for recording the result of the last
275 // regexp match. The property regExpCaptures is the matchIndices array of the 279 // regexp match. The property regExpCaptures is the matchIndices array of the
276 // last successful regexp match (an array of start/end index pairs for the 280 // last successful regexp match (an array of start/end index pairs for the
277 // match and all the captured substrings), the invariant is that there is at 281 // match and all the captured substrings), the invariant is that there is at
278 // least two elements. The property regExpSubject is the subject string for 282 // least two elements. The property regExpSubject is the subject string for
279 // the last successful match. 283 // the last successful match.
280 var regExpCaptures = [0, 0]; 284 var regExpCaptures = [0, 0];
281 var regExpSubject = ''; 285 var regExpSubject = '';
286 var regExpInput = "";
282 287
288 // -------------------------------------------------------------------
283 289
284 %FunctionSetInstanceClassName($RegExp, 'RegExp'); 290 function SetupRegExp() {
285 %FunctionSetPrototype($RegExp, new $Object()); 291 %FunctionSetInstanceClassName($RegExp, 'RegExp');
286 %AddProperty($RegExp.prototype, 'constructor', $RegExp, DONT_ENUM); 292 %FunctionSetPrototype($RegExp, new $Object());
287 %SetCode($RegExp, RegExpConstructor); 293 %AddProperty($RegExp.prototype, 'constructor', $RegExp, DONT_ENUM);
294 %SetCode($RegExp, RegExpConstructor);
288 295
289 %AddProperty($RegExp.prototype, 'exec', RegExpExec, DONT_ENUM); 296 InstallFunctions($RegExp.prototype, DONT_ENUM, $Array(
290 %AddProperty($RegExp.prototype, 'test', RegExpTest, DONT_ENUM); 297 "exec", RegExpExec,
291 %AddProperty($RegExp.prototype, 'toString', RegExpToString, DONT_ENUM); 298 "test", RegExpTest,
292 %AddProperty($RegExp.prototype, 'compile', CompileRegExp, DONT_ENUM); 299 "toString", RegExpToString,
300 "compile", CompileRegExp
301 ));
293 302
294 // The spec says nothing about the length of exec and test, but 303 // The spec says nothing about the length of exec and test, but
295 // SpiderMonkey and KJS have length equal to 0. 304 // SpiderMonkey and KJS have length equal to 0.
296 %FunctionSetLength($RegExp.prototype.exec, 0); 305 %FunctionSetLength($RegExp.prototype.exec, 0);
297 %FunctionSetLength($RegExp.prototype.test, 0); 306 %FunctionSetLength($RegExp.prototype.test, 0);
298 // The length of compile is 1 in SpiderMonkey. 307 // The length of compile is 1 in SpiderMonkey.
299 %FunctionSetLength($RegExp.prototype.compile, 1); 308 %FunctionSetLength($RegExp.prototype.compile, 1);
300 309
301 // The properties input, $input, and $_ are aliases for each other. When this 310 // The properties input, $input, and $_ are aliases for each other. When this
302 // value is set in SpiderMonkey, the value it is set to is coerced to a 311 // value is set in SpiderMonkey, the value it is set to is coerced to a
303 // string. We mimic that behavior with a slight difference: in SpiderMonkey 312 // string. We mimic that behavior with a slight difference: in SpiderMonkey
304 // the value of the expression 'RegExp.input = null' (for instance) is the 313 // the value of the expression 'RegExp.input = null' (for instance) is the
305 // string "null" (ie, the value after coercion), while in V8 it is the value 314 // string "null" (ie, the value after coercion), while in V8 it is the value
306 // null (ie, the value before coercion). 315 // null (ie, the value before coercion).
307 // Getter and setter for the input. 316 // Getter and setter for the input.
308 var regexp_input = ""; 317 function RegExpGetInput() { return regExpInput; }
309 function RegExpGetInput() { return regexp_input; }; 318 function RegExpSetInput(string) { regExpInput = ToString(string); }
310 function RegExpSetInput(string) { regexp_input = ToString(string); };
311 319
312 %DefineAccessor($RegExp, 'input', GETTER, RegExpGetInput, DONT_DELETE); 320 %DefineAccessor($RegExp, 'input', GETTER, RegExpGetInput, DONT_DELETE);
313 %DefineAccessor($RegExp, 'input', SETTER, RegExpSetInput, DONT_DELETE); 321 %DefineAccessor($RegExp, 'input', SETTER, RegExpSetInput, DONT_DELETE);
314 %DefineAccessor($RegExp, '$_', GETTER, RegExpGetInput, DONT_ENUM | DONT_DELETE); 322 %DefineAccessor($RegExp, '$_', GETTER, RegExpGetInput, DONT_ENUM | DONT_DELETE );
315 %DefineAccessor($RegExp, '$_', SETTER, RegExpSetInput, DONT_ENUM | DONT_DELETE); 323 %DefineAccessor($RegExp, '$_', SETTER, RegExpSetInput, DONT_ENUM | DONT_DELETE );
316 %DefineAccessor($RegExp, '$input', GETTER, RegExpGetInput, DONT_ENUM | DONT_DELE TE); 324 %DefineAccessor($RegExp, '$input', GETTER, RegExpGetInput, DONT_ENUM | DONT_DE LETE);
317 %DefineAccessor($RegExp, '$input', SETTER, RegExpSetInput, DONT_ENUM | DONT_DELE TE); 325 %DefineAccessor($RegExp, '$input', SETTER, RegExpSetInput, DONT_ENUM | DONT_DE LETE);
318 326
319 // The properties multiline and $* are aliases for each other. When this 327 // The properties multiline and $* are aliases for each other. When this
320 // value is set in SpiderMonkey, the value it is set to is coerced to a 328 // value is set in SpiderMonkey, the value it is set to is coerced to a
321 // boolean. We mimic that behavior with a slight difference: in SpiderMonkey 329 // boolean. We mimic that behavior with a slight difference: in SpiderMonkey
322 // the value of the expression 'RegExp.multiline = null' (for instance) is the 330 // the value of the expression 'RegExp.multiline = null' (for instance) is the
323 // boolean false (ie, the value after coercion), while in V8 it is the value 331 // boolean false (ie, the value after coercion), while in V8 it is the value
324 // null (ie, the value before coercion). 332 // null (ie, the value before coercion).
325 (function () { 333
326 // Getter and setter for multiline. 334 // Getter and setter for multiline.
327 var multiline = false; 335 var multiline = false;
328 function RegExpGetMultiline() { return multiline; }; 336 function RegExpGetMultiline() { return multiline; };
329 function RegExpSetMultiline(flag) { multiline = flag ? true : false; }; 337 function RegExpSetMultiline(flag) { multiline = flag ? true : false; };
330 338
331 %DefineAccessor($RegExp, 'multiline', GETTER, RegExpGetMultiline, DONT_DELETE) ; 339 %DefineAccessor($RegExp, 'multiline', GETTER, RegExpGetMultiline, DONT_DELETE) ;
332 %DefineAccessor($RegExp, 'multiline', SETTER, RegExpSetMultiline, DONT_DELETE) ; 340 %DefineAccessor($RegExp, 'multiline', SETTER, RegExpSetMultiline, DONT_DELETE) ;
333 %DefineAccessor($RegExp, '$*', GETTER, RegExpGetMultiline, DONT_ENUM | DONT_DE LETE); 341 %DefineAccessor($RegExp, '$*', GETTER, RegExpGetMultiline, DONT_ENUM | DONT_DE LETE);
334 %DefineAccessor($RegExp, '$*', SETTER, RegExpSetMultiline, DONT_ENUM | DONT_DE LETE); 342 %DefineAccessor($RegExp, '$*', SETTER, RegExpSetMultiline, DONT_ENUM | DONT_DE LETE);
335 })();
336 343
337 344
338 function NoOpSetter(ignored) {}; 345 function NoOpSetter(ignored) {}
339 346
340 347
341 // Static properties set by a successful match. 348 // Static properties set by a successful match.
342 %DefineAccessor($RegExp, 'lastMatch', GETTER, RegExpGetLastMatch, DONT_DELETE); 349 %DefineAccessor($RegExp, 'lastMatch', GETTER, RegExpGetLastMatch, DONT_DELETE) ;
343 %DefineAccessor($RegExp, 'lastMatch', SETTER, NoOpSetter, DONT_DELETE); 350 %DefineAccessor($RegExp, 'lastMatch', SETTER, NoOpSetter, DONT_DELETE);
344 %DefineAccessor($RegExp, '$&', GETTER, RegExpGetLastMatch, DONT_ENUM | DONT_DELE TE); 351 %DefineAccessor($RegExp, '$&', GETTER, RegExpGetLastMatch, DONT_ENUM | DONT_DE LETE);
345 %DefineAccessor($RegExp, '$&', SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); 352 %DefineAccessor($RegExp, '$&', SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE);
346 %DefineAccessor($RegExp, 'lastParen', GETTER, RegExpGetLastParen, DONT_DELETE); 353 %DefineAccessor($RegExp, 'lastParen', GETTER, RegExpGetLastParen, DONT_DELETE) ;
347 %DefineAccessor($RegExp, 'lastParen', SETTER, NoOpSetter, DONT_DELETE); 354 %DefineAccessor($RegExp, 'lastParen', SETTER, NoOpSetter, DONT_DELETE);
348 %DefineAccessor($RegExp, '$+', GETTER, RegExpGetLastParen, DONT_ENUM | DONT_DELE TE); 355 %DefineAccessor($RegExp, '$+', GETTER, RegExpGetLastParen, DONT_ENUM | DONT_DE LETE);
349 %DefineAccessor($RegExp, '$+', SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); 356 %DefineAccessor($RegExp, '$+', SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE);
350 %DefineAccessor($RegExp, 'leftContext', GETTER, RegExpGetLeftContext, DONT_DELET E); 357 %DefineAccessor($RegExp, 'leftContext', GETTER, RegExpGetLeftContext, DONT_DEL ETE);
351 %DefineAccessor($RegExp, 'leftContext', SETTER, NoOpSetter, DONT_DELETE); 358 %DefineAccessor($RegExp, 'leftContext', SETTER, NoOpSetter, DONT_DELETE);
352 %DefineAccessor($RegExp, '$`', GETTER, RegExpGetLeftContext, DONT_ENUM | DONT_DE LETE); 359 %DefineAccessor($RegExp, '$`', GETTER, RegExpGetLeftContext, DONT_ENUM | DONT_ DELETE);
353 %DefineAccessor($RegExp, '$`', SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); 360 %DefineAccessor($RegExp, '$`', SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE);
354 %DefineAccessor($RegExp, 'rightContext', GETTER, RegExpGetRightContext, DONT_DEL ETE); 361 %DefineAccessor($RegExp, 'rightContext', GETTER, RegExpGetRightContext, DONT_D ELETE);
355 %DefineAccessor($RegExp, 'rightContext', SETTER, NoOpSetter, DONT_DELETE); 362 %DefineAccessor($RegExp, 'rightContext', SETTER, NoOpSetter, DONT_DELETE);
356 %DefineAccessor($RegExp, "$'", GETTER, RegExpGetRightContext, DONT_ENUM | DONT_D ELETE); 363 %DefineAccessor($RegExp, "$'", GETTER, RegExpGetRightContext, DONT_ENUM | DONT _DELETE);
357 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); 364 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE);
358 365
359 // A local scope to hide the loop index i.
360 (function() {
361 for (var i = 1; i < 10; ++i) { 366 for (var i = 1; i < 10; ++i) {
362 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D ELETE); 367 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D ELETE);
363 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); 368 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE);
364 } 369 }
365 })(); 370 }
371
372
373 SetupRegExp();
OLDNEW
« no previous file with comments | « src/mirror-delay.js ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698