mirror of
https://github.com/dart-lang/sdk
synced 2024-11-05 18:22:09 +00:00
[vm/kernel] Fix crash when reading symbol literal from Dart annotation
Fixes https://github.com/dart-lang/sdk/issues/33513 Change-Id: I1595409dd3faa363922d595c1c33e6acce92af74 Reviewed-on: https://dart-review.googlesource.com/61800 Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
parent
16c0c0ff07
commit
f885a0c8f3
2 changed files with 22 additions and 2 deletions
|
@ -4109,8 +4109,7 @@ void StreamingConstantEvaluator::EvaluateStringConcatenation() {
|
|||
}
|
||||
|
||||
void StreamingConstantEvaluator::EvaluateSymbolLiteral() {
|
||||
const Class& owner =
|
||||
Class::Handle(Z, builder_->parsed_function()->function().Owner());
|
||||
const Class& owner = *builder_->active_class()->klass;
|
||||
const Library& lib = Library::Handle(Z, owner.library());
|
||||
String& symbol_value = H.DartIdentifier(lib, builder_->ReadStringReference());
|
||||
const Class& symbol_class =
|
||||
|
|
21
tests/lib_2/mirrors/metadata_symbol_literal_test.dart
Normal file
21
tests/lib_2/mirrors/metadata_symbol_literal_test.dart
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (c) 2018, 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.
|
||||
|
||||
import 'dart:mirrors';
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
class T {
|
||||
const T(this.symbol);
|
||||
final Symbol symbol;
|
||||
}
|
||||
|
||||
class U {
|
||||
@T(#x)
|
||||
int field;
|
||||
}
|
||||
|
||||
main() {
|
||||
final metadata = reflectClass(U).declarations[#field].metadata;
|
||||
Expect.identical((metadata.first.reflectee as T).symbol, const Symbol('x'));
|
||||
}
|
Loading…
Reference in a new issue