OLD | NEW |
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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 Backend backend; | 196 Backend backend; |
197 ConstantHandler constantHandler; | 197 ConstantHandler constantHandler; |
198 ConstantHandler metadataHandler; | 198 ConstantHandler metadataHandler; |
199 EnqueueTask enqueuer; | 199 EnqueueTask enqueuer; |
200 CompilerTask fileReadingTask; | 200 CompilerTask fileReadingTask; |
201 | 201 |
202 static const SourceString MAIN = const SourceString('main'); | 202 static const SourceString MAIN = const SourceString('main'); |
203 static const SourceString CALL_OPERATOR_NAME = const SourceString('call'); | 203 static const SourceString CALL_OPERATOR_NAME = const SourceString('call'); |
204 static const SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod'); | 204 static const SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod'); |
205 static const int NO_SUCH_METHOD_ARG_COUNT = 1; | 205 static const int NO_SUCH_METHOD_ARG_COUNT = 1; |
| 206 static const SourceString CREATE_INVOCATION_MIRROR = |
| 207 const SourceString('createInvocationMirror'); |
206 static const SourceString INVOKE_ON = const SourceString('invokeOn'); | 208 static const SourceString INVOKE_ON = const SourceString('invokeOn'); |
207 static const SourceString RUNTIME_TYPE = const SourceString('runtimeType'); | 209 static const SourceString RUNTIME_TYPE = const SourceString('runtimeType'); |
208 static const SourceString START_ROOT_ISOLATE = | 210 static const SourceString START_ROOT_ISOLATE = |
209 const SourceString('startRootIsolate'); | 211 const SourceString('startRootIsolate'); |
210 bool enabledNoSuchMethod = false; | 212 bool enabledNoSuchMethod = false; |
211 bool enabledRuntimeType = false; | 213 bool enabledRuntimeType = false; |
212 bool enabledFunctionApply = false; | 214 bool enabledFunctionApply = false; |
213 bool enabledInvokeOn = false; | 215 bool enabledInvokeOn = false; |
214 | 216 |
215 Stopwatch progress; | 217 Stopwatch progress; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 if (identical(element.getEnclosingClass(), objectClass)) { | 374 if (identical(element.getEnclosingClass(), objectClass)) { |
373 enqueuer.resolution.registerDynamicInvocationOf(element); | 375 enqueuer.resolution.registerDynamicInvocationOf(element); |
374 return; | 376 return; |
375 } | 377 } |
376 enabledNoSuchMethod = true; | 378 enabledNoSuchMethod = true; |
377 Selector selector = new Selector.noSuchMethod(); | 379 Selector selector = new Selector.noSuchMethod(); |
378 enqueuer.resolution.registerInvocation(NO_SUCH_METHOD, selector); | 380 enqueuer.resolution.registerInvocation(NO_SUCH_METHOD, selector); |
379 enqueuer.codegen.registerInvocation(NO_SUCH_METHOD, selector); | 381 enqueuer.codegen.registerInvocation(NO_SUCH_METHOD, selector); |
380 | 382 |
381 Element createInvocationMirrorElement = | 383 Element createInvocationMirrorElement = |
382 findHelper(const SourceString('createInvocationMirror')); | 384 findHelper(CREATE_INVOCATION_MIRROR); |
383 enqueuer.resolution.addToWorkList(createInvocationMirrorElement); | 385 enqueuer.resolution.addToWorkList(createInvocationMirrorElement); |
384 enqueuer.codegen.addToWorkList(createInvocationMirrorElement); | 386 enqueuer.codegen.addToWorkList(createInvocationMirrorElement); |
385 } | 387 } |
386 | 388 |
387 void enableIsolateSupport(LibraryElement element) { | 389 void enableIsolateSupport(LibraryElement element) { |
388 // TODO(ahe): Move this method to Enqueuer. | 390 // TODO(ahe): Move this method to Enqueuer. |
389 isolateLibrary = element.patch; | 391 isolateLibrary = element.patch; |
390 enqueuer.resolution.addToWorkList(isolateLibrary.find(START_ROOT_ISOLATE)); | 392 enqueuer.resolution.addToWorkList(isolateLibrary.find(START_ROOT_ISOLATE)); |
391 enqueuer.resolution.addToWorkList( | 393 enqueuer.resolution.addToWorkList( |
392 isolateLibrary.find(const SourceString('_currentIsolate'))); | 394 isolateLibrary.find(const SourceString('_currentIsolate'))); |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 // TODO(johnniwinther): Use [spannable] and [message] to provide better | 945 // TODO(johnniwinther): Use [spannable] and [message] to provide better |
944 // information on assertion errors. | 946 // information on assertion errors. |
945 if (condition is Function){ | 947 if (condition is Function){ |
946 condition = condition(); | 948 condition = condition(); |
947 } | 949 } |
948 if (spannable == null || !condition) { | 950 if (spannable == null || !condition) { |
949 throw new SpannableAssertionFailure(spannable, message); | 951 throw new SpannableAssertionFailure(spannable, message); |
950 } | 952 } |
951 return true; | 953 return true; |
952 } | 954 } |
OLD | NEW |