mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-02 07:45:49 +01:00
Track the file kind on SourceLocation rather than computing it from the file name. (#2999)
This will be more correct if a user file is named prelude.carbon, and reduces the explorer runtime by about 10% by removing a string comparison from the check for whether trace output is enabled. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
41e357492b
commit
ea60e4f491
@@ -22,14 +22,15 @@ TEST(UnimplementedExampleTest, VerifyPrecedence) {
|
||||
}
|
||||
)";
|
||||
Arena arena;
|
||||
EXPECT_THAT(ParseFromString(&arena, "dummy.carbon", Program, false),
|
||||
ParsedAs(ASTDeclarations(
|
||||
ElementsAre(MatchesFunctionDeclaration().WithBody(
|
||||
BlockContentsAre(ElementsAre(MatchesReturn(MatchesEq(
|
||||
MatchesUnimplementedExpression(
|
||||
"ExampleInfix", ElementsAre(MatchesLiteral(1),
|
||||
MatchesLiteral(2))),
|
||||
MatchesLiteral(3))))))))));
|
||||
EXPECT_THAT(
|
||||
ParseFromString(&arena, "dummy.carbon", FileKind::Main, Program, false),
|
||||
ParsedAs(
|
||||
ASTDeclarations(ElementsAre(MatchesFunctionDeclaration().WithBody(
|
||||
BlockContentsAre(ElementsAre(MatchesReturn(MatchesEq(
|
||||
MatchesUnimplementedExpression(
|
||||
"ExampleInfix",
|
||||
ElementsAre(MatchesLiteral(1), MatchesLiteral(2))),
|
||||
MatchesLiteral(3))))))))));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user