Lines Matching defs:package

269 // Get the package path to use for type reflection data.  This should
279 // Set the package path from the -fgo-pkgpath command line option.
290 // Get the package path to use for symbol names.
299 // Set the unique prefix to use to determine the package path, from
318 // Get the package name.
327 // Set the package name.
336 error_at(location, "expected package %<%s%>",
341 // Now that we know the name of the package we are compiling, set
342 // the package path to use for reflect.Type.PkgPath and global
379 // Return whether this is the "main" package. This is not true if
390 // Import a package.
450 error_at(location, "cannot import package as init");
461 Package* package = p->second;
462 package->set_location(location);
463 package->set_is_imported();
468 ln = package->package_name();
474 Bindings* bindings = package->bindings();
482 package->set_uses_sink_alias();
486 this->package_->bindings()->add_package(ln, package);
501 Package* package = imp.import(this, local_name, is_local_name_exported);
502 if (package != NULL)
504 if (package->pkgpath() == this->pkgpath())
506 ("imported package uses same package path as package "
509 this->imports_.insert(std::make_pair(filename, package));
510 package->set_is_imported();
516 // Add an import control function for an imported package to the list.
529 // If a test of package P1, built as part of package P1,
530 // imports package P2, and P2 imports P1 (perhaps
536 error("duplicate package initialization name %qs",
538 inform(UNKNOWN_LOCATION, "used by package %qs at priority %d",
541 inform(UNKNOWN_LOCATION, " and by package %qs at priority %d",
667 // package.
892 // package.
935 if (v->is_variable() && v->package() == NULL)
960 if (f->is_function() && f->package() == NULL)
1263 // There is nothing to do for a package.
1268 // a different package into the global scope.
1269 if (no->package() != NULL)
1429 // This will be called if this package is imported.
1490 if (ret->package() != NULL)
1491 ret->package()->note_usage();
1498 // package scope which we have not yet seen. Instead,
1500 // undefined names at package scope with names defined at global
1525 // Add an imported package.
1562 // Register a package. This package may or may not be imported. This
1563 // returns the Package structure for the package, creating if it
1565 // led us to see this package. PKGPATH_SYMBOL is the symbol to use
1566 // for names in the package; it may be the empty string, in which case
1573 Package* package = NULL;
1575 this->packages_.insert(std::make_pair(pkgpath, package));
1578 // We have seen this package name before.
1579 package = ins.first->second;
1580 go_assert(package != NULL && package->pkgpath() == pkgpath);
1582 package->set_pkgpath_symbol(pkgpath_symbol);
1583 if (Linemap::is_unknown_location(package->location()))
1584 package->set_location(location);
1588 // First time we have seen this package name.
1589 package = new Package(pkgpath, pkgpath_symbol, location);
1591 ins.first->second = package;
1594 return package;
1993 // Declare a type at the package level.
2001 // Declare a function at the package level.
2057 if (e != NULL && e->package() == NULL)
2061 if (e->package() == NULL
2181 // Give an error if any name is defined in both the package block
2207 // No package scope identifier may be named "init".
2230 Package* package = p->second;
2231 if (package != this->package_
2232 && package->is_imported()
2233 && !package->used()
2234 && !package->uses_sink_alias()
2236 error_at(package->location(), "imported and not used: %s",
2237 Gogo::message_name(package->package_name()).c_str());
2238 package->clear_is_imported();
2239 package->clear_uses_sink_alias();
2240 package->clear_used();
2305 // If this type is defined in another package, then we don't
2307 bool is_defined_elsewhere = nt->named_object()->package() != NULL;
2364 // Traverse the current package first for consistency. The other
2784 // declared in this package. This is so that we have a descriptor
2863 // If this type is defined in a different package, then finalize the
2865 if (nt->named_object()->package() != NULL && nt->has_any_methods())
2879 if (nt->named_object()->package() == NULL
4173 // package for a type defined in that package. If that interface and
4271 // If this package imports unsafe, then it may play games with
4323 // Work out the package priority. It is one more than the maximum
4324 // priority of an imported package.
4413 Package* package = p->second;
4414 this->convert_named_types_in_bindings(package->bindings());
4975 if (no->package() != NULL)
5005 // use the pkgpath of the imported package to avoid
5084 asm_name = (no->package() == NULL
5086 : no->package()->pkgpath_symbol());
5108 // necessarily happen if the package has just a declaration for the
6269 const Package* package, const std::string& name)
6277 && (!this->is_global_ || package == NULL)))
6297 bvar = backend->global_variable((package == NULL
6299 : package->package_name()),
6300 (package == NULL
6302 : package->pkgpath_symbol()),
6305 package != NULL,
6486 Package* package,
6490 Named_object* ret = Named_object::make_function_declaration(name, package,
6540 const Package* package,
6542 : name_(name), package_(package), classification_(classification)
6550 // package.
6567 const Package* package, Expression* expr,
6570 Named_object* named_object = new Named_object(tid.name(), package,
6582 Named_object::make_type(const std::string& name, const Package* package,
6585 Named_object* named_object = new Named_object(name, package,
6596 const Package* package,
6599 Named_object* named_object = new Named_object(name, package,
6609 Named_object::make_variable(const std::string& name, const Package* package,
6612 Named_object* named_object = new Named_object(name, package,
6641 Named_object::make_function(const std::string& name, const Package* package,
6644 Named_object* named_object = new Named_object(name, package,
6654 const Package* package,
6658 Named_object* named_object = new Named_object(name, package,
6665 // Make a package.
6668 Named_object::make_package(const std::string& alias, Package* package)
6672 named_object->u_.package_value = package;
6862 // We don't need the package name for builtin types.
6875 // the unexported method should have the package name of the
6876 // package from which it is imported, but we are going to give
6877 // it our package name. Fixing this would require knowing the
6878 // package name, but we only know the package path. It might be
6879 // better to use package paths here anyhow. This doesn't affect
7001 if (p->second->package() != NULL)
7095 if (named_object->package() != NULL
7096 && ins.first->second->package() == named_object->package()
7252 Bindings::add_function(const std::string& name, const Package* package,
7255 return this->add_named_object(Named_object::make_function(name, package,
7263 const Package* package,
7267 Named_object* no = Named_object::make_function_declaration(name, package,
7521 // Set the package name.
7531 "saw two different packages with the same package path %s: %s, %s",
7537 // this package.
7547 // Set the package path symbol.
7560 // package; we want to use the largest one.
7569 // Forget a given usage. If forgetting this usage means this package becomes
7587 // Clear the used field for the next file. If the only usages of this package
7599 // Determine types of constants. Everything else in a package