| 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. |
| 4 | module types |
| 5 | |
| 6 | import v2.token |
| 7 | |
| 8 | struct ObjectCommon { |
| 9 | parent &Scope = unsafe { nil } |
| 10 | pos token.Pos |
| 11 | mod &Module |
| 12 | name string |
| 13 | mut: |
| 14 | typ Type |
| 15 | // order_ u32 |
| 16 | // color_ color |
| 17 | } |
| 18 | |
| 19 | pub struct Const { |
| 20 | ObjectCommon |
| 21 | pub: |
| 22 | int_val int |
| 23 | } |
| 24 | |
| 25 | struct Global { |
| 26 | name string |
| 27 | mod string |
| 28 | is_public bool |
| 29 | is_mut bool |
| 30 | mut: |
| 31 | typ Type |
| 32 | } |
| 33 | |
| 34 | pub struct Fn { |
| 35 | name string |
| 36 | // typ FnType // signature |
| 37 | mut: |
| 38 | typ Type // signature |
| 39 | } |
| 40 | |
| 41 | // get_name returns the function's name |
| 42 | pub fn (f &Fn) get_name() string { |
| 43 | return f.name |
| 44 | } |
| 45 | |
| 46 | // get_typ returns the function's type (FnType) |
| 47 | pub fn (f &Fn) get_typ() Type { |
| 48 | return f.typ |
| 49 | } |
| 50 | |