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

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

Issue 1125143004: DevTools: [PrettyPrint] support template literals in pretty-printing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: address comments Created 5 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
« no previous file with comments | « Source/devtools/front_end/script_formatter_worker/ESTreeWalker.js ('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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 if (AT.keyword(token, "do")) 233 if (AT.keyword(token, "do"))
234 return blockBody ? "ts" : "tn>"; 234 return blockBody ? "ts" : "tn>";
235 if (AT.keyword(token, "while")) 235 if (AT.keyword(token, "while"))
236 return blockBody ? "sts" : "n<ts"; 236 return blockBody ? "sts" : "n<ts";
237 } else if (node.type === "ClassBody") { 237 } else if (node.type === "ClassBody") {
238 if (AT.punctuator(token, "{")) 238 if (AT.punctuator(token, "{"))
239 return "stn>"; 239 return "stn>";
240 if (AT.punctuator(token, "}")) 240 if (AT.punctuator(token, "}"))
241 return "<ntn"; 241 return "<ntn";
242 return "t"; 242 return "t";
243 } else if (node.type === "YieldExpression") {
244 return "t";
245 } else if (node.type === "Super") {
246 return "t";
243 } 247 }
244 return AT.keyword(token) && !AT.keyword(token, "this") ? "ts" : "t"; 248 return AT.keyword(token) && !AT.keyword(token, "this") ? "ts" : "t";
245 }, 249 },
246 250
247 /** 251 /**
248 * @param {!ESTree.Node} node 252 * @param {!ESTree.Node} node
249 * @return {string} 253 * @return {string}
250 */ 254 */
251 _finishNode: function(node) 255 _finishNode: function(node)
252 { 256 {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 _addMappingIfNeeded: function(originalPosition) 416 _addMappingIfNeeded: function(originalPosition)
413 { 417 {
414 if (originalPosition - this._lastOriginalPosition === this._formattedCon tentLength - this._lastFormattedPosition) 418 if (originalPosition - this._lastOriginalPosition === this._formattedCon tentLength - this._lastFormattedPosition)
415 return; 419 return;
416 this._mapping.original.push(this._originalOffset + originalPosition); 420 this._mapping.original.push(this._originalOffset + originalPosition);
417 this._lastOriginalPosition = originalPosition; 421 this._lastOriginalPosition = originalPosition;
418 this._mapping.formatted.push(this._formattedOffset + this._formattedCont entLength); 422 this._mapping.formatted.push(this._formattedOffset + this._formattedCont entLength);
419 this._lastFormattedPosition = this._formattedContentLength; 423 this._lastFormattedPosition = this._formattedContentLength;
420 } 424 }
421 } 425 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/script_formatter_worker/ESTreeWalker.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698