mirror of
https://github.com/dart-lang/sdk
synced 2024-11-05 18:22:09 +00:00
8064c1c342
Also add `legacyTypeRep<T>()` that is similar but performs a shallow conversion to a legacy type. Using this in compiler/dartdevc_native/ tests gives a better usability instead of constantly wrapping and unwrapping types. It allows us to avoid stripping off the legacy from a type when calling `wrapType()`. Issue: https://github.com/dart-lang/sdk/issues/40266 Change-Id: I07225f18c253222b31203b0b110233a3e018a7d0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142547 Commit-Queue: Nicholas Shahan <nshahan@google.com> Reviewed-by: Sigmund Cherem <sigmund@google.com>
29 lines
1.1 KiB
Dart
29 lines
1.1 KiB
Dart
// Copyright (c) 2019, 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:_foreign_helper' show JS;
|
|
import 'dart:_runtime' show gFnType, typeRep;
|
|
|
|
/// Returns an unwrapped generic function type with a bounded type argument in
|
|
/// the form: <T extends [bound]> void -> void.
|
|
Object genericFunction(Object bound) =>
|
|
gFnType((T) => [typeRep<void>(), []], (T) => [bound]);
|
|
|
|
/// Returns an unwrapped generic function type with a bounded type argument in
|
|
/// the form: <T extends [bound]> [argumentType] -> T.
|
|
Object functionGenericReturn(Object bound, Object argType) => gFnType(
|
|
(T) => [
|
|
T,
|
|
[argType]
|
|
],
|
|
(T) => [bound]);
|
|
|
|
/// Returns an unwrapped generic function type with a bounded type argument in
|
|
/// the form: <T extends [bound]> T -> [returnType].
|
|
Object functionGenericArg(Object bound, Object returnType) => gFnType(
|
|
(T) => [
|
|
returnType,
|
|
[T]
|
|
],
|
|
(T) => [bound]);
|