1 //
2 // Copyright (c) 2006, Brian Frank and Andy Frank
3 // Licensed under the Academic Free License version 3.0
4 //
5 // History:
6 // 15 Sep 05 Brian Frank Creation
7 // 2 Jun 06 Brian Frank Ported from Java to Fan
8 //
9
10 **
11 ** VisitStep represents one discrete task run during the compiler
12 ** pipeline. The implementations are found under steps.
13 **
14 abstract class CompilerStep : CompilerSupport, Visitor
15 {
16
17 //////////////////////////////////////////////////////////////////////////
18 // Construction
19 //////////////////////////////////////////////////////////////////////////
20
21 **
22 ** Constructor takes the associated Compiler
23 **
24 new make(Compiler compiler)
25 : super(compiler)
26 {
27 }
28
29 //////////////////////////////////////////////////////////////////////////
30 // Methods
31 //////////////////////////////////////////////////////////////////////////
32
33 **
34 ** Run the step
35 **
36 abstract Void run()
37
38 //////////////////////////////////////////////////////////////////////////
39 // Visitor
40 //////////////////////////////////////////////////////////////////////////
41
42 Bool inStatic()
43 {
44 return curMethod.isStatic
45 }
46
47 override Void enterTypeDef(TypeDef def)
48 {
49 curType = def
50 }
51
52 override Void exitTypeDef(TypeDef def)
53 {
54 curType = null
55 }
56
57 override Void enterMethodDef(MethodDef def)
58 {
59 curMethod = def
60 }
61
62 override Void exitMethodDef(MethodDef def)
63 {
64 curMethod = null
65 }
66
67 //////////////////////////////////////////////////////////////////////////
68 // Fields
69 //////////////////////////////////////////////////////////////////////////
70
71 TypeDef curType
72 MethodDef curMethod
73 }