From 52fb1dc6b9205cc63efe818017f6e28be86629f6 Mon Sep 17 00:00:00 2001 From: Chris Pressey Date: Fri, 9 Feb 2018 14:44:41 +0000 Subject: [PATCH] Inch toward compiling statics. --- src/sixtypical/compiler.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/sixtypical/compiler.py b/src/sixtypical/compiler.py index 185e6f6..21527fe 100644 --- a/src/sixtypical/compiler.py +++ b/src/sixtypical/compiler.py @@ -31,6 +31,7 @@ class Compiler(object): self.routines = {} self.labels = {} self.trampolines = {} # Location -> Label + self.current_routine = None # helper methods @@ -58,6 +59,10 @@ class Compiler(object): return length def get_label(self, name): + if self.current_routine and hasattr(self.current_routine, 'statics'): + for static in self.current_routine.statics: + if static.location.name == name: + raise NotImplementedError("static " + name) return self.labels[name] # visitor methods @@ -112,11 +117,13 @@ class Compiler(object): def compile_routine(self, routine): + self.current_routine = routine assert isinstance(routine, Routine) if routine.block: self.emitter.resolve_label(self.get_label(routine.name)) self.compile_block(routine.block) self.emitter.emit(RTS()) + self.current_routine = None def compile_block(self, block): assert isinstance(block, Block)