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

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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 // Initialized when dart:mirrors is loaded. 466 // Initialized when dart:mirrors is loaded.
467 ClassElement deferredLibraryClass; 467 ClassElement deferredLibraryClass;
468 468
469 ClassElement jsInvocationMirrorClass; 469 ClassElement jsInvocationMirrorClass;
470 /// Document class from dart:mirrors. 470 /// Document class from dart:mirrors.
471 ClassElement documentClass; 471 ClassElement documentClass;
472 Element assertMethod; 472 Element assertMethod;
473 Element identicalFunction; 473 Element identicalFunction;
474 Element functionApplyMethod; 474 Element functionApplyMethod;
475 Element invokeOnMethod; 475 Element invokeOnMethod;
476 Element intEnvironment;
477 Element boolEnvironment;
478 Element stringEnvironment;
479
480 fromEnvironment(String name) => null;
476 481
477 Element get currentElement => _currentElement; 482 Element get currentElement => _currentElement;
478 483
479 String tryToString(object) { 484 String tryToString(object) {
480 try { 485 try {
481 return object.toString(); 486 return object.toString();
482 } catch (_) { 487 } catch (_) {
483 return '<exception in toString()>'; 488 return '<exception in toString()>';
484 } 489 }
485 } 490 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 final Selector iteratorSelector = 569 final Selector iteratorSelector =
565 new Selector.getter('iterator', null); 570 new Selector.getter('iterator', null);
566 final Selector currentSelector = 571 final Selector currentSelector =
567 new Selector.getter('current', null); 572 new Selector.getter('current', null);
568 final Selector moveNextSelector = 573 final Selector moveNextSelector =
569 new Selector.call('moveNext', null, 0); 574 new Selector.call('moveNext', null, 0);
570 final Selector noSuchMethodSelector = new Selector.call( 575 final Selector noSuchMethodSelector = new Selector.call(
571 Compiler.NO_SUCH_METHOD, null, Compiler.NO_SUCH_METHOD_ARG_COUNT); 576 Compiler.NO_SUCH_METHOD, null, Compiler.NO_SUCH_METHOD_ARG_COUNT);
572 final Selector symbolValidatedConstructorSelector = new Selector.call( 577 final Selector symbolValidatedConstructorSelector = new Selector.call(
573 'validated', null, 1); 578 'validated', null, 1);
579 final Selector fromEnvironmentSelector = new Selector.callConstructor(
580 'fromEnvironment', null, 2);
574 581
575 bool enabledNoSuchMethod = false; 582 bool enabledNoSuchMethod = false;
576 bool enabledRuntimeType = false; 583 bool enabledRuntimeType = false;
577 bool enabledFunctionApply = false; 584 bool enabledFunctionApply = false;
578 bool enabledInvokeOn = false; 585 bool enabledInvokeOn = false;
579 586
580 Stopwatch progress = new Stopwatch()..start(); 587 Stopwatch progress = new Stopwatch()..start();
581 588
582 static const int PHASE_SCANNING = 0; 589 static const int PHASE_SCANNING = 0;
583 static const int PHASE_RESOLVING = 1; 590 static const int PHASE_RESOLVING = 1;
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 if (mirrorSystemClass == cls) { 852 if (mirrorSystemClass == cls) {
846 mirrorSystemGetNameFunction = 853 mirrorSystemGetNameFunction =
847 cls.lookupLocalMember('getName'); 854 cls.lookupLocalMember('getName');
848 } else if (symbolClass == cls) { 855 } else if (symbolClass == cls) {
849 symbolConstructor = cls.constructors.head; 856 symbolConstructor = cls.constructors.head;
850 } else if (symbolImplementationClass == cls) { 857 } else if (symbolImplementationClass == cls) {
851 symbolValidatedConstructor = symbolImplementationClass.lookupConstructor( 858 symbolValidatedConstructor = symbolImplementationClass.lookupConstructor(
852 symbolValidatedConstructorSelector); 859 symbolValidatedConstructorSelector);
853 } else if (mirrorsUsedClass == cls) { 860 } else if (mirrorsUsedClass == cls) {
854 mirrorsUsedConstructor = cls.constructors.head; 861 mirrorsUsedConstructor = cls.constructors.head;
862 } else if (intClass == cls) {
863 intEnvironment = intClass.lookupConstructor(fromEnvironmentSelector);
864 } else if (stringClass == cls) {
865 stringEnvironment =
866 stringClass.lookupConstructor(fromEnvironmentSelector);
867 } else if (boolClass == cls) {
868 boolEnvironment = boolClass.lookupConstructor(fromEnvironmentSelector);
855 } 869 }
856 } 870 }
857 871
858 Future<LibraryElement> scanBuiltinLibrary(String filename); 872 Future<LibraryElement> scanBuiltinLibrary(String filename);
859 873
860 void initializeSpecialClasses() { 874 void initializeSpecialClasses() {
861 final List missingCoreClasses = []; 875 final List missingCoreClasses = [];
862 ClassElement lookupCoreClass(String name) { 876 ClassElement lookupCoreClass(String name) {
863 ClassElement result = coreLibrary.find(name); 877 ClassElement result = coreLibrary.find(name);
864 if (result == null) { 878 if (result == null) {
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
1631 1645
1632 void close() {} 1646 void close() {}
1633 1647
1634 toString() => name; 1648 toString() => name;
1635 1649
1636 /// Convenience method for getting an [api.CompilerOutputProvider]. 1650 /// Convenience method for getting an [api.CompilerOutputProvider].
1637 static NullSink outputProvider(String name, String extension) { 1651 static NullSink outputProvider(String name, String extension) {
1638 return new NullSink('$name.$extension'); 1652 return new NullSink('$name.$extension');
1639 } 1653 }
1640 } 1654 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698