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

Side by Side Diff: lib/compiler/implementation/dart_backend/backend.dart

Issue 10834049: Better filtering of dart:* libs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | utils/tests/pub/pub.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 class BailoutException { 5 class BailoutException {
6 final String reason; 6 final String reason;
7 7
8 const BailoutException(this.reason); 8 const BailoutException(this.reason);
9 } 9 }
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // TODO(antonm): Eventually bailouts will be proper errors. 54 // TODO(antonm): Eventually bailouts will be proper errors.
55 void bailout(String reason) { 55 void bailout(String reason) {
56 throw new BailoutException(reason); 56 throw new BailoutException(reason);
57 } 57 }
58 58
59 /** 59 /**
60 * Tells whether we should output given element. Corelib classes like 60 * Tells whether we should output given element. Corelib classes like
61 * Object should not be in the resulting code. 61 * Object should not be in the resulting code.
62 */ 62 */
63 final LIBS_TO_IGNORE = [ 63 final LIBS_TO_IGNORE = [
64 compiler.coreImplLibrary,
65 compiler.jsHelperLibrary, 64 compiler.jsHelperLibrary,
66 compiler.interceptorsLibrary, 65 compiler.interceptorsLibrary,
67 compiler.coreLibrary,
68 ]; 66 ];
67 compiler.libraries.forEach((uri, lib) {
68 if (uri.startsWith('dart:')) LIBS_TO_IGNORE.add(lib);
69 });
69 bool shouldOutput(Element element) => 70 bool shouldOutput(Element element) =>
70 element.kind !== ElementKind.VOID && 71 element.kind !== ElementKind.VOID &&
71 LIBS_TO_IGNORE.indexOf(element.getLibrary()) == -1; 72 LIBS_TO_IGNORE.indexOf(element.getLibrary()) == -1;
72 73
73 try { 74 try {
74 Emitter emitter = new Emitter(compiler); 75 Emitter emitter = new Emitter(compiler);
75 resolvedElements.forEach((element, treeElements) { 76 resolvedElements.forEach((element, treeElements) {
76 if (!shouldOutput(element)) return; 77 if (!shouldOutput(element)) return;
77 if (element.isMember()) { 78 if (element.isMember()) {
78 var enclosingClass = element.enclosingElement; 79 var enclosingClass = element.enclosingElement;
(...skipping 16 matching lines...) Expand all
95 compiler.assembledCode = ''' 96 compiler.assembledCode = '''
96 main() { 97 main() {
97 final bailout_reason = "${e.reason}"; 98 final bailout_reason = "${e.reason}";
98 } 99 }
99 '''; 100 ''';
100 } 101 }
101 } 102 }
102 103
103 log(String message) => compiler.log('[DartBackend] $message'); 104 log(String message) => compiler.log('[DartBackend] $message');
104 } 105 }
OLDNEW
« no previous file with comments | « no previous file | utils/tests/pub/pub.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698