diff options
author | Liam Miller-Cushon <cushon@google.com> | 2021-09-30 17:57:16 -0700 |
---|---|---|
committer | Javac Team <javac-team+copybara@google.com> | 2021-09-30 17:57:51 -0700 |
commit | e5a1173a63ef32d670bc6a3ba8969bb954f9b7f6 (patch) | |
tree | 58498ded635423eb9ac2b2a9a11e568b4ad2548c | |
parent | cb6006005b4b3196a29d87775245076c2205ef10 (diff) | |
download | turbine-e5a1173a63ef32d670bc6a3ba8969bb954f9b7f6.tar.gz |
Handle record pseudo-keywords earlier
PiperOrigin-RevId: 400071735
-rw-r--r-- | java/com/google/turbine/parse/Parser.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/java/com/google/turbine/parse/Parser.java b/java/com/google/turbine/parse/Parser.java index 2a60cc3..ea41bba 100644 --- a/java/com/google/turbine/parse/Parser.java +++ b/java/com/google/turbine/parse/Parser.java @@ -664,6 +664,15 @@ public class Parser { } case IDENT: + Ident ident = ident(); + if (ident.value().equals("record")) { + eat(Token.IDENT); + acc.add(recordDeclaration(access, annos.build())); + access = EnumSet.noneOf(TurbineModifier.class); + annos = ImmutableList.builder(); + break; + } + // fall through case BOOLEAN: case BYTE: case SHORT: @@ -750,9 +759,6 @@ public class Parser { { int pos = position; Ident ident = eatIdent(); - if (ident.value().equals("record")) { - return ImmutableList.of(recordDeclaration(access, annos)); - } switch (token) { case LPAREN: { |