forked from gracelang/minigrace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
identifierKinds.grace
70 lines (66 loc) · 1.89 KB
/
identifierKinds.grace
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Constants distinguishing between different kinds of identifier.
// Defines observers for their properties.
type T = EqualityObject & interface {
isParameter -> Boolean
isAssignable -> Boolean
isImplicit -> Boolean
isRequired -> Boolean
forUsers -> Boolean
fromParent -> Boolean
}
class kindConstant(name) {
use identityEquality
method asString { name }
method isParameter { false }
method isAssignable { false }
method isImplicit { false }
method forUsers { true }
method fromParent { false }
method forGct { true }
method isRequired { false }
}
def undefined is public = kindConstant "undefined"
def defdec is public = kindConstant "defdec"
def methdec is public = kindConstant "method"
def typedec is public = kindConstant "typedec"
def aliasdec is public = kindConstant "alias"
def selfDef is public = object {
inherit kindConstant "selfDef"
method isImplicit { true }
method forUsers { false }
method forGct { false }
}
def fromTrait is public = object {
inherit kindConstant "from a trait"
method isImplicit { true }
method fromParent { true }
}
def inherited is public = object {
inherit kindConstant "inherited"
method isImplicit { true }
method fromParent { true }
}
def required is public = object {
inherit kindConstant "required"
method isRequired {true}
method isImplicit { true }
}
def vardec is public = object {
inherit kindConstant "vardec"
method isAssignable { true }
}
def parameter is public = object {
inherit kindConstant "parameter"
method isParameter { true }
}
def typeparam is public = object {
inherit kindConstant "typeparam"
method isParameter { true }
}
def graceObjectMethod is public = object {
inherit kindConstant "from graceObject"
method isImplicit { true }
method forUsers { false }
method fromParent { true }
method forGct { false }
}