Support collecting ALL component declarations from a used scope.
This commit is contained in:
parent
e017ccb5d2
commit
303f057de1
|
|
@ -91,7 +91,7 @@ void library_use(const YYLTYPE&loc, struct library_results&res,
|
||||||
// results into the "res" members.
|
// results into the "res" members.
|
||||||
|
|
||||||
if (use_name == "all") {
|
if (use_name == "all") {
|
||||||
sorrymsg(loc, "Don't support all from package\n");
|
pack->collect_components(res.components);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -982,11 +982,13 @@ selected_name_use
|
||||||
: IDENTIFIER '.' K_all
|
: IDENTIFIER '.' K_all
|
||||||
{ struct library_results res;
|
{ struct library_results res;
|
||||||
library_use(@1, res, 0, $1, 0);
|
library_use(@1, res, 0, $1, 0);
|
||||||
|
collect_library_results(res);
|
||||||
delete[]$1;
|
delete[]$1;
|
||||||
}
|
}
|
||||||
| IDENTIFIER '.' IDENTIFIER '.' K_all
|
| IDENTIFIER '.' IDENTIFIER '.' K_all
|
||||||
{ struct library_results res;
|
{ struct library_results res;
|
||||||
library_use(@1, res, $1, $3, 0);
|
library_use(@1, res, $1, $3, 0);
|
||||||
|
collect_library_results(res);
|
||||||
delete[]$1;
|
delete[]$1;
|
||||||
delete[]$3;
|
delete[]$3;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,3 +38,13 @@ ComponentBase* Scope::find_component(perm_string by_name)
|
||||||
else
|
else
|
||||||
return cur->second;
|
return cur->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Scope::collect_components(list<ComponentBase*>&res)
|
||||||
|
{
|
||||||
|
for (map<perm_string,ComponentBase*>::const_iterator cur = components_.begin()
|
||||||
|
; cur != components_.end() ; ++cur) {
|
||||||
|
if (cur->second == 0)
|
||||||
|
continue;
|
||||||
|
res.push_back(cur->second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
# include <list>
|
||||||
# include <map>
|
# include <map>
|
||||||
# include "StringHeap.h"
|
# include "StringHeap.h"
|
||||||
|
|
||||||
|
|
@ -33,6 +34,8 @@ class Scope {
|
||||||
|
|
||||||
ComponentBase* find_component(perm_string by_name);
|
ComponentBase* find_component(perm_string by_name);
|
||||||
|
|
||||||
|
void collect_components(std::list<ComponentBase*>&res);
|
||||||
|
|
||||||
void dump_scope(ostream&out) const;
|
void dump_scope(ostream&out) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue