diff options
Diffstat (limited to 'aidl_language_y.yy')
-rw-r--r-- | aidl_language_y.yy | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/aidl_language_y.yy b/aidl_language_y.yy index 8273815d..64d9f437 100644 --- a/aidl_language_y.yy +++ b/aidl_language_y.yy @@ -519,11 +519,18 @@ constant_value_non_empty_list ; constant_decl - : CONST type identifier '=' const_expr ';' { - $2->SetComments($1->GetComments()); - $$ = new AidlConstantDeclaration(loc(@3), $2, $3->GetText(), $5); + : annotation_list CONST type identifier '=' const_expr ';' { + if ($1->size() > 0) { + $3->SetComments($1->begin()->GetComments()); + } else { + $3->SetComments($2->GetComments()); + } + // TODO(b/151102494) do not merge annotations. + $3->Annotate(std::move(*$1)); + $$ = new AidlConstantDeclaration(loc(@4), $3, $4->GetText(), $6); delete $1; - delete $3; + delete $2; + delete $4; } ; |