-56cf388da8d04bbd3824c4df34d77a8afa69749b
+2c5188b5ad6143e791f2ba42f02a4ea7887d87b6
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
this->filename_, msg);
}
-// Return whether the current file imports "embed".
-
-bool
-Gogo::is_embed_imported() const
-{
- Packages::const_iterator p = this->packages_.find("embed");
- if (p == this->packages_.end())
- return false;
-
- // We track current file imports in the package aliases, where a
- // typical import will just list the package name in aliases. So
- // the package has been imported if there is at least one alias.
- return !p->second->aliases().empty();
-}
-
// Implement the sort order for a list of embedded files, as discussed
// at the docs for embed.FS.
imports_(),
imported_unsafe_(false),
current_file_imported_unsafe_(false),
+ current_file_imported_embed_(false),
packages_(),
init_functions_(),
var_deps_(),
return;
}
+ if (filename == "embed")
+ this->current_file_imported_embed_ = true;
+
Imports::const_iterator p = this->imports_.find(filename);
if (p != this->imports_.end())
{
}
this->current_file_imported_unsafe_ = false;
+ this->current_file_imported_embed_ = false;
}
// Queue up a type-specific hash function for later writing. These
void
read_embedcfg(const char* filename);
- // Return whether the current file imports "embed".
- bool
- is_embed_imported() const;
-
// Build an initializer for a variable with a go:embed directive.
Expression*
initializer_for_embeds(Type*, const std::vector<std::string>*, Location);
current_file_imported_unsafe() const
{ return this->current_file_imported_unsafe_; }
+ // Return whether the current file imported the embed package.
+ bool
+ current_file_imported_embed() const
+ { return this->current_file_imported_embed_; }
+
// Clear out all names in file scope. This is called when we start
// parsing a new file.
void
bool imported_unsafe_;
// Whether the magic unsafe package was imported by the current file.
bool current_file_imported_unsafe_;
+ // Whether the embed package was imported by the current file.
+ bool current_file_imported_embed_;
// Mapping from package names we have seen to packages. This does
// not include the package we are compiling.
Packages packages_;
embeds = new(std::vector<std::string>);
this->lex_->get_and_clear_embeds(embeds);
- if (!this->gogo_->is_embed_imported())
+ if (!this->gogo_->current_file_imported_embed())
{
go_error_at(token->location(),
"invalid go:embed: missing import %<embed%>");