Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: pkg/kernel/bin/util.dart

Issue 2668893004: VM: [Kernel] Add --embedder-entry-points-manifest to dartk/transform and pass it to the treeshaker (Closed)
Patch Set: Add missing bin/util.dart Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/kernel/bin/transform.dart ('k') | pkg/kernel/lib/target/targets.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'dart:io';
6
7 import 'package:kernel/target/targets.dart';
8 import 'package:kernel/transformations/treeshaker.dart';
9
10 /// Parses all given [embedderEntryPointManifests] and returns the program roots
11 /// specified in them.
12 ///
13 /// A embedder manifest consists of lines of the following form:
14 ///
15 /// <import-uri>,<class-name>,<member-name>
16 ///
17 /// Where
18 ///
19 /// <import-uri> : The uri of the library which contains the root.
20 /// <class-name> : Is either the name of the class or '::' for the library.
21 /// <member-name>: Can be of the forms:
22 ///
23 /// - get:<name>
24 /// - set:<name>
25 /// - <field-name>
26 /// - <procedure-name>
27 /// - <constructor-name>
28 /// - <klass>.<factory-constructor-name>
29 /// - *external-instantiation*
30 ///
31 List<ProgramRoot> parseProgramRoots(List<String> embedderEntryPointManifests) {
32 List<ProgramRoot> roots = <ProgramRoot>[];
33
34 for (var file in embedderEntryPointManifests) {
35 var lines = new File(file).readAsStringSync().trim().split('\n');
36 for (var line in lines) {
37 var parts = line.split(',');
38 assert(parts.length == 3);
39
40 var library = parts[0];
41 var klass = parts[1];
42 var member = parts[2];
43
44 // The vm represents the toplevel class as '::'.
45 if (klass == '::') klass = null;
46
47 ProgramRootKind kind = ProgramRootKind.Other;
48
49 if (member.startsWith('set:')) {
50 kind = ProgramRootKind.Setter;
51 member = member.substring('set:'.length);
52 } else if (member.startsWith('get:')) {
53 kind = ProgramRootKind.Getter;
54 member = member.substring('get:'.length);
55 } else if (member == "*external-instantiation*") {
56 kind = ProgramRootKind.ExternallyInstantiatedClass;
57 member = null;
58 } else if (member.startsWith('$klass.')) {
59 kind = ProgramRootKind.Constructor;
60 member = member.substring('$klass.'.length);
61 }
62
63 roots.add(new ProgramRoot(library, klass, member, kind));
64 }
65 }
66
67 return roots;
68 }
OLDNEW
« no previous file with comments | « pkg/kernel/bin/transform.dart ('k') | pkg/kernel/lib/target/targets.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698