blob: ce6f402cd71cfa3cb1dcd15080651e27e07798d8 [file] [log] [blame]
// 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.vm.roots;
import '../transformations/treeshaker.dart';
final List<ProgramRoot> vmRoots = () {
ProgramRoot keepClass(String klass, {String library: 'dart:core'}) {
return new ProgramRoot(
library, klass, null, ProgramRootKind.ExternallyInstantiatedClass);
}
ProgramRoot keepProcedure(String klass, String procedure,
{String library: 'dart:core'}) {
return new ProgramRoot(library, klass, procedure, ProgramRootKind.Other);
}
return <ProgramRoot>[
// We need these for now, otherwise further transformations will not be able
// to work correctly, since the `new CoreTypes(program)` will throw.
keepClass('Object'),
keepClass('Null'),
keepClass('bool'),
keepClass('Map'),
keepClass('Iterable'),
keepClass('Iterator'),
keepClass('Symbol'),
keepClass('Type'),
keepClass('Function'),
keepClass('Invocation'),
keepClass('Future', library: 'dart:async'),
keepClass('Stream', library: 'dart:async'),
keepClass('Symbol', library: 'dart:_internal'),
keepClass('_Integer'), // Implies int, num
keepClass('_Double'), // Implies double, num
keepClass('_OneByteString'), // Implies String
keepClass('_TwoByteString'), // Implies String
keepClass('_List'), // Implies List
keepClass('_Closure'),
keepProcedure('_Closure', '_invoke', library: 'dart:core'),
keepProcedure('_StringBase', '_interpolate'),
keepProcedure('List', '_fromLiteral'),
keepProcedure(null, '_printClosure', library: 'dart:_internal'),
// Used by methodcall transformer
keepClass('_InvocationMirror'),
];
}();