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

Side by Side Diff: src/v8natives.js

Issue 160073006: Implement handling of arrow functions in the parser (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Extra parens in parameter lists now recognized, no longer segfaults on "()" Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file relies on the fact that the following declarations have been made 5 // This file relies on the fact that the following declarations have been made
6 // in runtime.js: 6 // in runtime.js:
7 // var $Object = global.Object; 7 // var $Object = global.Object;
8 // var $Boolean = global.Boolean; 8 // var $Boolean = global.Boolean;
9 // var $Number = global.Number; 9 // var $Number = global.Number;
10 // var $Function = global.Function; 10 // var $Function = global.Function;
(...skipping 1717 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 if (!IS_STRING(source) || %FunctionIsBuiltin(func)) { 1728 if (!IS_STRING(source) || %FunctionIsBuiltin(func)) {
1729 var name = %FunctionGetName(func); 1729 var name = %FunctionGetName(func);
1730 if (name) { 1730 if (name) {
1731 // Mimic what KJS does. 1731 // Mimic what KJS does.
1732 return 'function ' + name + '() { [native code] }'; 1732 return 'function ' + name + '() { [native code] }';
1733 } else { 1733 } else {
1734 return 'function () { [native code] }'; 1734 return 'function () { [native code] }';
1735 } 1735 }
1736 } 1736 }
1737 1737
1738 if (%FunctionIsArrow(func))
1739 return source;
1740
1738 var name = %FunctionNameShouldPrintAsAnonymous(func) 1741 var name = %FunctionNameShouldPrintAsAnonymous(func)
1739 ? 'anonymous' 1742 ? 'anonymous'
1740 : %FunctionGetName(func); 1743 : %FunctionGetName(func);
1741 var head = %FunctionIsGenerator(func) ? 'function* ' : 'function '; 1744 var head = %FunctionIsGenerator(func) ? 'function* ' : 'function ';
1742 return head + name + source; 1745 return head + name + source;
1743 } 1746 }
1744 1747
1745 1748
1746 function FunctionToString() { 1749 function FunctionToString() {
1747 return FunctionSourceString(this); 1750 return FunctionSourceString(this);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1854 %SetCode($Function, FunctionConstructor); 1857 %SetCode($Function, FunctionConstructor);
1855 %SetProperty($Function.prototype, "constructor", $Function, DONT_ENUM); 1858 %SetProperty($Function.prototype, "constructor", $Function, DONT_ENUM);
1856 1859
1857 InstallFunctions($Function.prototype, DONT_ENUM, $Array( 1860 InstallFunctions($Function.prototype, DONT_ENUM, $Array(
1858 "bind", FunctionBind, 1861 "bind", FunctionBind,
1859 "toString", FunctionToString 1862 "toString", FunctionToString
1860 )); 1863 ));
1861 } 1864 }
1862 1865
1863 SetUpFunction(); 1866 SetUpFunction();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698