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

Unified Diff: frog/leg/namer.dart

Issue 9245002: Support getters and setters. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: frog/leg/namer.dart
===================================================================
--- frog/leg/namer.dart (revision 3791)
+++ frog/leg/namer.dart (working copy)
@@ -71,10 +71,16 @@
element.name, functionElement.parameterCount(compiler));
} else {
// TODO(floitsch): deal with named constructors.
- String name = '${element.name}';
- if (element.kind == ElementKind.FUNCTION) {
+ String name;
+ if (element.kind == ElementKind.GETTER) {
+ name = getterName(element.name);
+ } else if (element.kind == ElementKind.SETTER) {
+ name = setterName(element.name);
+ } else if (element.kind == ElementKind.FUNCTION) {
FunctionElement functionElement = element;
- name = '$name\$${functionElement.parameterCount(compiler)}';
+ name = '${element.name}\$${functionElement.parameterCount(compiler)}';
+ } else {
+ name = '${element.name}';
}
// Prefix the name with '$' if it is reserved.
if (jsReserved.contains(name)) {
@@ -131,6 +137,8 @@
case ElementKind.FUNCTION:
case ElementKind.CLASS:
case ElementKind.FIELD:
+ case ElementKind.GETTER:
+ case ElementKind.SETTER:
// We need to make sure the name is unique.
int usedCount = usedGlobals[guess];
if (usedCount === null) {

Powered by Google App Engine
This is Rietveld 408576698