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

Side by Side Diff: src/messages.js

Issue 1049323003: ES6: Error functions should extend Error (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix and cleanup test Created 5 years, 8 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
« no previous file with comments | « no previous file | test/mjsunit/get-prototype-of.js » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // ------------------------------------------------------------------- 5 // -------------------------------------------------------------------
6 6
7 var kMessages = { 7 var kMessages = {
8 // Error 8 // Error
9 cyclic_proto: ["Cyclic __proto__ value"], 9 cyclic_proto: ["Cyclic __proto__ value"],
10 code_gen_from_strings: ["%0"], 10 code_gen_from_strings: ["%0"],
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 // The prototype of the Error object must itself be an error. 1165 // The prototype of the Error object must itself be an error.
1166 // However, it can't be an instance of the Error object because 1166 // However, it can't be an instance of the Error object because
1167 // it hasn't been properly configured yet. Instead we create a 1167 // it hasn't been properly configured yet. Instead we create a
1168 // special not-a-true-error-but-close-enough object. 1168 // special not-a-true-error-but-close-enough object.
1169 var ErrorPrototype = function() {}; 1169 var ErrorPrototype = function() {};
1170 %FunctionSetPrototype(ErrorPrototype, $Object.prototype); 1170 %FunctionSetPrototype(ErrorPrototype, $Object.prototype);
1171 %FunctionSetInstanceClassName(ErrorPrototype, 'Error'); 1171 %FunctionSetInstanceClassName(ErrorPrototype, 'Error');
1172 %FunctionSetPrototype(f, new ErrorPrototype()); 1172 %FunctionSetPrototype(f, new ErrorPrototype());
1173 } else { 1173 } else {
1174 %FunctionSetPrototype(f, new $Error()); 1174 %FunctionSetPrototype(f, new $Error());
1175 %InternalSetPrototype(f, $Error);
1175 } 1176 }
1176 %FunctionSetInstanceClassName(f, 'Error'); 1177 %FunctionSetInstanceClassName(f, 'Error');
1177 %AddNamedProperty(f.prototype, 'constructor', f, DONT_ENUM); 1178 %AddNamedProperty(f.prototype, 'constructor', f, DONT_ENUM);
1178 %AddNamedProperty(f.prototype, "name", name, DONT_ENUM); 1179 %AddNamedProperty(f.prototype, 'name', name, DONT_ENUM);
1179 %SetCode(f, function(m) { 1180 %SetCode(f, function(m) {
1180 if (%_IsConstructCall()) { 1181 if (%_IsConstructCall()) {
1181 try { captureStackTrace(this, f); } catch (e) { } 1182 try { captureStackTrace(this, f); } catch (e) { }
1182 // Define all the expected properties directly on the error 1183 // Define all the expected properties directly on the error
1183 // object. This avoids going through getters and setters defined 1184 // object. This avoids going through getters and setters defined
1184 // on prototype objects. 1185 // on prototype objects.
1185 if (!IS_UNDEFINED(m)) { 1186 if (!IS_UNDEFINED(m)) {
1186 %AddNamedProperty(this, 'message', ToString(m), DONT_ENUM); 1187 %AddNamedProperty(this, 'message', ToString(m), DONT_ENUM);
1187 } 1188 }
1188 } else { 1189 } else {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 function SetUpStackOverflowBoilerplate() { 1278 function SetUpStackOverflowBoilerplate() {
1278 var boilerplate = MakeRangeError('stack_overflow', []); 1279 var boilerplate = MakeRangeError('stack_overflow', []);
1279 1280
1280 %DefineAccessorPropertyUnchecked( 1281 %DefineAccessorPropertyUnchecked(
1281 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); 1282 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM);
1282 1283
1283 return boilerplate; 1284 return boilerplate;
1284 } 1285 }
1285 1286
1286 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); 1287 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate();
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/get-prototype-of.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698