Index: src/messages.js |
diff --git a/src/messages.js b/src/messages.js |
index 2a00ba84691fabb9952fc66669edb80571d72206..45594e7ea5002ccc1bc75fbe898d5e914a6f8068 100644 |
--- a/src/messages.js |
+++ b/src/messages.js |
@@ -925,13 +925,21 @@ function CallSiteToString() { |
fileName = this.getScriptNameOrSourceURL(); |
if (!fileName) { |
fileLocation = this.getEvalOrigin(); |
+ fileLocation += ", "; // Expecting source position to follow. |
} |
} else { |
fileName = this.getFileName(); |
} |
- if (fileName) { |
- fileLocation += fileName; |
+ if (!this.isNative()) { |
rossberg
2012/06/18 13:11:30
I think the code is clearer if you merge this cond
Yang
2012/06/18 13:18:42
Done.
|
+ if (fileName) { |
+ fileLocation += fileName; |
+ } else { |
+ // Source code does not originate from a file and is not native, but we |
+ // can still get the source position inside the source string, e.g. in |
+ // an eval string. |
+ fileLocation += "<anonymous>"; |
+ } |
var lineNumber = this.getLineNumber(); |
if (lineNumber != null) { |
fileLocation += ":" + lineNumber; |
@@ -942,9 +950,6 @@ function CallSiteToString() { |
} |
} |
- if (!fileLocation) { |
- fileLocation = "unknown source"; |
- } |
var line = ""; |
var functionName = this.getFunctionName(); |
var addSuffix = true; |