34d8b562be
Since r44861, ElementBuilder is responsible for creating the ConstantInstanceCreationHandle objects associated with InstanceCreationExpressions. Since InstanceCreationExpressions may appear inside annotations, we must make sure the ElementBuilder visits all annotations. Previous to this change, it didn't visit function annotations. BUG=dartbug.com/23354 R=scheglov@google.com Review URL: https://codereview.chromium.org//1125613003 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45489 260f80e4-7a28-3924-810f-c04153c831b5
30 lines
732 B
Dart
30 lines
732 B
Dart
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
// Verify that instance creation expressions inside function
|
|
// annotations are properly handled. See dartbug.com/23354
|
|
|
|
import 'dart:mirrors';
|
|
import 'package:expect/expect.dart';
|
|
|
|
class C {
|
|
final String s;
|
|
const C(this.s);
|
|
}
|
|
|
|
class D {
|
|
final C c;
|
|
const D(this.c);
|
|
}
|
|
|
|
@D(const C('foo'))
|
|
f() {}
|
|
|
|
main() {
|
|
ClosureMirror closureMirror = reflect(f);
|
|
List<InstanceMirror> metadata = closureMirror.function.metadata;
|
|
Expect.equals(1, metadata.length);
|
|
Expect.equals(metadata[0].reflectee.c.s, 'foo');
|
|
}
|