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

Unified 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, 11 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/bin/util.dart
diff --git a/pkg/kernel/bin/util.dart b/pkg/kernel/bin/util.dart
new file mode 100644
index 0000000000000000000000000000000000000000..f486937b28823909d9fae2bf9605a707c7db39f5
--- /dev/null
+++ b/pkg/kernel/bin/util.dart
@@ -0,0 +1,68 @@
+// Copyright (c) 2016, 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:io';
+
+import 'package:kernel/target/targets.dart';
+import 'package:kernel/transformations/treeshaker.dart';
+
+/// Parses all given [embedderEntryPointManifests] and returns the program roots
+/// specified in them.
+///
+/// A embedder manifest consists of lines of the following form:
+///
+/// <import-uri>,<class-name>,<member-name>
+///
+/// Where
+///
+/// <import-uri> : The uri of the library which contains the root.
+/// <class-name> : Is either the name of the class or '::' for the library.
+/// <member-name>: Can be of the forms:
+///
+/// - get:<name>
+/// - set:<name>
+/// - <field-name>
+/// - <procedure-name>
+/// - <constructor-name>
+/// - <klass>.<factory-constructor-name>
+/// - *external-instantiation*
+///
+List<ProgramRoot> parseProgramRoots(List<String> embedderEntryPointManifests) {
+ List<ProgramRoot> roots = <ProgramRoot>[];
+
+ for (var file in embedderEntryPointManifests) {
+ var lines = new File(file).readAsStringSync().trim().split('\n');
+ for (var line in lines) {
+ var parts = line.split(',');
+ assert(parts.length == 3);
+
+ var library = parts[0];
+ var klass = parts[1];
+ var member = parts[2];
+
+ // The vm represents the toplevel class as '::'.
+ if (klass == '::') klass = null;
+
+ ProgramRootKind kind = ProgramRootKind.Other;
+
+ if (member.startsWith('set:')) {
+ kind = ProgramRootKind.Setter;
+ member = member.substring('set:'.length);
+ } else if (member.startsWith('get:')) {
+ kind = ProgramRootKind.Getter;
+ member = member.substring('get:'.length);
+ } else if (member == "*external-instantiation*") {
+ kind = ProgramRootKind.ExternallyInstantiatedClass;
+ member = null;
+ } else if (member.startsWith('$klass.')) {
+ kind = ProgramRootKind.Constructor;
+ member = member.substring('$klass.'.length);
+ }
+
+ roots.add(new ProgramRoot(library, klass, member, kind));
+ }
+ }
+
+ return roots;
+}
« 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