mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Remove the 'UnresolvedCallPattern' I stubbed out.
I talked to John about parsing patterns today, and because of the magnitude of name-lookup-dependent ambiguities between patterns and expressions, we agreed that at least for a first-pass implementation it makes sense to parse patterns as extensions of the expr grammar and charge name binding with distinguishing patterns from expressions. This gets us out of needing the concept of an "unresolved pattern", at least in the short term. Swift SVN r5808
This commit is contained in:
@@ -109,10 +109,6 @@ void Pattern::collectVariables(SmallVectorImpl<VarDecl *> &variables) const {
|
||||
case PatternKind::Isa:
|
||||
return;
|
||||
|
||||
case PatternKind::UnresolvedCall:
|
||||
return cast<UnresolvedCallPattern>(this)->getSubPattern()
|
||||
->collectVariables(variables);
|
||||
|
||||
case PatternKind::NominalType:
|
||||
return cast<NominalTypePattern>(this)->getSubPattern()
|
||||
->collectVariables(variables);
|
||||
@@ -175,15 +171,6 @@ Pattern *Pattern::clone(ASTContext &context) const {
|
||||
break;
|
||||
}
|
||||
|
||||
case PatternKind::UnresolvedCall: {
|
||||
auto call = cast<UnresolvedCallPattern>(this);
|
||||
result = UnresolvedCallPattern::create(context,
|
||||
call->getNameDeclContext(),
|
||||
call->getNameComponents(),
|
||||
call->getSubPattern()->clone(context));
|
||||
break;
|
||||
}
|
||||
|
||||
case PatternKind::NominalType: {
|
||||
auto nom = cast<NominalTypePattern>(this);
|
||||
result = new(context) NominalTypePattern(nom->getCastTypeLoc(),
|
||||
@@ -265,31 +252,3 @@ Pattern *TuplePattern::createSimple(ASTContext &C, SourceLoc lp,
|
||||
SourceRange TypedPattern::getSourceRange() const {
|
||||
return { SubPattern->getSourceRange().Start, PatType.getSourceRange().End };
|
||||
}
|
||||
|
||||
UnresolvedCallPattern::UnresolvedCallPattern(
|
||||
DeclContext *DC,
|
||||
ArrayRef<IdentifierType::Component> components,
|
||||
Pattern *Sub)
|
||||
: Pattern(PatternKind::UnresolvedCall),
|
||||
SubPattern(Sub),
|
||||
NumComponents(components.size())
|
||||
{
|
||||
MutableArrayRef<IdentifierType::Component> buf{getComponentsBuffer(),
|
||||
NumComponents};
|
||||
for (size_t i = 0, size = NumComponents; i < size; ++i) {
|
||||
new (&buf[i]) IdentifierType::Component(components[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/// Allocate a new UnresolvedCallPattern referring to a named path of
|
||||
/// dotted identifier components.
|
||||
UnresolvedCallPattern *
|
||||
UnresolvedCallPattern::create(ASTContext &C,
|
||||
DeclContext *DC,
|
||||
ArrayRef<IdentifierType::Component> components,
|
||||
Pattern *Sub) {
|
||||
void *buf = UnresolvedCallPattern::operator new(
|
||||
sizeof(UnresolvedCallPattern)
|
||||
+ components.size() * sizeof(IdentifierType::Component), C);
|
||||
return ::new (buf) UnresolvedCallPattern(DC, components, Sub);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user