Commit a8684d5b authored by lushnikov's avatar lushnikov Committed by Commit bot

DevTools: [PrettyPrint] support arrow function

BUG=579770
R=pfeldman, dgozman

Review URL: https://codereview.chromium.org/1614563002

Cr-Commit-Position: refs/heads/master@{#370773}
parent 8408d85e
......@@ -80,3 +80,16 @@ Correct mapping for <function>
Correct mapping for <alert>
Correct mapping for <2000>
Running: arrowFunction
====== 8< ------
function test(arg) {
console.log(arg);
}
test(a=>a + 2);
------ >8 ======
Correct mapping for <function>
Correct mapping for <console>
Correct mapping for <=>>
Correct mapping for <2>
......@@ -46,6 +46,12 @@ function test()
{
var mappingQueries = ["setTimeout", "function", "alert", "2000"];
testJSFormatter("setTimeout(function(){alert(1);},2000);", mappingQueries, next);
},
function arrowFunction(next)
{
var mappingQueries = ["function", "console", "=>", "2"];
testJSFormatter("function test(arg){console.log(arg);}test(a=>a+2);", mappingQueries, next);
}
]);
}
......
......@@ -75,6 +75,7 @@ FormatterWorker.ESTreeWalker.prototype = {
/** @enum {!Array.<string>} */
FormatterWorker.ESTreeWalker._walkOrder = {
"ArrayExpression": ["elements"],
"ArrowFunctionExpression": ["params", "body"],
"AssignmentExpression": ["left", "right"],
"BinaryExpression": ["left", "right"],
"BlockStatement": ["body"],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment