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

Side by Side Diff: Source/devtools/front_end/script_formatter_worker/JavaScriptFormatter.js

Issue 1312033002: DevTools: fix pretty-print of anonymous functions passed as call parameters (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix stray changes Created 5 years, 4 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
« no previous file with comments | « LayoutTests/inspector/sources/pretty-print-javascript-6-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 if (!this._inForLoopHeader(node)) 261 if (!this._inForLoopHeader(node))
262 return "n"; 262 return "n";
263 } else if (node.type === "ForStatement" || node.type === "ForOfStatement " || node.type === "ForInStatement") { 263 } else if (node.type === "ForStatement" || node.type === "ForOfStatement " || node.type === "ForInStatement") {
264 if (node.body && node.body.type !== "BlockStatement") 264 if (node.body && node.body.type !== "BlockStatement")
265 return "n<"; 265 return "n<";
266 } else if (node.type === "BlockStatement") { 266 } else if (node.type === "BlockStatement") {
267 if (node.parent && node.parent.type === "IfStatement" && node.parent .alternate && node.parent.consequent === node) 267 if (node.parent && node.parent.type === "IfStatement" && node.parent .alternate && node.parent.consequent === node)
268 return ""; 268 return "";
269 if (node.parent && node.parent.type === "FunctionExpression" && node .parent.parent && node.parent.parent.type === "Property") 269 if (node.parent && node.parent.type === "FunctionExpression" && node .parent.parent && node.parent.parent.type === "Property")
270 return ""; 270 return "";
271 if (node.parent && node.parent.type === "FunctionExpression" && node .parent.parent && node.parent.parent.type === "CallExpression")
272 return "";
271 if (node.parent && node.parent.type === "DoWhileStatement") 273 if (node.parent && node.parent.type === "DoWhileStatement")
272 return ""; 274 return "";
273 if (node.parent && node.parent.type === "TryStatement" && node.paren t.block == node) 275 if (node.parent && node.parent.type === "TryStatement" && node.paren t.block == node)
274 return "s"; 276 return "s";
275 if (node.parent && node.parent.type === "CatchClause" && node.parent .parent.finalizer) 277 if (node.parent && node.parent.type === "CatchClause" && node.parent .parent.finalizer)
276 return "s"; 278 return "s";
277 return "n"; 279 return "n";
278 } else if (node.type === "WhileStatement") { 280 } else if (node.type === "WhileStatement") {
279 if (node.body && node.body.type !== "BlockStatement") 281 if (node.body && node.body.type !== "BlockStatement")
280 return "n<"; 282 return "n<";
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 _addMappingIfNeeded: function(originalPosition) 418 _addMappingIfNeeded: function(originalPosition)
417 { 419 {
418 if (originalPosition - this._lastOriginalPosition === this._formattedCon tentLength - this._lastFormattedPosition) 420 if (originalPosition - this._lastOriginalPosition === this._formattedCon tentLength - this._lastFormattedPosition)
419 return; 421 return;
420 this._mapping.original.push(this._originalOffset + originalPosition); 422 this._mapping.original.push(this._originalOffset + originalPosition);
421 this._lastOriginalPosition = originalPosition; 423 this._lastOriginalPosition = originalPosition;
422 this._mapping.formatted.push(this._formattedOffset + this._formattedCont entLength); 424 this._mapping.formatted.push(this._formattedOffset + this._formattedCont entLength);
423 this._lastFormattedPosition = this._formattedContentLength; 425 this._lastFormattedPosition = this._formattedContentLength;
424 } 426 }
425 } 427 }
OLDNEW
« no previous file with comments | « LayoutTests/inspector/sources/pretty-print-javascript-6-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698