OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
6 | 6 |
7 class ClassEmitter extends CodeEmitterHelper { | 7 class ClassEmitter extends CodeEmitterHelper { |
8 | 8 |
9 ClassStubGenerator get _stubGenerator => | 9 ClassStubGenerator get _stubGenerator => |
10 new ClassStubGenerator(compiler, namer, backend); | 10 new ClassStubGenerator(compiler, namer, backend); |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 isLibrary = true; | 386 isLibrary = true; |
387 assert(invariant(element, visitStatics)); | 387 assert(invariant(element, visitStatics)); |
388 } else { | 388 } else { |
389 throw new SpannableAssertionFailure( | 389 throw new SpannableAssertionFailure( |
390 element, 'Expected a ClassElement or a LibraryElement.'); | 390 element, 'Expected a ClassElement or a LibraryElement.'); |
391 } | 391 } |
392 | 392 |
393 // If the class is never instantiated we still need to set it up for | 393 // If the class is never instantiated we still need to set it up for |
394 // inheritance purposes, but we can simplify its JavaScript constructor. | 394 // inheritance purposes, but we can simplify its JavaScript constructor. |
395 bool isInstantiated = | 395 bool isInstantiated = |
396 compiler.codegenWorld.instantiatedClasses.contains(element); | 396 compiler.codegenWorld.directlyInstantiatedClasses.contains(element); |
397 | 397 |
398 void visitField(Element holder, VariableElement field) { | 398 void visitField(Element holder, VariableElement field) { |
399 assert(invariant(element, field.isDeclaration)); | 399 assert(invariant(element, field.isDeclaration)); |
400 String name = field.name; | 400 String name = field.name; |
401 | 401 |
402 // Keep track of whether or not we're dealing with a field mixin | 402 // Keep track of whether or not we're dealing with a field mixin |
403 // into a native class. | 403 // into a native class. |
404 bool isMixinNativeField = | 404 bool isMixinNativeField = |
405 isClass && element.isNative && holder.isMixinApplication; | 405 isClass && element.isNative && holder.isMixinApplication; |
406 | 406 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', index); | 605 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', index); |
606 } | 606 } |
607 jsAst.Expression convertRtiToRuntimeType = | 607 jsAst.Expression convertRtiToRuntimeType = |
608 namer.elementAccess(backend.findHelper('convertRtiToRuntimeType')); | 608 namer.elementAccess(backend.findHelper('convertRtiToRuntimeType')); |
609 compiler.dumpInfoTask.registerElementAst(element, | 609 compiler.dumpInfoTask.registerElementAst(element, |
610 builder.addProperty(name, | 610 builder.addProperty(name, |
611 js('function () { return #(#) }', | 611 js('function () { return #(#) }', |
612 [convertRtiToRuntimeType, computeTypeVariable]))); | 612 [convertRtiToRuntimeType, computeTypeVariable]))); |
613 } | 613 } |
614 } | 614 } |
OLD | NEW |