-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEnumValueType.zu
42 lines (36 loc) · 1.06 KB
/
EnumValueType.zu
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
#
# The Zimbu compiler written in Zimbu
#
# EnumValueType class.
#
# The Type used to specify a variable for an ENUM.
#
# Copyright 2011 Bram Moolenaar All Rights Reserved.
# Licensed under the Apache License, Version 2.0. See the LICENSE file or
# obtain a copy at: http://www.apache.org/licenses/LICENSE-2.0
#
IMPORT "EnumType.zu"
IMPORT "SContext.zu"
IMPORT "Type.zu"
IMPORT "ValueType.zu"
CLASS EnumValueType EXTENDS ValueType @items=public
EnumType $enumType
# Make a copy of this Type. Every subclass must redefine it.
FUNC $copyType() Type @replace @default
EnumValueType ret = NEW($ttype, $name)
$copyEnumValueValues(ret)
RETURN ret
}
# Copy the values of this object into |ret|.
PROC $copyEnumValueValues(EnumValueType ret) @default
$copyValueValues(ret)
ret.enumType = $enumType
}
FUNC $typeName(bool long) string @replace
RETURN $ttype.ToString() .. " of "
.. ($enumType == NIL ? "NIL" : $enumType.name)
}
FUNC $getTypeName(SContext ctx) string @replace
RETURN $enumType.pName
}
}