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

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

Issue 871073002: dart2js: add work-around hack for try. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 unified diff | Download patch | Annotate | Revision Log
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.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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 .map(_buildClass) 255 .map(_buildClass)
256 .toList(growable: false); 256 .toList(growable: false);
257 257
258 bool visitStatics = true; 258 bool visitStatics = true;
259 List<Field> staticFieldsForReflection = _buildFields(library, visitStatics); 259 List<Field> staticFieldsForReflection = _buildFields(library, visitStatics);
260 260
261 return new Library(library, uri, statics, classes, 261 return new Library(library, uri, statics, classes,
262 staticFieldsForReflection); 262 staticFieldsForReflection);
263 } 263 }
264 264
265 /// HACK for Try.
ahe 2015/01/28 07:22:37 This is not for Try Dart. This is for incremental
floitsch 2015/01/28 16:25:05 Renamed function to buildClassWithFieldsForIncreme
266 ///
267 /// Returns a class that contains the fields of a class.
268 Class buildClassWithFieldsForTry(ClassElement element) {
269 bool onlyForRti = _task.typeTestRegistry.rtiNeededClasses.contains(element);
ahe 2015/01/28 07:22:37 For incremental compilation, this should probably
floitsch 2015/01/28 16:25:05 Done.
270
271 List<Field> instanceFields =
272 onlyForRti ? const <Field>[] : _buildFields(element, false);
273
274 String name = namer.getNameOfClass(element);
275 String holderName = namer.globalObjectFor(element);
276 Holder holder = _registry.registerHolder(holderName);
ahe 2015/01/28 07:22:37 I'm not sure I understand what a holder is. Does t
floitsch 2015/01/28 16:25:05 In the new emitter it's more complicated. Since yo
277 bool isInstantiated =
278 _compiler.codegenWorld.directlyInstantiatedClasses.contains(element);
ahe 2015/01/28 07:22:37 For incremental compilation, my guess is that it w
floitsch 2015/01/28 16:25:05 Done.
279
280 return new Class(
281 element, name, holder, [], instanceFields, [], [], [], null,
282 isDirectlyInstantiated: isInstantiated,
283 onlyForRti: onlyForRti,
ahe 2015/01/28 07:22:37 As mentioned above, the above two arguments should
floitsch 2015/01/28 16:25:05 Done.
284 isNative: element.isNative);
285 }
286
265 Class _buildClass(ClassElement element) { 287 Class _buildClass(ClassElement element) {
266 bool onlyForRti = _task.typeTestRegistry.rtiNeededClasses.contains(element); 288 bool onlyForRti = _task.typeTestRegistry.rtiNeededClasses.contains(element);
267 289
268 List<Method> methods = []; 290 List<Method> methods = [];
269 List<StubMethod> callStubs = <StubMethod>[]; 291 List<StubMethod> callStubs = <StubMethod>[];
270 292
271 void visitMember(ClassElement enclosing, Element member) { 293 void visitMember(ClassElement enclosing, Element member) {
272 assert(invariant(element, member.isDeclaration)); 294 assert(invariant(element, member.isDeclaration));
273 assert(invariant(element, element == enclosing)); 295 assert(invariant(element, element == enclosing));
274 296
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 _registry.registerConstant(outputUnit, constantValue); 502 _registry.registerConstant(outputUnit, constantValue);
481 assert(!_constants.containsKey(constantValue)); 503 assert(!_constants.containsKey(constantValue));
482 String name = namer.constantName(constantValue); 504 String name = namer.constantName(constantValue);
483 String constantObject = namer.globalObjectForConstant(constantValue); 505 String constantObject = namer.globalObjectForConstant(constantValue);
484 Holder holder = _registry.registerHolder(constantObject); 506 Holder holder = _registry.registerHolder(constantObject);
485 Constant constant = new Constant(name, holder, constantValue); 507 Constant constant = new Constant(name, holder, constantValue);
486 _constants[constantValue] = constant; 508 _constants[constantValue] = constant;
487 } 509 }
488 } 510 }
489 } 511 }
OLDNEW
« no previous file with comments | « no previous file | pkg/dart2js_incremental/lib/library_updater.dart » ('j') | pkg/dart2js_incremental/lib/library_updater.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698