mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
Drop GetDeclContext from parse, errors will be diagnosed in check (#3468)
The criteria being enforced is not correct since `final` and `default` functions in interfaces have definitions.
This commit is contained in:
@@ -46,18 +46,6 @@ auto HandleFunctionSignatureFinish(Context& context) -> void {
|
||||
break;
|
||||
}
|
||||
case Lex::TokenKind::OpenCurlyBrace: {
|
||||
if (auto decl_context = context.GetDeclContext();
|
||||
decl_context == Context::DeclContext::Interface ||
|
||||
decl_context == Context::DeclContext::NamedConstraint) {
|
||||
CARBON_DIAGNOSTIC(
|
||||
MethodImplNotAllowed, Error,
|
||||
"Method implementations are not allowed in interfaces.");
|
||||
context.emitter().Emit(*context.position(), MethodImplNotAllowed);
|
||||
context.RecoverFromDeclError(state, NodeKind::FunctionDecl,
|
||||
/*skip_past_likely_end=*/true);
|
||||
break;
|
||||
}
|
||||
|
||||
context.AddNode(NodeKind::FunctionDefinitionStart, context.Consume(),
|
||||
state.subtree_start, state.has_error);
|
||||
// Any error is recorded on the FunctionDefinitionStart.
|
||||
|
||||
Reference in New Issue
Block a user