OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 type_graph_inferrer; | 5 part of type_graph_inferrer; |
6 | 6 |
7 // A set of selectors we know do not escape the elements inside the | 7 // A set of selectors we know do not escape the elements inside the |
8 // list. | 8 // list. |
9 Set<String> doesNotEscapeListSet = new Set<String>.from( | 9 Set<String> doesNotEscapeListSet = new Set<String>.from( |
10 const <String>[ | 10 const <String>[ |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 } | 348 } |
349 | 349 |
350 bool isClosure(Element element) { | 350 bool isClosure(Element element) { |
351 if (!element.isFunction) return false; | 351 if (!element.isFunction) return false; |
352 /// Creating an instance of a class that implements [Function] also | 352 /// Creating an instance of a class that implements [Function] also |
353 /// closurizes the corresponding [call] member. We do not currently | 353 /// closurizes the corresponding [call] member. We do not currently |
354 /// track these, thus the check for [isClosurized] on such a method will | 354 /// track these, thus the check for [isClosurized] on such a method will |
355 /// return false. Instead we catch that case here for now. | 355 /// return false. Instead we catch that case here for now. |
356 // TODO(herhut): Handle creation of closures from instances of Function. | 356 // TODO(herhut): Handle creation of closures from instances of Function. |
357 if (element.isInstanceMember && | 357 if (element.isInstanceMember && |
358 element.name == Compiler.CALL_OPERATOR_NAME) { | 358 element.name == Identifiers.call) { |
359 return true; | 359 return true; |
360 } | 360 } |
361 Element outermost = element.outermostEnclosingMemberOrTopLevel; | 361 Element outermost = element.outermostEnclosingMemberOrTopLevel; |
362 return outermost.declaration != element.declaration; | 362 return outermost.declaration != element.declaration; |
363 } | 363 } |
364 | 364 |
365 void visitMemberTypeInformation(MemberTypeInformation info) { | 365 void visitMemberTypeInformation(MemberTypeInformation info) { |
366 if (info.isClosurized) { | 366 if (info.isClosurized) { |
367 bailout('Returned from a closurized method'); | 367 bailout('Returned from a closurized method'); |
368 } | 368 } |
(...skipping 18 matching lines...) Expand all Loading... |
387 } | 387 } |
388 if (isParameterOfListAddingMethod(info.element) || | 388 if (isParameterOfListAddingMethod(info.element) || |
389 isParameterOfMapAddingMethod(info.element)) { | 389 isParameterOfMapAddingMethod(info.element)) { |
390 // These elements are being handled in | 390 // These elements are being handled in |
391 // [visitDynamicCallSiteTypeInformation]. | 391 // [visitDynamicCallSiteTypeInformation]. |
392 return; | 392 return; |
393 } | 393 } |
394 addNewEscapeInformation(info); | 394 addNewEscapeInformation(info); |
395 } | 395 } |
396 } | 396 } |
OLD | NEW |