Commit ea956954 authored by Tobias Tebbi's avatar Tobias Tebbi Committed by Commit Bot

[torque] fix SpecializationRequester to not run into temporary namespaces

Bug: v8:7793
Change-Id: Ibf045274ae48bd58f8c99361f02e51860b1a4150
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1997443
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Auto-Submit: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65777}
parent 8f869a37
......@@ -67,6 +67,16 @@ std::ostream& operator<<(std::ostream& os, const GenericCallable& g) {
return os;
}
SpecializationRequester::SpecializationRequester(SourcePosition position,
Scope* scope, std::string name)
: position(position), name(std::move(name)) {
// Skip scopes that are not related to template specializations, they might be
// stack-allocated and not live for long enough.
while (scope && scope->GetSpecializationRequester().IsNone())
scope = scope->ParentScope();
this->scope = scope;
}
base::Optional<std::string> TypeConstraint::IsViolated(const Type* type) const {
if (upper_bound && !type->IsSubtypeOf(*upper_bound)) {
return {ToString("expected ", *type, " to be a subtype of ", *upper_bound)};
......
......@@ -153,6 +153,8 @@ struct SpecializationRequester {
return position == SourcePosition::Invalid() && scope == nullptr &&
name == "";
}
SpecializationRequester(SourcePosition position, Scope* scope,
std::string name);
};
class Scope : public Declarable {
......
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