| 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 library closureToClassMapper; | 5 library closureToClassMapper; |
| 6 | 6 |
| 7 import "elements/elements.dart"; | 7 import "elements/elements.dart"; |
| 8 import "dart2jslib.dart"; | 8 import "dart2jslib.dart"; |
| 9 import "dart_types.dart"; | 9 import "dart_types.dart"; |
| 10 import "scanner/scannerlib.dart" show Token; | 10 import "scanner/scannerlib.dart" show Token; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 | 86 |
| 87 Expression get cachedNode { | 87 Expression get cachedNode { |
| 88 throw new SpannableAssertionFailure( | 88 throw new SpannableAssertionFailure( |
| 89 variableElement, | 89 variableElement, |
| 90 'Should not access cachedNode of ClosureFieldElement.'); | 90 'Should not access cachedNode of ClosureFieldElement.'); |
| 91 } | 91 } |
| 92 | 92 |
| 93 bool isInstanceMember() => true; | 93 bool isInstanceMember() => true; |
| 94 bool isAssignable() => false; | 94 bool isAssignable() => false; |
| 95 // The names of closure variables don't need renaming, since their use is very | |
| 96 // simple and they have 1-character names in the minified mode. | |
| 97 bool hasFixedBackendName() => true; | |
| 98 String fixedBackendName() => name; | |
| 99 | 95 |
| 100 DartType computeType(Compiler compiler) { | 96 DartType computeType(Compiler compiler) { |
| 101 return variableElement.computeType(compiler); | 97 return variableElement.computeType(compiler); |
| 102 } | 98 } |
| 103 | 99 |
| 104 String toString() => "ClosureFieldElement($name)"; | 100 String toString() => "ClosureFieldElement($name)"; |
| 105 } | 101 } |
| 106 | 102 |
| 107 // TODO(ahe): These classes continuously cause problems. We need to | 103 // TODO(ahe): These classes continuously cause problems. We need to |
| 108 // move these classes to elements/modelx.dart or see if we can find a | 104 // move these classes to elements/modelx.dart or see if we can find a |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 } | 826 } |
| 831 | 827 |
| 832 visitTryStatement(TryStatement node) { | 828 visitTryStatement(TryStatement node) { |
| 833 // TODO(ngeoffray): implement finer grain state. | 829 // TODO(ngeoffray): implement finer grain state. |
| 834 bool oldInTryStatement = inTryStatement; | 830 bool oldInTryStatement = inTryStatement; |
| 835 inTryStatement = true; | 831 inTryStatement = true; |
| 836 node.visitChildren(this); | 832 node.visitChildren(this); |
| 837 inTryStatement = oldInTryStatement; | 833 inTryStatement = oldInTryStatement; |
| 838 } | 834 } |
| 839 } | 835 } |
| OLD | NEW |