b87a479c2b
All generic methods are equipped with one extra named parameter for passing type arguments as a list of type values. Additinally, this change forces strong mode usage for 'dartk' in 'reified_dart'. Strong mode is required for loader to not strip away type arguments from generic methods. In future, a command line argument may be implemented for that (e.g. --generic-methods), if generic method support will land before the strong mode. R=karlklose@google.com Review-Url: https://codereview.chromium.org/2713163002 .
50 lines
2.0 KiB
Dart
50 lines
2.0 KiB
Dart
// Copyright (c) 2017, 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.
|
|
library kernel.target.vmreify;
|
|
|
|
import '../ast.dart' show Program;
|
|
import '../transformations/generic_types_reification.dart' as reify
|
|
show transformProgram;
|
|
|
|
import 'targets.dart' show TargetFlags;
|
|
import 'vmcc.dart' as vmcc_target;
|
|
|
|
/// Specializes the kernel IR to the Dart VM with reified generic types.
|
|
class VmGenericTypesReifiedTarget extends vmcc_target.VmClosureConvertedTarget {
|
|
VmGenericTypesReifiedTarget(TargetFlags flags) : super(flags);
|
|
|
|
@override
|
|
String get name => "vmreify";
|
|
|
|
// This is the order that bootstrap libraries are loaded according to
|
|
// `runtime/vm/object_store.h`.
|
|
List<String> get extraRequiredLibraries {
|
|
return new List<String>.from(super.extraRequiredLibraries)
|
|
..add("${flags.kernelRuntime.resolve('reify/types.dart')}")
|
|
..add("${flags.kernelRuntime.resolve('reify/declarations.dart')}")
|
|
..add("${flags.kernelRuntime.resolve('reify/interceptors.dart')}");
|
|
}
|
|
|
|
@override
|
|
void performGlobalTransformations(Program program) {
|
|
super.performGlobalTransformations(program);
|
|
// TODO(dmitryas) this transformation should be made modular
|
|
reify.transformProgram(program);
|
|
}
|
|
|
|
// Disable tree shaking for Generic Types Reification. There are some runtime
|
|
// libraries that are required for the transformation and are shaken off,
|
|
// because they aren't invoked from the program being transformed prior to
|
|
// the transformation.
|
|
// TODO(dmitryas): remove this when the libraries are in dart:_internal
|
|
@override
|
|
void performTreeShaking(Program program) {}
|
|
|
|
// Here we disable Erasure pass of VmTarget class. The information deleted by
|
|
// the Erasure pass is required for Generic Type Reification. Also, reify
|
|
// transformation also performs its own Erasure pass.
|
|
@override
|
|
void performErasure(Program program) {}
|
|
}
|