mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 10:49:00 +00:00
[vm] Fix bug with generic invocation of fields.
Change-Id: I644f6a66891cf87853b2e7de784c73292bcb2955 Reviewed-on: https://dart-review.googlesource.com/76661 Commit-Queue: Samir Jindel <sjindel@google.com> Reviewed-by: Régis Crelier <regis@google.com>
This commit is contained in:
parent
dc2787a471
commit
30333c508f
3 changed files with 25 additions and 2 deletions
20
runtime/tests/vm/dart/generic_field_invocation_test.dart
Normal file
20
runtime/tests/vm/dart/generic_field_invocation_test.dart
Normal file
|
@ -0,0 +1,20 @@
|
|||
// 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.
|
||||
//
|
||||
// This test verifies that we invoke closure in fields correctly when going
|
||||
// through the slow NSM path rather than the field invocation dispatchers.
|
||||
//
|
||||
// VMOptions=--no-lazy-dispatchers
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
class C {
|
||||
dynamic field;
|
||||
}
|
||||
|
||||
main() {
|
||||
var c = C();
|
||||
c.field = <T>(T x) => x.hashCode;
|
||||
Expect.equals(3, c.field<dynamic>(3));
|
||||
}
|
|
@ -311,6 +311,9 @@ cc/RegExp_OneByteString: Skip # TODO(vegorov) These tests don't seem to work if
|
|||
cc/RegExp_TwoByteString: Skip # TODO(vegorov) These tests don't seem to work if FLAG_interpret_irregexp is switched on by default because they attempt to call regexp functions directly instead of going through JSSyntaxRegExp_ExecuteMatch.
|
||||
cc/RegenerateAllocStubs: Skip # This test is meaningless for DBC as allocation stubs are not used.
|
||||
|
||||
[ $arch == simdbc || $arch == simdbc64 || $compiler == dartkb ]
|
||||
dart/generic_field_invocation_test: SkipByDesign # DBC and KBC interpreters do not support --no_lazy_dispatchers
|
||||
|
||||
[ $compiler == dart2analyzer || $compiler == dart2js ]
|
||||
dart/data_uri*test: Skip # Data uri's not supported by dart2js or the analyzer.
|
||||
|
||||
|
|
|
@ -1799,10 +1799,10 @@ DEFINE_RUNTIME_ENTRY(InvokeNoSuchMethodDispatcher, 4) {
|
|||
|
||||
const String& getter_name =
|
||||
String::Handle(zone, Field::GetterName(target_name));
|
||||
ArgumentsDescriptor args_desc(orig_arguments_desc);
|
||||
while (!cls.IsNull()) {
|
||||
function ^= cls.LookupDynamicFunction(target_name);
|
||||
if (!function.IsNull()) {
|
||||
ArgumentsDescriptor args_desc(orig_arguments_desc);
|
||||
ASSERT(!function.AreValidArguments(args_desc, NULL));
|
||||
break; // mismatch, invoke noSuchMethod
|
||||
}
|
||||
|
@ -1815,7 +1815,7 @@ DEFINE_RUNTIME_ENTRY(InvokeNoSuchMethodDispatcher, 4) {
|
|||
CheckResultError(getter_result);
|
||||
ASSERT(getter_result.IsNull() || getter_result.IsInstance());
|
||||
|
||||
orig_arguments.SetAt(0, getter_result);
|
||||
orig_arguments.SetAt(args_desc.FirstArgIndex(), getter_result);
|
||||
const Object& call_result = Object::Handle(
|
||||
zone,
|
||||
DartEntry::InvokeClosure(orig_arguments, orig_arguments_desc));
|
||||
|
|
Loading…
Reference in a new issue