v / vlib / v2 / types / object.v
49 lines · 42 sloc · 787 bytes · ed1549f6808d68defe18fc93b8940ef1e8aaf004
Raw
1// Copyright (c) 2020-2024 Joe Conigliaro. All rights reserved.
2// Use of this source code is governed by an MIT license
3// that can be found in the LICENSE file.
4module types
5
6import v2.token
7
8struct ObjectCommon {
9 parent &Scope = unsafe { nil }
10 pos token.Pos
11 mod &Module
12 name string
13mut:
14 typ Type
15 // order_ u32
16 // color_ color
17}
18
19pub struct Const {
20 ObjectCommon
21pub:
22 int_val int
23}
24
25struct Global {
26 name string
27 mod string
28 is_public bool
29 is_mut bool
30mut:
31 typ Type
32}
33
34pub struct Fn {
35 name string
36 // typ FnType // signature
37mut:
38 typ Type // signature
39}
40
41// get_name returns the function's name
42pub fn (f &Fn) get_name() string {
43 return f.name
44}
45
46// get_typ returns the function's type (FnType)
47pub fn (f &Fn) get_typ() Type {
48 return f.typ
49}
50