Index: src/v8natives.js |
diff --git a/src/v8natives.js b/src/v8natives.js |
index f295c3a6de37d0f4fdc4d3aab65a854784d1e035..826ae43b64b1fd26dceafb082276c566cb7a9619 100644 |
--- a/src/v8natives.js |
+++ b/src/v8natives.js |
@@ -174,7 +174,7 @@ function GlobalEval(x) { |
'be the global object from which eval originated'); |
} |
- var f = %CompileString(x); |
+ var f = %CompileString(x, false); |
if (!IS_FUNCTION(f)) return f; |
return %_CallFunction(global_receiver, f); |
@@ -1704,14 +1704,18 @@ function NewFunction(arg1) { // length == 1 |
// character - it may make the combined function expression |
// compile. We avoid this problem by checking for this early on. |
if (p.indexOf(')') != -1) throw MakeSyntaxError('unable_to_parse',[]); |
+ // If the formal parameters include an unbalanced block comment, the |
+ // function must be rejected. Since JavaScript does not allow nested |
+ // comments we can include a trailing block comment to catch this. |
+ p += '\n/' + '**/'; |
} |
var body = (n > 0) ? ToString(%_Arguments(n - 1)) : ''; |
- var source = '(function(' + p + ') {\n' + body + '\n})'; |
+ var source = '(function(\n' + p + '\n){\n' + body + '\n})'; |
// The call to SetNewFunctionAttributes will ensure the prototype |
// property of the resulting function is enumerable (ECMA262, 15.3.5.2). |
var global_receiver = %GlobalReceiver(global); |
- var f = %_CallFunction(global_receiver, %CompileString(source)); |
+ var f = %_CallFunction(global_receiver, %CompileString(source, true)); |
%FunctionMarkNameShouldPrintAsAnonymous(f); |
return %SetNewFunctionAttributes(f); |