| 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.js_emitter.program_builder; | 5 library dart2js.js_emitter.program_builder; |
| 6 | 6 |
| 7 import 'js_emitter.dart' show computeMixinClass; | 7 import 'js_emitter.dart' show computeMixinClass; |
| 8 import 'model.dart'; | 8 import 'model.dart'; |
| 9 | 9 |
| 10 import '../common.dart'; | 10 import '../common.dart'; |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 !cls.isNative || !_unneededNativeClasses.contains(cls)) | 271 !cls.isNative || !_unneededNativeClasses.contains(cls)) |
| 272 .toList(growable: false); | 272 .toList(growable: false); |
| 273 | 273 |
| 274 bool visitStatics = true; | 274 bool visitStatics = true; |
| 275 List<Field> staticFieldsForReflection = _buildFields(library, visitStatics); | 275 List<Field> staticFieldsForReflection = _buildFields(library, visitStatics); |
| 276 | 276 |
| 277 return new Library(library, uri, statics, classes, | 277 return new Library(library, uri, statics, classes, |
| 278 staticFieldsForReflection); | 278 staticFieldsForReflection); |
| 279 } | 279 } |
| 280 | 280 |
| 281 /// HACK for Try. | 281 /// HACK for Incremental Compilation. |
| 282 /// | 282 /// |
| 283 /// Returns a class that contains the fields of a class. | 283 /// Returns a class that contains the fields of a class. |
| 284 Class buildClassWithFieldsForTry(ClassElement element) { | 284 Class buildClassWithFieldsForIncrementalCompilation(ClassElement element) { |
| 285 bool onlyForRti = _task.typeTestRegistry.rtiNeededClasses.contains(element); | 285 assert(_compiler.hasIncrementalSupport); |
| 286 | 286 |
| 287 List<Field> instanceFields = | 287 List<Field> instanceFields = _buildFields(element, false); |
| 288 onlyForRti ? const <Field>[] : _buildFields(element, false); | |
| 289 | 288 |
| 290 String name = namer.getNameOfClass(element); | 289 String name = namer.getNameOfClass(element); |
| 291 String holderName = namer.globalObjectFor(element); | |
| 292 Holder holder = _registry.registerHolder(holderName); | |
| 293 bool isInstantiated = | |
| 294 _compiler.codegenWorld.directlyInstantiatedClasses.contains(element); | |
| 295 | 290 |
| 296 return new Class( | 291 return new Class( |
| 297 element, name, holder, [], instanceFields, [], [], [], null, | 292 element, name, null, [], instanceFields, [], [], [], null, |
| 298 isDirectlyInstantiated: isInstantiated, | 293 isDirectlyInstantiated: true, |
| 299 onlyForRti: onlyForRti, | 294 onlyForRti: false, |
| 300 isNative: element.isNative); | 295 isNative: element.isNative); |
| 301 } | 296 } |
| 302 | 297 |
| 303 Class _buildClass(ClassElement element) { | 298 Class _buildClass(ClassElement element) { |
| 304 bool onlyForRti = _task.typeTestRegistry.rtiNeededClasses.contains(element); | 299 bool onlyForRti = _task.typeTestRegistry.rtiNeededClasses.contains(element); |
| 305 | 300 |
| 306 List<Method> methods = []; | 301 List<Method> methods = []; |
| 307 List<StubMethod> callStubs = <StubMethod>[]; | 302 List<StubMethod> callStubs = <StubMethod>[]; |
| 308 | 303 |
| 309 void visitMember(ClassElement enclosing, Element member) { | 304 void visitMember(ClassElement enclosing, Element member) { |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 _registry.registerConstant(outputUnit, constantValue); | 513 _registry.registerConstant(outputUnit, constantValue); |
| 519 assert(!_constants.containsKey(constantValue)); | 514 assert(!_constants.containsKey(constantValue)); |
| 520 String name = namer.constantName(constantValue); | 515 String name = namer.constantName(constantValue); |
| 521 String constantObject = namer.globalObjectForConstant(constantValue); | 516 String constantObject = namer.globalObjectForConstant(constantValue); |
| 522 Holder holder = _registry.registerHolder(constantObject); | 517 Holder holder = _registry.registerHolder(constantObject); |
| 523 Constant constant = new Constant(name, holder, constantValue); | 518 Constant constant = new Constant(name, holder, constantValue); |
| 524 _constants[constantValue] = constant; | 519 _constants[constantValue] = constant; |
| 525 } | 520 } |
| 526 } | 521 } |
| 527 } | 522 } |
| OLD | NEW |