}
void InstantiateHelper::InstantiateComponents(const Scope &fromScope) {
- for (const auto &pair : fromScope) {
- InstantiateComponent(*pair.second);
+ // Instantiate symbols in declaration order; this ensures that
+ // parent components and type parameters of ancestor types exist
+ // by the time that they're needed.
+ for (SymbolRef ref : fromScope.GetSymbols()) {
+ InstantiateComponent(*ref);
}
ComputeOffsets(context(), scope_);
}
void Post(const parser::Name &name) {
if (name.symbol && name.symbol->has<TypeParamDetails>()) {
- name.symbol = scope_.FindSymbol(name.source);
+ name.symbol = scope_.FindComponent(name.source);
}
}