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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/es_tree/ESTreeWalker.js

Issue 1887913002: DevTools: improve identifier extraction in SourceMapNamesResolver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 The Chromium 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 /** 5 /**
6 * @constructor 6 * @constructor
7 * @param {function(!ESTree.Node)} beforeVisit 7 * @param {function(!ESTree.Node)} beforeVisit
8 * @param {function(!ESTree.Node)} afterVisit 8 * @param {function(!ESTree.Node)=} afterVisit
9 */ 9 */
10 WebInspector.ESTreeWalker = function(beforeVisit, afterVisit) 10 WebInspector.ESTreeWalker = function(beforeVisit, afterVisit)
11 { 11 {
12 this._beforeVisit = beforeVisit; 12 this._beforeVisit = beforeVisit;
13 this._afterVisit = afterVisit; 13 this._afterVisit = afterVisit || new Function();
14 } 14 }
15 15
16 WebInspector.ESTreeWalker.SkipSubtree = {};
17
16 WebInspector.ESTreeWalker.prototype = { 18 WebInspector.ESTreeWalker.prototype = {
17 /** 19 /**
18 * @param {!ESTree.Node} ast 20 * @param {!ESTree.Node} ast
19 */ 21 */
20 walk: function(ast) 22 walk: function(ast)
21 { 23 {
22 this._innerWalk(ast, null); 24 this._innerWalk(ast, null);
23 }, 25 },
24 26
25 /** 27 /**
26 * @param {!ESTree.Node} node 28 * @param {!ESTree.Node} node
27 * @param {?ESTree.Node} parent 29 * @param {?ESTree.Node} parent
28 */ 30 */
29 _innerWalk: function(node, parent) 31 _innerWalk: function(node, parent)
30 { 32 {
31 if (!node) 33 if (!node)
32 return; 34 return;
33 node.parent = parent; 35 node.parent = parent;
34 36
35 this._beforeVisit.call(null, node); 37 if (this._beforeVisit.call(null, node) === WebInspector.ESTreeWalker.Ski pSubtree) {
38 this._afterVisit.call(null, node);
39 return;
40 }
36 41
37 var walkOrder = WebInspector.ESTreeWalker._walkOrder[node.type]; 42 var walkOrder = WebInspector.ESTreeWalker._walkOrder[node.type];
38 if (!walkOrder) { 43 if (!walkOrder) {
39 console.error("Walk order not defined for " + node.type); 44 console.error("Walk order not defined for " + node.type);
40 return; 45 return;
41 } 46 }
42 47
43 if (node.type === "TemplateLiteral") { 48 if (node.type === "TemplateLiteral") {
44 var templateLiteral = /** @type {!ESTree.TemplateLiteralNode} */ (no de); 49 var templateLiteral = /** @type {!ESTree.TemplateLiteralNode} */ (no de);
45 var expressionsLength = templateLiteral.expressions.length; 50 var expressionsLength = templateLiteral.expressions.length;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 "ThrowStatement": ["argument"], 123 "ThrowStatement": ["argument"],
119 "TryStatement": ["block", "handler", "finalizer"], 124 "TryStatement": ["block", "handler", "finalizer"],
120 "UnaryExpression": ["argument"], 125 "UnaryExpression": ["argument"],
121 "UpdateExpression": ["argument"], 126 "UpdateExpression": ["argument"],
122 "VariableDeclaration": ["declarations"], 127 "VariableDeclaration": ["declarations"],
123 "VariableDeclarator": ["id", "init"], 128 "VariableDeclarator": ["id", "init"],
124 "WhileStatement": ["test", "body"], 129 "WhileStatement": ["test", "body"],
125 "WithStatement": ["object", "body"], 130 "WithStatement": ["object", "body"],
126 "YieldExpression": ["argument"] 131 "YieldExpression": ["argument"]
127 } 132 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/common/Text.js ('k') | third_party/WebKit/Source/devtools/front_end/externs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698