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