| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 /** | 5 /** |
| 6 * Assigns JavaScript identifiers to Dart variables, class-names and members. | 6 * Assigns JavaScript identifiers to Dart variables, class-names and members. |
| 7 */ | 7 */ |
| 8 class Namer { | 8 class Namer { |
| 9 final Compiler compiler; | 9 final Compiler compiler; |
| 10 | 10 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 if (element.isInstanceMember()) { | 100 if (element.isInstanceMember()) { |
| 101 SourceString name; | 101 SourceString name; |
| 102 if (element.kind == ElementKind.GENERATIVE_CONSTRUCTOR_BODY) { | 102 if (element.kind == ElementKind.GENERATIVE_CONSTRUCTOR_BODY) { |
| 103 ConstructorBodyElement bodyElement = element; | 103 ConstructorBodyElement bodyElement = element; |
| 104 SourceString name = getConstructorName(bodyElement.constructor); | 104 SourceString name = getConstructorName(bodyElement.constructor); |
| 105 return instanceMethodName(name, bodyElement.parameterCount(compiler)); | 105 return instanceMethodName(name, bodyElement.parameterCount(compiler)); |
| 106 } else if (element.kind == ElementKind.FUNCTION) { | 106 } else if (element.kind == ElementKind.FUNCTION) { |
| 107 FunctionElement functionElement = element; | 107 FunctionElement functionElement = element; |
| 108 int parameterCount = functionElement.parameterCount(compiler); | 108 int parameterCount = functionElement.parameterCount(compiler); |
| 109 return instanceMethodName(element.name, parameterCount); | 109 return instanceMethodName(element.name, parameterCount); |
| 110 } else if (element.kind == ElementKind.GETTER) { |
| 111 return getterName(element.name); |
| 112 } else if (element.kind == ElementKind.SETTER) { |
| 113 return setterName(element.name); |
| 110 } else { | 114 } else { |
| 111 return instanceFieldName(element.name); | 115 return instanceFieldName(element.name); |
| 112 } | 116 } |
| 113 } else { | 117 } else { |
| 114 // Dealing with a top-level or static element. | 118 // Dealing with a top-level or static element. |
| 115 String cached = globals[element]; | 119 String cached = globals[element]; |
| 116 if (cached !== null) return cached; | 120 if (cached !== null) return cached; |
| 117 | 121 |
| 118 String guess = _computeGuess(element); | 122 String guess = _computeGuess(element); |
| 119 switch (element.kind) { | 123 switch (element.kind) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 } | 170 } |
| 167 | 171 |
| 168 String isolateBailoutAccess(Element element) { | 172 String isolateBailoutAccess(Element element) { |
| 169 return '${isolateAccess(element)}\$bailout'; | 173 return '${isolateAccess(element)}\$bailout'; |
| 170 } | 174 } |
| 171 | 175 |
| 172 String operatorIs(ClassElement element) { | 176 String operatorIs(ClassElement element) { |
| 173 return 'is\$${getName(element)}'; | 177 return 'is\$${getName(element)}'; |
| 174 } | 178 } |
| 175 } | 179 } |
| OLD | NEW |