Mercurial > lcfOS
comparison python/ir/module.py @ 156:1b4a85bdd99c
change types
author | Windel Bouwman |
---|---|
date | Sun, 03 Mar 2013 15:50:34 +0100 |
parents | b28a11c01dbe |
children | 8f3924b6076e |
comparison
equal
deleted
inserted
replaced
155:b28a11c01dbe | 156:1b4a85bdd99c |
---|---|
5 def __init__(self, name): | 5 def __init__(self, name): |
6 self.name = name | 6 self.name = name |
7 self.functions = [] # Do functions come out of symbol table? | 7 self.functions = [] # Do functions come out of symbol table? |
8 self.globals_ = [] # TODO: are globals in symbol table? | 8 self.globals_ = [] # TODO: are globals in symbol table? |
9 self.symtable = SymbolTable() | 9 self.symtable = SymbolTable() |
10 | |
11 Globals = property(lambda self: self.globals_) | 10 Globals = property(lambda self: self.globals_) |
12 Functions = property(lambda self: self.functions) | 11 Functions = property(lambda self: self.functions) |
13 Identifier = property(lambda self: self.identifier) | 12 Identifier = property(lambda self: self.identifier) |
14 | 13 |
15 class Argument: | 14 class Argument: |
17 self.t = argtype | 16 self.t = argtype |
18 self.name = name | 17 self.name = name |
19 self.function = function | 18 self.function = function |
20 | 19 |
21 class Function: | 20 class Function: |
22 def __init__(self, functiontype, name, module): | 21 def __init__(self, name, functiontype): |
23 super().__init__() | 22 super().__init__() |
23 self.name = name | |
24 self.functiontype = functiontype | 24 self.functiontype = functiontype |
25 self.name = name | |
26 self.module = module | |
27 | 25 |
28 self.module.Functions.append(self) | 26 self.module.Functions.append(self) |
29 self.basicblocks = [] | 27 self.basicblocks = [] |
30 self.arguments = [] | 28 self.arguments = [] |
31 # Construct formal arguments depending on function type | 29 # Construct formal arguments depending on function type |
32 | |
33 BasicBlocks = property(lambda self: self.basicblocks) | 30 BasicBlocks = property(lambda self: self.basicblocks) |
34 Arguments = property(lambda self: self.arguments) | 31 Arguments = property(lambda self: self.arguments) |
35 ReturnType = property(lambda self: self.functiontype.returnType) | 32 ReturnType = property(lambda self: self.functiontype.returnType) |
36 FunctionType = property(lambda self: self.functiontype) | 33 FunctionType = property(lambda self: self.functiontype) |
37 | 34 |