PageRenderTime 716ms CodeModel.GetById 711ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 1ms

/source/core/ast/Type.ooc

http://github.com/nddrylliog/oc
Unknown | 52 lines | 27 code | 25 blank | 0 comment | 0 complexity | 519d6db7341ccd5e807dba88960158d8 MD5 | raw file
 1
 2
 3import Node, FuncDecl
 4import middle/Resolver
 5
 6Type: abstract class extends Node {
 7
 8    void?: func -> Bool { false }
 9
10}
11
12
13BaseType: class extends Type {
14
15    resolved := false
16    name: String { get set }
17
18    init: func (=name) {}
19
20    resolve: func (task: Task) {
21        resolved = true
22    }
23    
24    toString: func -> String { name }
25
26}
27
28VoidType: class extends BaseType {
29    
30    init: func {
31        super("void")
32    }
33    
34    void?: func -> Bool { true }
35    
36}
37
38FuncType: class extends Type {
39    
40    proto: FuncDecl { get set }
41    
42    init: func (=proto) {}
43    
44    // well, nothing to do
45    resolve: func (task: Task) {}
46    
47    toString: func -> String { "Func " + proto toString() }
48    
49}
50
51
52