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

Unified Diff: src/runtime.js

Issue 861623002: Add a pretty printer to improve the error message non-function calls (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comment Created 5 years, 11 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/prettyprinter.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.js
diff --git a/src/runtime.js b/src/runtime.js
index 8ae676110be18cf955f7339dcbab9f43b5d8f58c..6bbb375e767681e5b6f238a096fee76cd2921236 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -377,7 +377,9 @@ function FILTER_KEY(key) {
function CALL_NON_FUNCTION() {
var delegate = %GetFunctionDelegate(this);
if (!IS_FUNCTION(delegate)) {
- throw %MakeTypeError('called_non_callable', [typeof this]);
+ var callsite = %RenderCallSite();
+ if (callsite == "") callsite = typeof this;
+ throw %MakeTypeError('called_non_callable', [callsite]);
}
return %Apply(delegate, this, arguments, 0, %_ArgumentsLength());
}
@@ -386,7 +388,9 @@ function CALL_NON_FUNCTION() {
function CALL_NON_FUNCTION_AS_CONSTRUCTOR() {
var delegate = %GetConstructorDelegate(this);
if (!IS_FUNCTION(delegate)) {
- throw %MakeTypeError('called_non_callable', [typeof this]);
+ var callsite = %RenderCallSite();
+ if (callsite == "") callsite = typeof this;
+ throw %MakeTypeError('called_non_callable', [callsite]);
}
return %Apply(delegate, this, arguments, 0, %_ArgumentsLength());
}
« no previous file with comments | « src/prettyprinter.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698