From 9f2b73904618125ea0826c4910191065b41946b9 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 5 Jun 2015 23:00:50 +0100 Subject: [PATCH] improve Scope#dump to print binding info --- src/babel/traversal/scope/index.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/babel/traversal/scope/index.js b/src/babel/traversal/scope/index.js index f60db41e54..9a6bf1f034 100644 --- a/src/babel/traversal/scope/index.js +++ b/src/babel/traversal/scope/index.js @@ -1,4 +1,5 @@ import includes from "lodash/collection/includes"; +import repeating from "repeating"; import type NodePath from "../path"; import type File from "../../transformation/file"; import traverse from "../index"; @@ -392,11 +393,20 @@ export default class Scope { */ dump() { + var sep = repeating("-", 60); + console.log(sep); var scope = this; do { - console.log(scope.block.type, "Bindings:", Object.keys(scope.bindings)); + console.log("#", scope.block.type); + for (var name in scope.bindings) { + var binding = scope.bindings[name]; + console.log(" -", name, { + constant: binding.constant, + references: binding.references + }); + } } while(scope = scope.parent); - console.log("-------------"); + console.log(sep); } /**