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, | |
Cutch
2016/08/01 22:24:26
lowerCamelCase
cbernaschina
2016/08/01 22:45:51
Done.
| |
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 |