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 '../../closure.dart' show ClosureFieldElement; | 7 import '../../closure.dart' show ClosureFieldElement; |
8 import '../../common.dart'; | 8 import '../../common.dart'; |
9 import '../../common/names.dart' show Names, Selectors; | 9 import '../../common/names.dart' show Names, Selectors; |
10 import '../../compiler.dart' show Compiler; | 10 import '../../compiler.dart' show Compiler; |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 if (selectors != null && !selectors.isEmpty) { | 524 if (selectors != null && !selectors.isEmpty) { |
525 Map<js.Name, js.Expression> callStubsForMember = | 525 Map<js.Name, js.Expression> callStubsForMember = |
526 classStubGenerator.generateCallStubsForGetter(member, selectors); | 526 classStubGenerator.generateCallStubsForGetter(member, selectors); |
527 callStubsForMember.forEach((js.Name name, js.Expression code) { | 527 callStubsForMember.forEach((js.Name name, js.Expression code) { |
528 callStubs.add(_buildStubMethod(name, code, element: member)); | 528 callStubs.add(_buildStubMethod(name, code, element: member)); |
529 }); | 529 }); |
530 } | 530 } |
531 } | 531 } |
532 } | 532 } |
533 | 533 |
534 List<StubMethod> typeVariableReaderStubs = | |
535 runtimeTypeGenerator.generateTypeVariableReaderStubs(element); | |
536 | |
537 List<StubMethod> noSuchMethodStubs = <StubMethod>[]; | 534 List<StubMethod> noSuchMethodStubs = <StubMethod>[]; |
538 | 535 |
539 if (backend.enabledNoSuchMethod && element.isObject) { | 536 if (backend.enabledNoSuchMethod && element.isObject) { |
540 Map<js.Name, Selector> selectors = | 537 Map<js.Name, Selector> selectors = |
541 classStubGenerator.computeSelectorsForNsmHandlers(); | 538 classStubGenerator.computeSelectorsForNsmHandlers(); |
542 selectors.forEach((js.Name name, Selector selector) { | 539 selectors.forEach((js.Name name, Selector selector) { |
543 // If the program contains `const Symbol` names we have to retain them. | 540 // If the program contains `const Symbol` names we have to retain them. |
544 String selectorName = selector.name; | 541 String selectorName = selector.name; |
545 if (selector.isSetter) selectorName = "$selectorName="; | 542 if (selector.isSetter) selectorName = "$selectorName="; |
546 if (backend.mirrorsData.symbolsUsed.contains(selectorName)) { | 543 if (backend.mirrorsData.symbolsUsed.contains(selectorName)) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 assert(!backend.isNative(element)); | 610 assert(!backend.isNative(element)); |
614 assert(methods.isEmpty); | 611 assert(methods.isEmpty); |
615 | 612 |
616 result = new MixinApplication( | 613 result = new MixinApplication( |
617 element, | 614 element, |
618 name, | 615 name, |
619 holder, | 616 holder, |
620 instanceFields, | 617 instanceFields, |
621 staticFieldsForReflection, | 618 staticFieldsForReflection, |
622 callStubs, | 619 callStubs, |
623 typeVariableReaderStubs, | |
624 checkedSetters, | 620 checkedSetters, |
625 isChecks, | 621 isChecks, |
626 typeTests.functionTypeIndex, | 622 typeTests.functionTypeIndex, |
627 isDirectlyInstantiated: isInstantiated, | 623 isDirectlyInstantiated: isInstantiated, |
628 hasRtiField: hasRtiField, | 624 hasRtiField: hasRtiField, |
629 onlyForRti: onlyForRti); | 625 onlyForRti: onlyForRti); |
630 } else { | 626 } else { |
631 result = new Class( | 627 result = new Class( |
632 element, | 628 element, |
633 name, | 629 name, |
634 holder, | 630 holder, |
635 methods, | 631 methods, |
636 instanceFields, | 632 instanceFields, |
637 staticFieldsForReflection, | 633 staticFieldsForReflection, |
638 callStubs, | 634 callStubs, |
639 typeVariableReaderStubs, | |
640 noSuchMethodStubs, | 635 noSuchMethodStubs, |
641 checkedSetters, | 636 checkedSetters, |
642 isChecks, | 637 isChecks, |
643 typeTests.functionTypeIndex, | 638 typeTests.functionTypeIndex, |
644 isDirectlyInstantiated: isInstantiated, | 639 isDirectlyInstantiated: isInstantiated, |
645 hasRtiField: hasRtiField, | 640 hasRtiField: hasRtiField, |
646 onlyForRti: onlyForRti, | 641 onlyForRti: onlyForRti, |
647 isNative: backend.isNative(element)); | 642 isNative: backend.isNative(element)); |
648 } | 643 } |
649 _classes[element] = result; | 644 _classes[element] = result; |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 Constant constant = new Constant(name, holder, constantValue); | 962 Constant constant = new Constant(name, holder, constantValue); |
968 _constants[constantValue] = constant; | 963 _constants[constantValue] = constant; |
969 } | 964 } |
970 } | 965 } |
971 | 966 |
972 Holder _registerStaticStateHolder() { | 967 Holder _registerStaticStateHolder() { |
973 return _registry.registerHolder(namer.staticStateHolder, | 968 return _registry.registerHolder(namer.staticStateHolder, |
974 isStaticStateHolder: true); | 969 isStaticStateHolder: true); |
975 } | 970 } |
976 } | 971 } |
OLD | NEW |