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

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

Issue 11598006: Concept of how dart:mirrors LibraryMirror, ClassMirror can be implemented in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added enough closure support to get tests/lib/mirrors/mirrors_test.dart pass. Created 7 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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/enqueue.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 bool disableInlining = false; 128 bool disableInlining = false;
129 129
130 final Tracer tracer; 130 final Tracer tracer;
131 131
132 CompilerTask measuredTask; 132 CompilerTask measuredTask;
133 Element _currentElement; 133 Element _currentElement;
134 LibraryElement coreLibrary; 134 LibraryElement coreLibrary;
135 LibraryElement isolateLibrary; 135 LibraryElement isolateLibrary;
136 LibraryElement isolateHelperLibrary; 136 LibraryElement isolateHelperLibrary;
137 LibraryElement mirrorsLibrary;
137 LibraryElement jsHelperLibrary; 138 LibraryElement jsHelperLibrary;
138 LibraryElement interceptorsLibrary; 139 LibraryElement interceptorsLibrary;
139 LibraryElement foreignLibrary; 140 LibraryElement foreignLibrary;
140 LibraryElement mainApp; 141 LibraryElement mainApp;
141 142
142 ClassElement objectClass; 143 ClassElement objectClass;
143 ClassElement closureClass; 144 ClassElement closureClass;
144 ClassElement dynamicClass; 145 ClassElement dynamicClass;
145 ClassElement boolClass; 146 ClassElement boolClass;
146 ClassElement numClass; 147 ClassElement numClass;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 static const SourceString MAIN = const SourceString('main'); 212 static const SourceString MAIN = const SourceString('main');
212 static const SourceString CALL_OPERATOR_NAME = const SourceString('call'); 213 static const SourceString CALL_OPERATOR_NAME = const SourceString('call');
213 static const SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod'); 214 static const SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod');
214 static const int NO_SUCH_METHOD_ARG_COUNT = 1; 215 static const int NO_SUCH_METHOD_ARG_COUNT = 1;
215 static const SourceString CREATE_INVOCATION_MIRROR = 216 static const SourceString CREATE_INVOCATION_MIRROR =
216 const SourceString('createInvocationMirror'); 217 const SourceString('createInvocationMirror');
217 static const SourceString INVOKE_ON = const SourceString('invokeOn'); 218 static const SourceString INVOKE_ON = const SourceString('invokeOn');
218 static const SourceString RUNTIME_TYPE = const SourceString('runtimeType'); 219 static const SourceString RUNTIME_TYPE = const SourceString('runtimeType');
219 static const SourceString START_ROOT_ISOLATE = 220 static const SourceString START_ROOT_ISOLATE =
220 const SourceString('startRootIsolate'); 221 const SourceString('startRootIsolate');
222 static const SourceString CREATE_MIRROR_SYSTEM =
223 const SourceString('_createMirrorSystem');
221 bool enabledNoSuchMethod = false; 224 bool enabledNoSuchMethod = false;
222 bool enabledRuntimeType = false; 225 bool enabledRuntimeType = false;
223 bool enabledFunctionApply = false; 226 bool enabledFunctionApply = false;
224 bool enabledInvokeOn = false; 227 bool enabledInvokeOn = false;
225 228
226 Stopwatch progress; 229 Stopwatch progress;
227 230
228 static const int PHASE_SCANNING = 0; 231 static const int PHASE_SCANNING = 0;
229 static const int PHASE_RESOLVING = 1; 232 static const int PHASE_RESOLVING = 1;
230 static const int PHASE_COMPILING = 2; 233 static const int PHASE_COMPILING = 2;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 enqueuer.resolution.addToWorkList( 417 enqueuer.resolution.addToWorkList(
415 isolateHelperLibrary.find(const SourceString('_currentIsolate'))); 418 isolateHelperLibrary.find(const SourceString('_currentIsolate')));
416 enqueuer.resolution.addToWorkList( 419 enqueuer.resolution.addToWorkList(
417 isolateHelperLibrary.find(const SourceString('_callInIsolate'))); 420 isolateHelperLibrary.find(const SourceString('_callInIsolate')));
418 enqueuer.codegen.addToWorkList( 421 enqueuer.codegen.addToWorkList(
419 isolateHelperLibrary.find(START_ROOT_ISOLATE)); 422 isolateHelperLibrary.find(START_ROOT_ISOLATE));
420 } 423 }
421 424
422 bool hasIsolateSupport() => isolateLibrary != null; 425 bool hasIsolateSupport() => isolateLibrary != null;
423 426
427 void enableMirrorsSupport(LibraryElement element) {
428 mirrorsLibrary = element.patch;
429 enqueuer.resolution.addToWorkList(
430 mirrorsLibrary.find(CREATE_MIRROR_SYSTEM));
431 enqueuer.codegen.addToWorkList(
432 mirrorsLibrary.find(CREATE_MIRROR_SYSTEM));
433 }
434
435 bool hasMirrorsSupport() => mirrorsLibrary != null;
436
424 /** 437 /**
425 * This method is called before [library] import and export scopes have been 438 * This method is called before [library] import and export scopes have been
426 * set up. 439 * set up.
427 */ 440 */
428 void onLibraryScanned(LibraryElement library, Uri uri) { 441 void onLibraryScanned(LibraryElement library, Uri uri) {
429 if (dynamicClass != null) { 442 if (dynamicClass != null) {
430 // When loading the built-in libraries, dynamicClass is null. We 443 // When loading the built-in libraries, dynamicClass is null. We
431 // take advantage of this as core imports js_helper and sees [dynamic] 444 // take advantage of this as core imports js_helper and sees [dynamic]
432 // this way. 445 // this way.
433 withCurrentElement(dynamicClass, () { 446 withCurrentElement(dynamicClass, () {
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 // TODO(johnniwinther): Use [spannable] and [message] to provide better 1000 // TODO(johnniwinther): Use [spannable] and [message] to provide better
988 // information on assertion errors. 1001 // information on assertion errors.
989 if (condition is Function){ 1002 if (condition is Function){
990 condition = condition(); 1003 condition = condition();
991 } 1004 }
992 if (spannable == null || !condition) { 1005 if (spannable == null || !condition) {
993 throw new SpannableAssertionFailure(spannable, message); 1006 throw new SpannableAssertionFailure(spannable, message);
994 } 1007 }
995 return true; 1008 return true;
996 } 1009 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/enqueue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698