mirror of
https://github.com/dart-lang/sdk
synced 2024-09-19 14:43:32 +00:00
3633c5bd5e
Simplify handling of closures as deferred objects. The name "type_arguments_" is confusing, because class Closure is not generic. Class Closure was forcefully made (kinda) generic by setting its type_arguments_field_offset_in_words_ field to a valid value, so that the type_arguments_ field in closure instances could be accessed similarly as in generic instances. With generic functions, closures will potentially have more than one instantiator and the name type_arguments_ becomes nonsensical. R=johnmccutchan@google.com Review-Url: https://codereview.chromium.org/2719603002 .
26 lines
882 B
Dart
26 lines
882 B
Dart
// Copyright (c) 2013, 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.
|
|
|
|
class _Closure implements Function {
|
|
|
|
bool operator ==(other) native "Closure_equals";
|
|
|
|
int get hashCode native "Closure_hashCode";
|
|
|
|
_Closure get call => this;
|
|
|
|
_Closure _clone() native "Closure_clone";
|
|
|
|
// No instance fields should be declared before the following 3 fields whose
|
|
// offsets must be identical in Dart and C++.
|
|
|
|
// The following 3 fields are declared both in raw_object.h (for direct access
|
|
// from C++ code) and also here so that the offset-to-field map used by
|
|
// deferred objects is properly initialized.
|
|
// Caution: These fields are not Dart instances, but VM objects.
|
|
var instantiator_;
|
|
var function_;
|
|
var context_;
|
|
}
|