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

Unified Diff: third_party/WebKit/Source/devtools/front_end/script_formatter_worker/ESTreeWalker.js

Issue 1653053002: Devtools: parse variables scopes and sourcemap them (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/script_formatter_worker/ESTreeWalker.js
diff --git a/third_party/WebKit/Source/devtools/front_end/script_formatter_worker/ESTreeWalker.js b/third_party/WebKit/Source/devtools/front_end/script_formatter_worker/ESTreeWalker.js
deleted file mode 100644
index 243b89f0ba2f2de94f96f534869b8c2824d3fc78..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/devtools/front_end/script_formatter_worker/ESTreeWalker.js
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright (c) 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @constructor
- * @param {function(!ESTree.Node)} beforeVisit
- * @param {function(!ESTree.Node)} afterVisit
- */
-FormatterWorker.ESTreeWalker = function(beforeVisit, afterVisit)
-{
- this._beforeVisit = beforeVisit;
- this._afterVisit = afterVisit;
-}
-
-FormatterWorker.ESTreeWalker.prototype = {
- /**
- * @param {!ESTree.Node} ast
- */
- walk: function(ast)
- {
- this._innerWalk(ast, null);
- },
-
- /**
- * @param {!ESTree.Node} node
- * @param {?ESTree.Node} parent
- */
- _innerWalk: function(node, parent)
- {
- if (!node)
- return;
- node.parent = parent;
-
- this._beforeVisit.call(null, node);
-
- var walkOrder = FormatterWorker.ESTreeWalker._walkOrder[node.type];
- if (!walkOrder) {
- console.error("Walk order not defined for " + node.type);
- return;
- }
-
- if (node.type === "TemplateLiteral") {
- var templateLiteral = /** @type {!ESTree.TemplateLiteralNode} */ (node);
- var expressionsLength = templateLiteral.expressions.length;
- for (var i = 0; i < expressionsLength; ++i) {
- this._innerWalk(templateLiteral.quasis[i], templateLiteral);
- this._innerWalk(templateLiteral.expressions[i], templateLiteral);
- }
- this._innerWalk(templateLiteral.quasis[expressionsLength], templateLiteral);
- } else {
- for (var i = 0; i < walkOrder.length; ++i) {
- var entity = node[walkOrder[i]];
- if (Array.isArray(entity))
- this._walkArray(entity, node);
- else
- this._innerWalk(entity, node);
- }
- }
-
- this._afterVisit.call(null, node);
- },
-
- /**
- * @param {!Array.<!ESTree.Node>} nodeArray
- * @param {?ESTree.Node} parentNode
- */
- _walkArray: function(nodeArray, parentNode)
- {
- for (var i = 0; i < nodeArray.length; ++i)
- this._innerWalk(nodeArray[i], parentNode);
- },
-}
-
-/** @enum {!Array.<string>} */
-FormatterWorker.ESTreeWalker._walkOrder = {
- "ArrayExpression": ["elements"],
- "ArrowFunctionExpression": ["params", "body"],
- "AssignmentExpression": ["left", "right"],
- "BinaryExpression": ["left", "right"],
- "BlockStatement": ["body"],
- "BreakStatement": ["label"],
- "CallExpression": ["callee", "arguments"],
- "CatchClause": ["param", "body"],
- "ClassBody": ["body"],
- "ClassDeclaration": ["id", "superClass", "body"],
- "ConditionalExpression": ["test", "consequent", "alternate"],
- "ContinueStatement": ["label"],
- "DebuggerStatement": [],
- "DoWhileStatement": ["body", "test"],
- "EmptyStatement": [],
- "ExpressionStatement": ["expression"],
- "ForInStatement": ["left", "right", "body"],
- "ForOfStatement": ["left", "right", "body"],
- "ForStatement": ["init", "test", "update", "body"],
- "FunctionDeclaration": ["id", "params", "body"],
- "FunctionExpression": ["id", "params", "body"],
- "Identifier": [],
- "IfStatement": ["test", "consequent", "alternate"],
- "LabeledStatement": ["label", "body"],
- "Literal": [],
- "LogicalExpression": ["left", "right"],
- "MemberExpression": ["object", "property"],
- "MethodDefinition": ["key", "value"],
- "NewExpression": ["callee", "arguments"],
- "ObjectExpression": ["properties"],
- "Program": ["body"],
- "Property": ["key", "value"],
- "ReturnStatement": ["argument"],
- "SequenceExpression": ["expressions"],
- "Super": [],
- "SwitchCase": ["test", "consequent"],
- "SwitchStatement": ["discriminant", "cases"],
- "TaggedTemplateExpression": ["tag", "quasi"],
- "TemplateElement": [],
- "TemplateLiteral": ["quasis", "expressions"],
- "ThisExpression": [],
- "ThrowStatement": ["argument"],
- "TryStatement": ["block", "handler", "finalizer"],
- "UnaryExpression": ["argument"],
- "UpdateExpression": ["argument"],
- "VariableDeclaration": ["declarations"],
- "VariableDeclarator": ["id", "init"],
- "WhileStatement": ["test", "body"],
- "WithStatement": ["object", "body"],
- "YieldExpression": ["argument"]
-}

Powered by Google App Engine
This is Rietveld 408576698