git @ Cat's Eye Technologies SixtyPical / 52fb1dc
Inch toward compiling statics. Chris Pressey 7 years ago
1 changed file(s) with 7 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
3030 self.routines = {}
3131 self.labels = {}
3232 self.trampolines = {} # Location -> Label
33 self.current_routine = None
3334
3435 # helper methods
3536
5758 return length
5859
5960 def get_label(self, name):
61 if self.current_routine and hasattr(self.current_routine, 'statics'):
62 for static in self.current_routine.statics:
63 if static.location.name == name:
64 raise NotImplementedError("static " + name)
6065 return self.labels[name]
6166
6267 # visitor methods
111116
112117
113118 def compile_routine(self, routine):
119 self.current_routine = routine
114120 assert isinstance(routine, Routine)
115121 if routine.block:
116122 self.emitter.resolve_label(self.get_label(routine.name))
117123 self.compile_block(routine.block)
118124 self.emitter.emit(RTS())
125 self.current_routine = None
119126
120127 def compile_block(self, block):
121128 assert isinstance(block, Block)