1 package kawa.lang; 2 import gnu.expr.*; 3 import java.io.*; 4 5 7 8 public class TemplateScope extends LetExp implements Externalizable 9 { 10 17 Declaration macroContext; 18 19 public TemplateScope () 20 { 21 super(null); 22 } 23 24 public TemplateScope (ScopeExp outer) 25 { 26 super(null); 27 this.outer = outer; 28 } 29 30 public static TemplateScope make () 31 { 32 return make((Translator) Compilation.getCurrent()); 33 } 34 35 public static TemplateScope make (Translator tr) 36 { 37 TemplateScope templateScope = new TemplateScope(); 38 Syntax curSyntax = tr.getCurrentSyntax(); 39 if (curSyntax instanceof Macro) 40 { 41 templateScope.outer = ((Macro) curSyntax).getCapturedScope(); 42 templateScope.macroContext = tr.macroContext; 43 } 44 return templateScope; 45 } 46 47 public void writeExternal(ObjectOutput out) throws IOException 48 { 49 out.writeObject(outer); 50 } 51 52 public void readExternal(ObjectInput in) 53 throws IOException, ClassNotFoundException 54 { 55 outer = (ScopeExp) in.readObject(); 56 } 57 } 58 | Popular Tags |