Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 this._superclass = superclass; |
|
kasperl
2014/11/27 09:05:14
Remove this.?
floitsch
2014/11/27 12:35:16
Done.
| |
| 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) { | |
|
sigurdm
2014/11/27 09:25:54
Why not a setter?
floitsch
2014/11/27 12:35:16
Because we don't want it to feel like a field.
The
| |
| 178 this._mixinClass = mixinClass; | |
|
kasperl
2014/11/27 09:05:13
Remove this.?
floitsch
2014/11/27 12:35:16
Done.
| |
| 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 Loading... | |
| 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 } |
| OLD | NEW |