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

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

Issue 10835018: Filter out core and auxilary 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 | tests/language/language.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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
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 bool shouldOutput(Element element) { 63 final LIBS_TO_IGNORE = [
64 return element.kind !== ElementKind.VOID 64 compiler.coreImplLibrary,
65 && element.getLibrary() !== compiler.coreLibrary; 65 compiler.jsHelperLibrary,
66 } 66 compiler.interceptorsLibrary,
67 compiler.coreLibrary,
68 ];
69 bool shouldOutput(Element element) =>
70 element.kind !== ElementKind.VOID &&
71 LIBS_TO_IGNORE.indexOf(element.getLibrary()) == -1;
67 72
68 try { 73 try {
69 Emitter emitter = new Emitter(compiler); 74 Emitter emitter = new Emitter(compiler);
70 resolvedElements.forEach((element, treeElements) { 75 resolvedElements.forEach((element, treeElements) {
71 if (!shouldOutput(element)) return; 76 if (!shouldOutput(element)) return;
72 if (element.isMember()) { 77 if (element.isMember()) {
73 var enclosingClass = element.enclosingElement; 78 var enclosingClass = element.enclosingElement;
74 assert(enclosingClass.isClass()); 79 assert(enclosingClass.isClass());
75 assert(enclosingClass.isTopLevel()); 80 assert(enclosingClass.isTopLevel());
76 addMemberToClass(element, enclosingClass); 81 addMemberToClass(element, enclosingClass);
(...skipping 13 matching lines...) Expand all
90 compiler.assembledCode = ''' 95 compiler.assembledCode = '''
91 main() { 96 main() {
92 final bailout_reason = "${e.reason}"; 97 final bailout_reason = "${e.reason}";
93 } 98 }
94 '''; 99 ''';
95 } 100 }
96 } 101 }
97 102
98 log(String message) => compiler.log('[DartBackend] $message'); 103 log(String message) => compiler.log('[DartBackend] $message');
99 } 104 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698