Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit d5405d0

Browse files
askeksacommit-bot@chromium.org
authored andcommitted
[cfe] Allow local const variables as annotations.
Fixes dart-lang/sdk#37065 Change-Id: If902bd22fc6e0925c361a31e22b32d046ea4754e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103628 Commit-Queue: Aske Simon Christensen <[email protected]> Reviewed-by: Lasse R.H. Nielsen <[email protected]>
1 parent 0d0f01a commit d5405d0

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

pkg/front_end/lib/src/fasta/kernel/body_builder.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,8 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
509509
}
510510

511511
ConstantContext savedConstantContext = pop();
512-
if (expression is! StaticAccessGenerator) {
512+
if (expression is! StaticAccessGenerator &&
513+
expression is! VariableUseGenerator) {
513514
push(wrapInProblem(
514515
toValue(expression), fasta.messageExpressionNotMetadata, noLength));
515516
} else {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
// Regression test for https://github.com/dart-lang/sdk/issues/37065
6+
7+
const x = 0;
8+
main(@x args) {
9+
const z = 0;
10+
foo(@z args) {}
11+
bar(@x args) {}
12+
}

0 commit comments

Comments
 (0)