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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/compiler.dart

Issue 48323003: Implement fromEnvironment on bool, int, String in dart2js. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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; 5 part of dart2js;
6 6
7 /** 7 /**
8 * If true, print a warning for each method that was resolved, but not 8 * If true, print a warning for each method that was resolved, but not
9 * compiled. 9 * compiled.
10 */ 10 */
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 // Initialized when dart:mirrors is loaded. 458 // Initialized when dart:mirrors is loaded.
459 ClassElement deferredLibraryClass; 459 ClassElement deferredLibraryClass;
460 460
461 ClassElement jsInvocationMirrorClass; 461 ClassElement jsInvocationMirrorClass;
462 /// Document class from dart:mirrors. 462 /// Document class from dart:mirrors.
463 ClassElement documentClass; 463 ClassElement documentClass;
464 Element assertMethod; 464 Element assertMethod;
465 Element identicalFunction; 465 Element identicalFunction;
466 Element functionApplyMethod; 466 Element functionApplyMethod;
467 Element invokeOnMethod; 467 Element invokeOnMethod;
468 Element intEnvironment;
469 Element boolEnvironment;
470 Element stringEnvironment;
471
472 fromEnvironment(String name) => null;
468 473
469 Element get currentElement => _currentElement; 474 Element get currentElement => _currentElement;
470 475
471 String tryToString(object) { 476 String tryToString(object) {
472 try { 477 try {
473 return object.toString(); 478 return object.toString();
474 } catch (_) { 479 } catch (_) {
475 return '<exception in toString()>'; 480 return '<exception in toString()>';
476 } 481 }
477 } 482 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 final Selector iteratorSelector = 561 final Selector iteratorSelector =
557 new Selector.getter('iterator', null); 562 new Selector.getter('iterator', null);
558 final Selector currentSelector = 563 final Selector currentSelector =
559 new Selector.getter('current', null); 564 new Selector.getter('current', null);
560 final Selector moveNextSelector = 565 final Selector moveNextSelector =
561 new Selector.call('moveNext', null, 0); 566 new Selector.call('moveNext', null, 0);
562 final Selector noSuchMethodSelector = new Selector.call( 567 final Selector noSuchMethodSelector = new Selector.call(
563 Compiler.NO_SUCH_METHOD, null, Compiler.NO_SUCH_METHOD_ARG_COUNT); 568 Compiler.NO_SUCH_METHOD, null, Compiler.NO_SUCH_METHOD_ARG_COUNT);
564 final Selector symbolValidatedConstructorSelector = new Selector.call( 569 final Selector symbolValidatedConstructorSelector = new Selector.call(
565 'validated', null, 1); 570 'validated', null, 1);
571 final Selector fromEnvironmentSelector = new Selector.callConstructor(
572 'fromEnvironment', null, 2);
566 573
567 bool enabledNoSuchMethod = false; 574 bool enabledNoSuchMethod = false;
568 bool enabledRuntimeType = false; 575 bool enabledRuntimeType = false;
569 bool enabledFunctionApply = false; 576 bool enabledFunctionApply = false;
570 bool enabledInvokeOn = false; 577 bool enabledInvokeOn = false;
571 578
572 Stopwatch progress = new Stopwatch()..start(); 579 Stopwatch progress = new Stopwatch()..start();
573 580
574 static const int PHASE_SCANNING = 0; 581 static const int PHASE_SCANNING = 0;
575 static const int PHASE_RESOLVING = 1; 582 static const int PHASE_RESOLVING = 1;
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 if (mirrorSystemClass == cls) { 844 if (mirrorSystemClass == cls) {
838 mirrorSystemGetNameFunction = 845 mirrorSystemGetNameFunction =
839 cls.lookupLocalMember('getName'); 846 cls.lookupLocalMember('getName');
840 } else if (symbolClass == cls) { 847 } else if (symbolClass == cls) {
841 symbolConstructor = cls.constructors.head; 848 symbolConstructor = cls.constructors.head;
842 } else if (symbolImplementationClass == cls) { 849 } else if (symbolImplementationClass == cls) {
843 symbolValidatedConstructor = symbolImplementationClass.lookupConstructor( 850 symbolValidatedConstructor = symbolImplementationClass.lookupConstructor(
844 symbolValidatedConstructorSelector); 851 symbolValidatedConstructorSelector);
845 } else if (mirrorsUsedClass == cls) { 852 } else if (mirrorsUsedClass == cls) {
846 mirrorsUsedConstructor = cls.constructors.head; 853 mirrorsUsedConstructor = cls.constructors.head;
854 } else if (intClass == cls) {
855 intEnvironment = intClass.lookupConstructor(fromEnvironmentSelector);
856 } else if (stringClass == cls) {
857 stringEnvironment =
858 stringClass.lookupConstructor(fromEnvironmentSelector);
859 } else if (boolClass == cls) {
860 boolEnvironment = boolClass.lookupConstructor(fromEnvironmentSelector);
847 } 861 }
848 } 862 }
849 863
850 Future<LibraryElement> scanBuiltinLibrary(String filename); 864 Future<LibraryElement> scanBuiltinLibrary(String filename);
851 865
852 void initializeSpecialClasses() { 866 void initializeSpecialClasses() {
853 final List missingCoreClasses = []; 867 final List missingCoreClasses = [];
854 ClassElement lookupCoreClass(String name) { 868 ClassElement lookupCoreClass(String name) {
855 ClassElement result = coreLibrary.find(name); 869 ClassElement result = coreLibrary.find(name);
856 if (result == null) { 870 if (result == null) {
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 1637
1624 void close() {} 1638 void close() {}
1625 1639
1626 toString() => name; 1640 toString() => name;
1627 1641
1628 /// Convenience method for getting an [api.CompilerOutputProvider]. 1642 /// Convenience method for getting an [api.CompilerOutputProvider].
1629 static NullSink outputProvider(String name, String extension) { 1643 static NullSink outputProvider(String name, String extension) {
1630 return new NullSink('$name.$extension'); 1644 return new NullSink('$name.$extension');
1631 } 1645 }
1632 } 1646 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698