Chromium Code Reviews

Unified Diff: src/v8natives.js

Issue 624013005: Classes: Add support for toString (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: git rebase Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index 782b953ea9763edf0dadbc32511d32a6deef0463..5adbca25b3b77b58379725f7b004cc161b7ed74a 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -1739,6 +1739,11 @@ function FunctionSourceString(func) {
throw new $TypeError('Function.prototype.toString is not generic');
}
+ var classSource = %ClassGetSourceCode(func);
+ if (IS_STRING(classSource)) {
+ return classSource;
+ }
+
var source = %FunctionGetSourceCode(func);
if (!IS_STRING(source) || %FunctionIsBuiltin(func)) {
var name = %FunctionGetName(func);

Powered by Google App Engine