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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/model.dart

Issue 752553004: dart2js: Support mixins in the new emitter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 6 years 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 dart2js.new_js_emitter.model; 5 library dart2js.new_js_emitter.model;
6 6
7 import '../js/js.dart' as js show Expression; 7 import '../js/js.dart' as js show Expression;
8 import '../constants/values.dart' show ConstantValue; 8 import '../constants/values.dart' show ConstantValue;
9 9
10 class Program { 10 class Program {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 final bool isFinal; 125 final bool isFinal;
126 final bool isLazy; 126 final bool isLazy;
127 127
128 StaticField(this.name, this.holder, this.code, 128 StaticField(this.name, this.holder, this.code,
129 this.isFinal, this.isLazy); 129 this.isFinal, this.isLazy);
130 } 130 }
131 131
132 class Class { 132 class Class {
133 final String name; 133 final String name;
134 final Holder holder; 134 final Holder holder;
135 Class superclass; 135 Class _superclass;
136 final List<Method> methods; 136 final List<Method> methods;
137 final List<InstanceField> fields; 137 final List<InstanceField> fields;
138 final bool onlyForRti; 138 final bool onlyForRti;
139 final bool isDirectlyInstantiated;
139 140
140 /// Whether the class must be evaluated eagerly. 141 /// Whether the class must be evaluated eagerly.
141 bool isEager = false; 142 bool isEager = false;
142 143
143 Class(this.name, this.holder, this.methods, this.fields, 144 Class(this.name, this.holder, this.methods, this.fields,
144 { this.onlyForRti }) { 145 {this.onlyForRti,
146 this.isDirectlyInstantiated}) {
145 assert(onlyForRti != null); 147 assert(onlyForRti != null);
148 assert(isDirectlyInstantiated != null);
146 } 149 }
147 150
151 bool get isMixinApplication => false;
152 Class get superclass => _superclass;
153
148 void setSuperclass(Class superclass) { 154 void setSuperclass(Class superclass) {
149 this.superclass = superclass; 155 _superclass = superclass;
150 } 156 }
151 157
152 String get superclassName 158 String get superclassName
153 => (superclass == null) ? "" : superclass.name; 159 => (superclass == null) ? "" : superclass.name;
154 int get superclassHolderIndex 160 int get superclassHolderIndex
155 => (superclass == null) ? 0 : superclass.holder.index; 161 => (superclass == null) ? 0 : superclass.holder.index;
156 } 162 }
157 163
164 class MixinApplication extends Class {
165 Class _mixinClass;
166
167 MixinApplication(String name, Holder holder,
168 {bool onlyForRti,
169 bool isDirectlyInstantiated})
170 : super(name, holder, const <Method>[], const <InstanceField>[],
171 onlyForRti: onlyForRti,
172 isDirectlyInstantiated: isDirectlyInstantiated);
173
174 bool get isMixinApplication => true;
175 Class get mixinClass => _mixinClass;
176
177 void setMixinClass(Class mixinClass) {
178 _mixinClass = mixinClass;
179 }
180 }
181
158 class InstanceField { 182 class InstanceField {
159 final String name; 183 final String name;
160 184
161 /// 00: Does not need any getter. 185 /// 00: Does not need any getter.
162 /// 01: function() { return this.field; } 186 /// 01: function() { return this.field; }
163 /// 10: function(receiver) { return receiver.field; } 187 /// 10: function(receiver) { return receiver.field; }
164 /// 11: function(receiver) { return this.field; } 188 /// 11: function(receiver) { return this.field; }
165 final int getterFlags; 189 final int getterFlags;
166 190
167 /// 00: Does not need any setter. 191 /// 00: Does not need any setter.
(...skipping 13 matching lines...) Expand all
181 final String name; 205 final String name;
182 final js.Expression code; 206 final js.Expression code;
183 Method(this.name, this.code); 207 Method(this.name, this.code);
184 } 208 }
185 209
186 class StaticMethod extends Method { 210 class StaticMethod extends Method {
187 final Holder holder; 211 final Holder holder;
188 StaticMethod(String name, this.holder, js.Expression code) 212 StaticMethod(String name, this.holder, js.Expression code)
189 : super(name, code); 213 : super(name, code);
190 } 214 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698