added input next to the dumped scope
MODIFY
packages/@romejs/compiler/scope/Scope.test.md
packages/@romejs/compiler/scope/Scope.test.md
### `0`
```
+# Input
+ var foo;
+
# Scope root
## Child Scopes
# Scope program
### `1`
```
+# Input
+ function foo() {
+ var bar;
+
+ {
+ var car;
+ }
+}
+
# Scope root
## Child Scopes
# Scope program

MODIFY
packages/@romejs/compiler/scope/Scope.test.ts
packages/@romejs/compiler/scope/Scope.test.ts
@@ -10,8 +10,17 @@ function indent(str: string): string {
return ` ${str.split("\n").join("\n\t")}`;
}
-function dumpScope(scope: Scope, childScopeMap: ChildScopeMap): string {
- const lines = [scope.dump()];
+function dumpScope(
+ scope: Scope,
+ childScopeMap: ChildScopeMap,
+ input?: string,
+): string {
+ const lines = [];
+
+ if (input) {
+ lines.push(`# Input \n ${input} \n`);
+ }
+ lines.push(scope.dump());
const childScopeNodes = childScopeMap.get(scope);
if (childScopeNodes !== undefined) {
@@ -53,7 +62,7 @@ function dumpScopeTree(input: string): string {
},
);
- return dumpScope(context.rootScope, scopeToChildScopes);
+ return dumpScope(context.rootScope, scopeToChildScopes, input);
}
test(

added input next to the dumped scope (#592)