Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 #library('elements'); | 5 #library('elements'); |
| 6 | 6 |
| 7 #import('../tree/tree.dart'); | 7 #import('../tree/tree.dart'); |
| 8 #import('../scanner/scannerlib.dart'); | 8 #import('../scanner/scannerlib.dart'); |
| 9 #import('../leg.dart'); // TODO(karlklose): we only need type. | 9 #import('../leg.dart'); // TODO(karlklose): we only need type. |
| 10 #import('../util/util.dart'); | 10 #import('../util/util.dart'); |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 349 return (element != null) | 349 return (element != null) |
| 350 && !element.isInstanceMember() | 350 && !element.isInstanceMember() |
| 351 && (element.kind === ElementKind.FIELD); | 351 && (element.kind === ElementKind.FIELD); |
| 352 } | 352 } |
| 353 | 353 |
| 354 static bool isInstanceMethod(Element element) { | 354 static bool isInstanceMethod(Element element) { |
| 355 return (element != null) | 355 return (element != null) |
| 356 && element.isInstanceMember() | 356 && element.isInstanceMember() |
| 357 && (element.kind === ElementKind.FUNCTION); | 357 && (element.kind === ElementKind.FUNCTION); |
| 358 } | 358 } |
| 359 | |
| 360 static bool isClosureSend(Send send, TreeElements elements) { | |
| 361 if (send.isPropertyAccess) return false; | |
| 362 if (send.receiver !== null) return false; | |
| 363 Element element = elements[send]; | |
| 364 // (o)() or foo()(). | |
| 365 if (element === null && send.selector.asIdentifier() === null) return true; | |
| 366 // foo() with foo a local or a parameter. | |
| 367 if (element.kind === ElementKind.VARIABLE || | |
|
kasperl
2012/01/05 12:52:19
Should we have element.isVariable() and element.is
floitsch
2012/01/05 13:59:20
Done.
| |
| 368 element.kind === ElementKind.PARAMETER) { | |
| 369 return true; | |
| 370 } | |
| 371 return false; | |
| 372 } | |
| 359 } | 373 } |
| OLD | NEW |