-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathExprArg.zu
48 lines (40 loc) · 1.26 KB
/
ExprArg.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
43
44
45
46
47
48
#
# The Zimbu compiler written in Zimbu
#
# ExprArg class: arguments for expressions.
#
# Copyright 2010 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 "Declaration.zu"
IMPORT "Type.zu"
CLASS ExprArg @items=public # TODO: restrict visibility
Declaration $dest # destination, including desired type of result
bool $stringConvert # convert int/bool/status to string
bool $exactMatch # no conversion between class and object, func and
# funcRef, etc.
int $undef # count undefined types
bool $top # Toplevel expression: RHS of assignment or function
# argument.
NEW(Declaration dest, bool stringConvert)
$dest = dest
$stringConvert = stringConvert
}
# Create a new object without a destination type set.
NEW(bool stringConvert)
$stringConvert = stringConvert
}
FUNC $destType() Type
IF $dest == NIL
RETURN NIL
}
RETURN $dest.type
}
FUNC $copy() ExprArg
ExprArg r = NEW($dest, $stringConvert)
r.exactMatch = $exactMatch
r.undef = $undef
r.top = $top
RETURN r
}
}