示例#1
0
文件: Module.cpp 项目: DawidvC/magpie
  void Module::addImports(VM& vm, ErrorReporter& reporter)
  {
    // Implicitly import core (unless we are core).
    if (*name_ != "core")
    {
      vm.importModule(reporter, this, NULL, String::create("core"));
    }

    // Load all of the imports.
    for (int i = 0; i < ast_->body()->expressions().count(); i++)
    {
      ImportExpr* import = ast_->body()->expressions()[i]->asImportExpr();
      if (import == NULL) continue;

      vm.importModule(reporter, this, import->pos(), import->name());
    }
  }