Commit 2974ecda by Ian Lance Taylor

compiler: only import variable into . if same package

    
    If we dot-import a package, we should only add an imported variable to
    the package bindings if the variable is in the package being imported.
    A test case for this is the 1.13 os package, in which ErrClosed and
    friends are defined both locally and in the imported internal/oserror package.
    
    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/192718

From-SVN: r275358
parent 64be2b26
3b8a505824abb2a69f4c04c555a4ba29ab8b102b ca0fdb4c7735a648b8f10f1248631adf9afb8454
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.
...@@ -777,7 +777,7 @@ Import::import_var() ...@@ -777,7 +777,7 @@ Import::import_var()
this->location_); this->location_);
Named_object* no; Named_object* no;
no = vpkg->add_variable(name, var); no = vpkg->add_variable(name, var);
if (this->add_to_globals_) if (this->add_to_globals_ && vpkg == this->package_)
this->gogo_->add_dot_import_object(no); this->gogo_->add_dot_import_object(no);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment