}
}
}
static ManyVarsDynamicScope getManyVarsDynamicScope(ScriptingContainer container, int depth) {
ManyVarsDynamicScope scope;
StaticScopeFactory scopeFactory = container.getProvider().getRuntime().getStaticScopeFactory();
// root our parsing scope with a dummy scope
StaticScope topStaticScope = scopeFactory.newLocalScope(null);
topStaticScope.setModule(container.getProvider().getRuntime().getObject());
DynamicScope currentScope = new ManyVarsDynamicScope(topStaticScope, null);
String[] names4Injection = container.getVarMap().getLocalVarNames();
StaticScope evalScope = names4Injection == null || names4Injection.length == 0 ?
scopeFactory.newEvalScope(currentScope.getStaticScope()) :
scopeFactory.newEvalScope(currentScope.getStaticScope(), names4Injection);
scope = new ManyVarsDynamicScope(evalScope, currentScope);
// JRUBY-5501: ensure we've set up a cref for the scope too
scope.getStaticScope().determineModule();
return scope;