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

Unified Diff: src/messages.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/math.js ('k') | src/mirror-delay.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/messages.js
===================================================================
--- src/messages.js (revision 413)
+++ src/messages.js (working copy)
@@ -48,7 +48,7 @@
}
var s = mapping[first] ? "an " : "a ";
return s + cons;
-};
+}
const kMessages = {
@@ -124,7 +124,7 @@
result = result.split("%" + i).join(str);
}
return result;
-};
+}
function ToDetailString(obj) {
@@ -137,7 +137,7 @@
} else {
return ToString(obj);
}
-};
+}
function MakeGenericError(constructor, type, args) {
@@ -156,7 +156,7 @@
e.type = type;
e.arguments = args;
return e;
-};
+}
/**
@@ -175,7 +175,7 @@
var format = kMessages[message.type];
if (!format) return "<unknown message " + message.type + ">";
return FormatString(format, message.args);
-};
+}
function GetLineNumber(message) {
@@ -183,7 +183,7 @@
var location = message.script.locationFromPosition(message.startPos);
if (location == null) return -1;
return location.line + 1;
-};
+}
// Returns the source code line containing the given source
@@ -193,37 +193,37 @@
if (location == null) return "";
location.restrict();
return location.sourceText();
-};
+}
function MakeTypeError(type, args) {
return MakeGenericError($TypeError, type, args);
-};
+}
function MakeRangeError(type, args) {
return MakeGenericError($RangeError, type, args);
-};
+}
function MakeSyntaxError(type, args) {
return MakeGenericError($SyntaxError, type, args);
-};
+}
function MakeReferenceError(type, args) {
return MakeGenericError($ReferenceError, type, args);
-};
+}
function MakeEvalError(type, args) {
return MakeGenericError($EvalError, type, args);
-};
+}
function MakeError(type, args) {
return MakeGenericError($Error, type, args);
-};
+}
/**
@@ -445,7 +445,7 @@
this.column = column;
this.start = start;
this.end = end;
-};
+}
const kLineLengthLimit = 78;
@@ -473,7 +473,7 @@
// If no before is specified center for small limits and perfer more source
// before the the position that after for longer limits.
if (limit <= 20) {
- before = $Math_floor(limit / 2);
+ before = $floor(limit / 2);
} else {
before = limit - 10;
}
@@ -554,7 +554,7 @@
if (location == null) return -1;
location.restrict();
return message.startPos - location.start;
-};
+}
function ErrorMessage(type, args, startPos, endPos, script, stackTrace) {
@@ -564,12 +564,12 @@
this.args = args;
this.script = script;
this.stackTrace = stackTrace;
-};
+}
function MakeMessage(type, args, startPos, endPos, script, stackTrace) {
return new ErrorMessage(type, args, startPos, endPos, script, stackTrace);
-};
+}
function GetStackTraceLine(recv, fun, pos, isGlobal) {
@@ -578,7 +578,7 @@
} catch (e) {
return "<error: " + e + ">";
}
-};
+}
function GetFunctionName(fun, recv) {
@@ -589,7 +589,7 @@
return prop;
}
return "[anonymous]";
-};
+}
function UnsafeGetStackTraceLine(recv, fun, pos, isTopLevel) {
@@ -619,20 +619,20 @@
}
}
return (result) ? " at " + result : result;
-};
+}
// ----------------------------------------------------------------------------
// Error implementation
-function DefineError(name) {
- var f = function(msg) {};
+function DefineError(f) {
// Store the error function in both the global object
// and the runtime object. The function is fetched
// from the runtime object when throwing errors from
// within the runtime system to avoid strange side
// effects when overwriting the error functions from
// user code.
+ var name = f.name;
%AddProperty(global, name, f, DONT_ENUM);
this['$' + name] = f;
// Configure the error function.
@@ -648,22 +648,22 @@
return new f(m);
}
});
-};
+}
$Math.__proto__ = global.Object.prototype;
-DefineError('Error');
-DefineError('TypeError');
-DefineError('RangeError');
-DefineError('SyntaxError');
-DefineError('ReferenceError');
-DefineError('EvalError');
-DefineError('URIError');
+DefineError(function Error() { });
+DefineError(function TypeError() { });
+DefineError(function RangeError() { });
+DefineError(function SyntaxError() { });
+DefineError(function ReferenceError() { });
+DefineError(function EvalError() { });
+DefineError(function URIError() { });
// Setup extra properties of the Error.prototype object.
$Error.prototype.message = '';
-%AddProperty($Error.prototype, 'toString', function() {
+%AddProperty($Error.prototype, 'toString', function toString() {
var type = this.type;
if (type && !this.hasOwnProperty("message")) {
return this.name + ": " + FormatMessage({ type: type, args: this.arguments });
« no previous file with comments | « src/math.js ('k') | src/mirror-delay.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698