           declareImported ctx, name
       else
         malformed ctx, arg, 'Name required'
-  irImport moduleName, (setToArray requiredNames), moduleNameAtom
+  irImport moduleName, naming, moduleNameAtom
 
 resolveModuleName = (ctx, declaredModuleName) ->
   modulePathToName (resolveModulePathFrom ctx.typedModulePath.names,


injectedContext = (modulesToInject, shouldDeclare) ->
  ctx = new Context
  for moduleName, names of values modulesToInject when compiled = lookupCompiledModule moduleName
    injectContext ctx, shouldDeclare, compiled.declared, moduleName, names
  ctx

injectContext = (ctx, shouldDeclare, compiledModule, moduleName, names) ->
  {definitions, typeNames, classes, macros} = compiledModule
  topScope = ctx._scope()
  shouldImport = (name) -> not names.size or inSet names, name
  for name, macro of values macros when shouldImport name
    if ctx.isMacroDeclared name
      throw new Error "Macro #{name} already defined"
    else
      addToMap topScope.macros, name, macro
  for name, {type, arity, docs, source, isClass, virtual, final, exported} of values definitions when shouldImport name
    addToMap topScope, name, {
      arity, docs, source, isClass, virtual, final,
      type: (type if shouldDeclare)
      tempType: type

  modules: setToArray modules

moduleDependencies = (moduleName) ->
  concatSets (requiresFor moduleName), (newMapWith moduleName, importAll: yes)

reverseModuleDependencies = (moduleName) ->
  concatSets (newMapWith moduleName, importAll: yes), (requiresFor moduleName)

runtimeDependencies = (moduleName) ->
  concatSets (collectRequiresFor moduleName), (newSetWith moduleName)

modulePathToName = (path) ->
  path.join '/'
