Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 bool shouldOutput(Element element) { |
| 64 return element.kind !== ElementKind.VOID | 64 return element.kind !== ElementKind.VOID |
| 65 && element is! AbstractFieldElement | |
|
Anton Muhin
2012/07/23 11:23:10
why?
Roman
2012/07/23 15:34:15
I don't remember! I checked again without this con
| |
| 65 && element.getLibrary() !== compiler.coreLibrary; | 66 && element.getLibrary() !== compiler.coreLibrary; |
| 66 } | 67 } |
| 67 | 68 |
| 68 try { | 69 try { |
| 69 Emitter emitter = new Emitter(compiler); | 70 Emitter emitter = new Emitter(compiler); |
| 70 resolvedElements.forEach((element, treeElements) { | 71 resolvedElements.forEach((element, treeElements) { |
| 71 if (!shouldOutput(element)) return; | 72 if (!shouldOutput(element)) return; |
| 72 if (element.isMember()) { | 73 if (element.isMember()) { |
| 73 var enclosingClass = element.enclosingElement; | 74 var enclosingClass = element.enclosingElement; |
| 74 assert(enclosingClass.isClass()); | 75 assert(enclosingClass.isClass()); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 90 compiler.assembledCode = ''' | 91 compiler.assembledCode = ''' |
| 91 main() { | 92 main() { |
| 92 final bailout_reason = "${e.reason}"; | 93 final bailout_reason = "${e.reason}"; |
| 93 } | 94 } |
| 94 '''; | 95 '''; |
| 95 } | 96 } |
| 96 } | 97 } |
| 97 | 98 |
| 98 log(String message) => compiler.log('[DartBackend] $message'); | 99 log(String message) => compiler.log('[DartBackend] $message'); |
| 99 } | 100 } |
| OLD | NEW |