mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
![Ryan Macnak](/assets/img/avatar_default.png)
Bug: https://github.com/dart-lang/sdk/issues/37234 Change-Id: I567b3fa177e89db50345e174a07c98b10c53f102 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105721 Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: Régis Crelier <regis@google.com> Reviewed-by: Siva Annamalai <asiva@google.com>
55 lines
1.8 KiB
Dart
55 lines
1.8 KiB
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.
|
|
|
|
// part of "core_patch.dart";
|
|
|
|
@pragma("vm:entry-point")
|
|
class _Closure implements Function {
|
|
factory _Closure._uninstantiable() {
|
|
throw "Unreachable";
|
|
}
|
|
|
|
bool operator ==(Object other) native "Closure_equals";
|
|
|
|
int get hashCode {
|
|
_hash ??= _computeHash();
|
|
return _hash;
|
|
}
|
|
|
|
_Closure get call => this;
|
|
|
|
_Closure _clone() native "Closure_clone";
|
|
|
|
int _computeHash() native "Closure_computeHash";
|
|
|
|
// No instance fields should be declared before the following fields whose
|
|
// offsets must be identical in Dart and C++.
|
|
|
|
// The following 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. Their Dart
|
|
// names do not need to match the C++ names, but they must be private.
|
|
@pragma("vm:entry-point")
|
|
var _instantiator_type_arguments;
|
|
@pragma("vm:entry-point")
|
|
var _function_type_arguments;
|
|
@pragma("vm:entry-point")
|
|
var _delayed_type_arguments;
|
|
@pragma("vm:entry-point")
|
|
var _function;
|
|
@pragma("vm:entry-point")
|
|
var _context;
|
|
|
|
// Note: _Closure objects are created by VM "magically", without invoking
|
|
// constructor. So, _Closure default constructor is never compiled and
|
|
// detection of default-initialized fields is not performed.
|
|
// As a consequence, VM incorrectly assumes that _hash field is not
|
|
// nullable and may incorrectly remove 'if (_hash == null)' in get:hashCode.
|
|
// This initializer makes _hash field nullable even without constructor
|
|
// compilation.
|
|
@pragma("vm:entry-point")
|
|
var _hash = null;
|
|
}
|