OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 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 |
| 4 |
| 5 part of models; |
| 6 |
| 7 enum FunctionKind { |
| 8 regular, |
| 9 closure, |
| 10 getter, |
| 11 setter, |
| 12 constructor, |
| 13 implicitGetter, |
| 14 implicitSetter, |
| 15 implicitStaticFinalGetter, |
| 16 irregexpFunction, |
| 17 staticInitializer, |
| 18 methodExtractor, |
| 19 noSuchMethodDispatcher, |
| 20 invokeFieldDispatcher, |
| 21 collected, |
| 22 native, |
| 23 stub, |
| 24 tag, |
| 25 signatureFunction |
| 26 } |
| 27 |
| 28 bool isSyntheticFunction(FunctionKind kind) { |
| 29 switch (kind) { |
| 30 case FunctionKind.collected: |
| 31 case FunctionKind.native: |
| 32 case FunctionKind.stub: |
| 33 case FunctionKind.tag: |
| 34 return true; |
| 35 default: |
| 36 return false; |
| 37 } |
| 38 } |
| 39 |
| 40 bool isDartFunction(FunctionKind kind) => !isSyntheticFunction(kind); |
| 41 bool isStubFunction(FunctionKind kind) => kind == FunctionKind.stub; |
| 42 bool hasDartCode(FunctionKind kind) => |
| 43 isDartFunction(kind) || isStubFunction(kind); |
| 44 |
| 45 abstract class FunctionRef extends ObjectRef { |
| 46 /// The name of this class. |
| 47 String get name; |
| 48 |
| 49 /// The owner of this function, which can be a LibraryRef, ClassRef, |
| 50 /// or a FunctionRef. |
| 51 ObjectRef get dartOwner; // owner |
| 52 |
| 53 /// Is this function static? |
| 54 bool get isStatic; |
| 55 |
| 56 /// Is this function const? |
| 57 bool get isConst; |
| 58 |
| 59 /// The kind of the function. |
| 60 FunctionKind get kind; |
| 61 } |
| 62 |
| 63 abstract class Function extends Object implements FunctionRef { |
| 64 /// The location of this function in the source code. [optional] |
| 65 SourceLocation get location; |
| 66 |
| 67 /// The compiled code associated with this function. [optional] |
| 68 CodeRef get code; |
| 69 } |
OLD | NEW |