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

Side by Side Diff: lib/compiler/implementation/js_backend/emitter_no_eval.dart

Issue 11265020: Minifying renamer for classes, methods and instance variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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
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 CodeEmitterNoEvalTask extends CodeEmitterTask { 5 class CodeEmitterNoEvalTask extends CodeEmitterTask {
6 CodeEmitterNoEvalTask(Compiler compiler, 6 CodeEmitterNoEvalTask(Compiler compiler,
7 Namer namer, 7 Namer namer,
8 bool generateSourceMap) 8 bool generateSourceMap)
9 : super(compiler, namer, generateSourceMap); 9 : super(compiler, namer, generateSourceMap);
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // d needs both a getter and a setter. Then we produce: 74 // d needs both a getter and a setter. Then we produce:
75 // - a constructor (directly into the given [buffer]): 75 // - a constructor (directly into the given [buffer]):
76 // function A(b, c, d) { this.b = b, this.c = c, this.d = d; } 76 // function A(b, c, d) { this.b = b, this.c = c, this.d = d; }
77 // - getters and setters (stored in the [explicitGettersSetters] list): 77 // - getters and setters (stored in the [explicitGettersSetters] list):
78 // get$c : function() { return this.c; } 78 // get$c : function() { return this.c; }
79 // get$d : function() { return this.d; } 79 // get$d : function() { return this.d; }
80 // set$d : function(x) { this.d = x; } 80 // set$d : function(x) { this.d = x; }
81 List<String> fields = <String>[]; 81 List<String> fields = <String>[];
82 visitClassFields(classElement, (Element member, 82 visitClassFields(classElement, (Element member,
83 String name, 83 String name,
84 String accessorName,
84 bool needsGetter, 85 bool needsGetter,
85 bool needsSetter, 86 bool needsSetter,
86 bool needsCheckedSetter) { 87 bool needsCheckedSetter) {
87 fields.add(name); 88 fields.add(name);
88 }); 89 });
89 90
90 List<String> argumentNames = fields; 91 List<String> argumentNames = fields;
91 if (fields.length < ($z - $a)) { 92 if (fields.length < ($z - $a)) {
92 argumentNames = new List<String>(fields.length); 93 argumentNames = new List<String>(fields.length);
93 for (int i = 0; i < fields.length; i++) { 94 for (int i = 0; i < fields.length; i++) {
(...skipping 20 matching lines...) Expand all
114 emitComma() { 115 emitComma() {
115 if (!omitLeadingComma) { 116 if (!omitLeadingComma) {
116 buffer.add(",\n "); 117 buffer.add(",\n ");
117 } else { 118 } else {
118 omitLeadingComma = false; 119 omitLeadingComma = false;
119 } 120 }
120 } 121 }
121 122
122 visitClassFields(classElement, (Element member, 123 visitClassFields(classElement, (Element member,
123 String name, 124 String name,
125 String accessorName,
124 bool needsGetter, 126 bool needsGetter,
125 bool needsSetter, 127 bool needsSetter,
126 bool needsCheckedSetter) { 128 bool needsCheckedSetter) {
127 if (needsGetter) { 129 if (needsGetter) {
128 emitComma(); 130 emitComma();
129 generateGetter(member, name, buffer); 131 generateGetter(member, name, accessorName, buffer);
130 } 132 }
131 if (needsSetter) { 133 if (needsSetter) {
132 emitComma(); 134 emitComma();
133 generateSetter(member, name, buffer); 135 generateSetter(member, name, accessorName, buffer);
134 } 136 }
135 if (needsCheckedSetter) { 137 if (needsCheckedSetter) {
136 assert(!needsSetter); 138 assert(!needsSetter);
137 emitComma(); 139 emitComma();
138 generateCheckedSetter(member, name, buffer); 140 generateCheckedSetter(member, name, accessorName, buffer);
139 } 141 }
140 }); 142 });
141 } 143 }
142 } 144 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698