Mercurial > projects > dang
annotate sema/Visitor.d @ 162:0f38f1a0f06f
Fixed symbol for a functions members.
author | Anders Johnsen <skabet@gmail.com> |
---|---|
date | Tue, 22 Jul 2008 16:22:58 +0200 |
parents | 57b0b4464a0b |
children | 01c2c49775ef |
rev | line source |
---|---|
1 | 1 module sema.Visitor; |
2 | |
3 import tango.io.Stdout; | |
4 | |
5 public | |
94
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
83
diff
changeset
|
6 import ast.Module, |
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
83
diff
changeset
|
7 ast.Decl, |
1 | 8 ast.Stmt, |
9 ast.Exp; | |
10 | |
11 import lexer.Token; | |
12 | |
94
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
83
diff
changeset
|
13 class Visitor(FinalT = int, ModuleT = FinalT, DeclT = ModuleT, StmtT = DeclT, ExpT = StmtT) |
1 | 14 { |
15 public: | |
101
fea8d61a2451
First step(the other first was a bad one) toward imports. You can now compile two files that use eachother - given that they both are in the command line. Right now it's only root sturcts and methods you can use(i guess...?)
Anders Johnsen <skabet@gmail.com>
parents:
99
diff
changeset
|
16 FinalT visit(Module[] modules) |
1 | 17 { |
101
fea8d61a2451
First step(the other first was a bad one) toward imports. You can now compile two files that use eachother - given that they both are in the command line. Right now it's only root sturcts and methods you can use(i guess...?)
Anders Johnsen <skabet@gmail.com>
parents:
99
diff
changeset
|
18 foreach(m ; modules) |
fea8d61a2451
First step(the other first was a bad one) toward imports. You can now compile two files that use eachother - given that they both are in the command line. Right now it's only root sturcts and methods you can use(i guess...?)
Anders Johnsen <skabet@gmail.com>
parents:
99
diff
changeset
|
19 visitModule(m); |
1 | 20 static if (is(FinalT == void)) |
21 return; | |
22 else | |
23 return FinalT.init; | |
24 } | |
25 | |
94
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
83
diff
changeset
|
26 ModuleT visitModule(Module m) |
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
83
diff
changeset
|
27 { |
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
83
diff
changeset
|
28 foreach (decl; m.decls) |
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
83
diff
changeset
|
29 visitDecl(decl); |
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
83
diff
changeset
|
30 static if (is(ModuleT == void)) |
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
83
diff
changeset
|
31 return; |
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
83
diff
changeset
|
32 else |
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
83
diff
changeset
|
33 return ModuleT.init; |
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
83
diff
changeset
|
34 } |
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
83
diff
changeset
|
35 |
1 | 36 DeclT visitDecl(Decl decl) |
37 { | |
38 switch(decl.declType) | |
39 { | |
40 case DeclType.FuncDecl: | |
41 return visitFuncDecl(cast(FuncDecl)decl); | |
42 case DeclType.VarDecl: | |
43 return visitVarDecl(cast(VarDecl)decl); | |
99
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
44 case DeclType.ImportDecl: |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
45 return visitImportDecl(cast(ImportDecl)decl); |
22 | 46 case DeclType.StructDecl: |
47 return visitStructDecl(cast(StructDecl)decl); | |
144
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
48 case DeclType.ClassDecl: |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
49 return visitClassDecl(cast(ClassDecl)decl); |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
50 case DeclType.InterfaceDecl: |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
51 return visitInterfaceDecl(cast(InterfaceDecl)decl); |
1 | 52 default: |
53 throw new Exception("Unknown declaration type"); | |
54 } | |
55 } | |
56 | |
57 StmtT visitStmt(Stmt stmt) | |
58 { | |
59 switch(stmt.stmtType) | |
60 { | |
61 case StmtType.Return: | |
62 return visitReturnStmt(cast(ReturnStmt)stmt); | |
44
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
37
diff
changeset
|
63 case StmtType.Compound: |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
37
diff
changeset
|
64 return visitCompoundStmt(cast(CompoundStatement)stmt); |
1 | 65 case StmtType.Decl: |
66 return visitDeclStmt(cast(DeclStmt)stmt); | |
67 case StmtType.Exp: | |
68 return visitExpStmt(cast(ExpStmt)stmt); | |
5
2c5a8f4c254a
Added very simple if support.
Anders Halager <halager@gmail.com>
parents:
1
diff
changeset
|
69 case StmtType.If: |
2c5a8f4c254a
Added very simple if support.
Anders Halager <halager@gmail.com>
parents:
1
diff
changeset
|
70 return visitIfStmt(cast(IfStmt)stmt); |
11
642c6a998fd9
Support for while statements and fixed scope for if
Anders Halager <halager@gmail.com>
parents:
5
diff
changeset
|
71 case StmtType.While: |
642c6a998fd9
Support for while statements and fixed scope for if
Anders Halager <halager@gmail.com>
parents:
5
diff
changeset
|
72 return visitWhileStmt(cast(WhileStmt)stmt); |
149
393a1f47a6d2
For loops in AST and sema. Should have correct scope and such now.
Anders Johnsen <skabet@gmail.com>
parents:
144
diff
changeset
|
73 case StmtType.For: |
393a1f47a6d2
For loops in AST and sema. Should have correct scope and such now.
Anders Johnsen <skabet@gmail.com>
parents:
144
diff
changeset
|
74 return visitForStmt(cast(ForStmt)stmt); |
36
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
28
diff
changeset
|
75 case StmtType.Switch: |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
28
diff
changeset
|
76 return visitSwitchStmt(cast(SwitchStmt)stmt); |
1 | 77 default: |
78 throw new Exception("Unknown statement type"); | |
79 } | |
80 } | |
81 | |
82 ExpT visitExp(Exp exp) | |
83 { | |
84 switch(exp.expType) | |
85 { | |
86 case ExpType.Binary: | |
87 return visitBinaryExp(cast(BinaryExp)exp); | |
88 case ExpType.IntegerLit: | |
89 return visitIntegerLit(cast(IntegerLit)exp); | |
90 case ExpType.Negate: | |
91 return visitNegateExp(cast(NegateExp)exp); | |
78
ad956143dcdc
Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
92 case ExpType.Deref: |
ad956143dcdc
Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
93 return visitDerefExp(cast(DerefExp)exp); |
1 | 94 case ExpType.AssignExp: |
95 return visitAssignExp(cast(AssignExp)exp); | |
96 case ExpType.CallExp: | |
97 return visitCallExp(cast(CallExp)exp); | |
68
381975d76baf
A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents:
63
diff
changeset
|
98 case ExpType.CastExp: |
381975d76baf
A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents:
63
diff
changeset
|
99 return visitCastExp(cast(CastExp)exp); |
1 | 100 case ExpType.Identifier: |
101 return visitIdentifier(cast(Identifier)exp); | |
77
13eea2c4e60d
Now able of --ast-dump-code with Pointer types and also codeGen int* x;
Anders Johnsen <skabet@gmail.com>
parents:
68
diff
changeset
|
102 case ExpType.PointerIdentifier: |
13eea2c4e60d
Now able of --ast-dump-code with Pointer types and also codeGen int* x;
Anders Johnsen <skabet@gmail.com>
parents:
68
diff
changeset
|
103 return visitPointerIdentifier(cast(PointerIdentifier)exp); |
136 | 104 case ExpType.StaticArrayIdentifier: |
105 return visitStaticArrayIdentifier(cast(StaticArrayIdentifier)exp); | |
106
89db676fbacb
Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents:
102
diff
changeset
|
106 case ExpType.StringExp: |
89db676fbacb
Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents:
102
diff
changeset
|
107 return visitStringExp(cast(StringExp)exp); |
83
9e90694f5da0
Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents:
82
diff
changeset
|
108 case ExpType.Index: |
9e90694f5da0
Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents:
82
diff
changeset
|
109 return visitIndexExp(cast(IndexExp)exp); |
55
79cb0afafabe
Now structs are somewhat useable to use.
Anders Johnsen <skabet@gmail.com>
parents:
46
diff
changeset
|
110 case ExpType.MemberReference: |
79cb0afafabe
Now structs are somewhat useable to use.
Anders Johnsen <skabet@gmail.com>
parents:
46
diff
changeset
|
111 return visitMemberReference(cast(MemberReference)exp); |
158
57b0b4464a0b
Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents:
149
diff
changeset
|
112 case ExpType.NewExp: |
57b0b4464a0b
Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents:
149
diff
changeset
|
113 return visitNewExp(cast(NewExp)exp); |
1 | 114 default: |
115 throw new Exception("Unknown expression type"); | |
116 } | |
117 } | |
118 | |
119 // Declarations: | |
120 DeclT visitVarDecl(VarDecl d) | |
121 { | |
63
9f8131676242
Now Decl's have a DType type(), and should use varType and returnType to get the old type id
Anders Halager <halager@gmail.com>
parents:
55
diff
changeset
|
122 visitExp(d.varType); |
82
06dda301ea61
Can declare outside functions and call c-functions
Anders Johnsen <skabet@gmail.com>
parents:
81
diff
changeset
|
123 if(d.identifier) |
06dda301ea61
Can declare outside functions and call c-functions
Anders Johnsen <skabet@gmail.com>
parents:
81
diff
changeset
|
124 visitExp(d.identifier); |
1 | 125 if (d.init) |
126 visitExp(d.init); | |
127 | |
128 static if (is(DeclT == void)) | |
129 return; | |
130 else | |
131 return DeclT.init; | |
132 } | |
133 | |
99
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
134 DeclT visitImportDecl(ImportDecl d) |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
135 { |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
136 visitIdentifier(d.name); |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
137 visitIdentifier(d.aliasedName); |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
138 foreach (id; d.packages) |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
139 visitIdentifier(id); |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
140 foreach (ids; d.explicitSymbols) |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
141 { |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
142 visitIdentifier(ids[0]); |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
143 visitIdentifier(ids[1]); |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
144 } |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
145 |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
146 static if (is(DeclT == void)) |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
147 return; |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
148 else |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
149 return DeclT.init; |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
150 } |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
151 |
1 | 152 DeclT visitFuncDecl(FuncDecl f) |
153 { | |
63
9f8131676242
Now Decl's have a DType type(), and should use varType and returnType to get the old type id
Anders Halager <halager@gmail.com>
parents:
55
diff
changeset
|
154 visitExp(f.returnType); |
1 | 155 visitExp(f.identifier); |
156 foreach (arg; f.funcArgs) | |
157 visitDecl(arg); | |
158 foreach (stmt; f.statements) | |
159 visitStmt(stmt); | |
160 | |
161 static if (is(DeclT == void)) | |
162 return; | |
163 else | |
164 return DeclT.init; | |
165 } | |
166 | |
22 | 167 DeclT visitStructDecl(StructDecl s) |
168 { | |
169 visitExp(s.identifier); | |
170 | |
102
cd066f3b539a
Parsing methods in structs - error on semantics though.
Anders Johnsen <skabet@gmail.com>
parents:
101
diff
changeset
|
171 foreach (arg; s.decls) |
22 | 172 visitDecl(arg); |
173 | |
174 static if (is(DeclT == void)) | |
175 return; | |
176 else | |
177 return DeclT.init; | |
178 } | |
179 | |
144
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
180 DeclT visitClassDecl(ClassDecl s) |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
181 { |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
182 visitExp(s.identifier); |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
183 |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
184 foreach (arg; s.decls) |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
185 visitDecl(arg); |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
186 |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
187 foreach (arg; s.baseClasses) |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
188 visitExp(arg); |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
189 |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
190 static if (is(DeclT == void)) |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
191 return; |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
192 else |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
193 return DeclT.init; |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
194 } |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
195 |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
196 DeclT visitInterfaceDecl(InterfaceDecl s) |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
197 { |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
198 visitExp(s.identifier); |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
199 |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
200 foreach (arg; s.decls) |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
201 visitDecl(arg); |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
202 |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
203 foreach (arg; s.baseClasses) |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
204 visitExp(arg); |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
205 |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
206 static if (is(DeclT == void)) |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
207 return; |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
208 else |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
209 return DeclT.init; |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
210 } |
6e6355fb5f0f
- Parsing nested attributes.
Anders Johnsen <skabet@gmail.com>
parents:
143
diff
changeset
|
211 |
1 | 212 // Statements: |
213 StmtT visitReturnStmt(ReturnStmt s) | |
214 { | |
37 | 215 if (s.exp) |
216 visitExp(s.exp); | |
1 | 217 static if (is(StmtT == void)) |
218 return; | |
219 else | |
220 return StmtT.init; | |
221 } | |
222 | |
223 StmtT visitDeclStmt(DeclStmt d) | |
224 { | |
225 visitDecl(d.decl); | |
226 static if (is(StmtT == void)) | |
227 return; | |
228 else | |
229 return StmtT.init; | |
230 } | |
231 | |
44
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
37
diff
changeset
|
232 StmtT visitCompoundStmt(CompoundStatement c) |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
37
diff
changeset
|
233 { |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
37
diff
changeset
|
234 foreach (stmt; c.statements) |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
37
diff
changeset
|
235 visitStmt(stmt); |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
37
diff
changeset
|
236 static if (is(StmtT == void)) |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
37
diff
changeset
|
237 return; |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
37
diff
changeset
|
238 else |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
37
diff
changeset
|
239 return StmtT.init; |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
37
diff
changeset
|
240 } |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
37
diff
changeset
|
241 |
5
2c5a8f4c254a
Added very simple if support.
Anders Halager <halager@gmail.com>
parents:
1
diff
changeset
|
242 StmtT visitIfStmt(IfStmt s) |
2c5a8f4c254a
Added very simple if support.
Anders Halager <halager@gmail.com>
parents:
1
diff
changeset
|
243 { |
2c5a8f4c254a
Added very simple if support.
Anders Halager <halager@gmail.com>
parents:
1
diff
changeset
|
244 visitExp(s.cond); |
45 | 245 visitStmt(s.then_body); |
246 if (s.else_body !is null) | |
247 visitStmt(s.else_body); | |
11
642c6a998fd9
Support for while statements and fixed scope for if
Anders Halager <halager@gmail.com>
parents:
5
diff
changeset
|
248 static if (is(StmtT == void)) |
642c6a998fd9
Support for while statements and fixed scope for if
Anders Halager <halager@gmail.com>
parents:
5
diff
changeset
|
249 return; |
642c6a998fd9
Support for while statements and fixed scope for if
Anders Halager <halager@gmail.com>
parents:
5
diff
changeset
|
250 else |
642c6a998fd9
Support for while statements and fixed scope for if
Anders Halager <halager@gmail.com>
parents:
5
diff
changeset
|
251 return StmtT.init; |
642c6a998fd9
Support for while statements and fixed scope for if
Anders Halager <halager@gmail.com>
parents:
5
diff
changeset
|
252 } |
642c6a998fd9
Support for while statements and fixed scope for if
Anders Halager <halager@gmail.com>
parents:
5
diff
changeset
|
253 |
642c6a998fd9
Support for while statements and fixed scope for if
Anders Halager <halager@gmail.com>
parents:
5
diff
changeset
|
254 StmtT visitWhileStmt(WhileStmt s) |
642c6a998fd9
Support for while statements and fixed scope for if
Anders Halager <halager@gmail.com>
parents:
5
diff
changeset
|
255 { |
642c6a998fd9
Support for while statements and fixed scope for if
Anders Halager <halager@gmail.com>
parents:
5
diff
changeset
|
256 visitExp(s.cond); |
46 | 257 visitStmt(s.whileBody); |
5
2c5a8f4c254a
Added very simple if support.
Anders Halager <halager@gmail.com>
parents:
1
diff
changeset
|
258 static if (is(StmtT == void)) |
2c5a8f4c254a
Added very simple if support.
Anders Halager <halager@gmail.com>
parents:
1
diff
changeset
|
259 return; |
2c5a8f4c254a
Added very simple if support.
Anders Halager <halager@gmail.com>
parents:
1
diff
changeset
|
260 else |
2c5a8f4c254a
Added very simple if support.
Anders Halager <halager@gmail.com>
parents:
1
diff
changeset
|
261 return StmtT.init; |
2c5a8f4c254a
Added very simple if support.
Anders Halager <halager@gmail.com>
parents:
1
diff
changeset
|
262 } |
149
393a1f47a6d2
For loops in AST and sema. Should have correct scope and such now.
Anders Johnsen <skabet@gmail.com>
parents:
144
diff
changeset
|
263 |
393a1f47a6d2
For loops in AST and sema. Should have correct scope and such now.
Anders Johnsen <skabet@gmail.com>
parents:
144
diff
changeset
|
264 StmtT visitForStmt(ForStmt s) |
393a1f47a6d2
For loops in AST and sema. Should have correct scope and such now.
Anders Johnsen <skabet@gmail.com>
parents:
144
diff
changeset
|
265 { |
162
0f38f1a0f06f
Fixed symbol for a functions members.
Anders Johnsen <skabet@gmail.com>
parents:
158
diff
changeset
|
266 if(s.init) |
0f38f1a0f06f
Fixed symbol for a functions members.
Anders Johnsen <skabet@gmail.com>
parents:
158
diff
changeset
|
267 visitStmt(s.init); |
0f38f1a0f06f
Fixed symbol for a functions members.
Anders Johnsen <skabet@gmail.com>
parents:
158
diff
changeset
|
268 if(s.cond) |
0f38f1a0f06f
Fixed symbol for a functions members.
Anders Johnsen <skabet@gmail.com>
parents:
158
diff
changeset
|
269 visitExp(s.cond); |
0f38f1a0f06f
Fixed symbol for a functions members.
Anders Johnsen <skabet@gmail.com>
parents:
158
diff
changeset
|
270 if(s.incre) |
0f38f1a0f06f
Fixed symbol for a functions members.
Anders Johnsen <skabet@gmail.com>
parents:
158
diff
changeset
|
271 visitExp(s.incre); |
149
393a1f47a6d2
For loops in AST and sema. Should have correct scope and such now.
Anders Johnsen <skabet@gmail.com>
parents:
144
diff
changeset
|
272 visitStmt(s.forBody); |
393a1f47a6d2
For loops in AST and sema. Should have correct scope and such now.
Anders Johnsen <skabet@gmail.com>
parents:
144
diff
changeset
|
273 static if (is(StmtT == void)) |
393a1f47a6d2
For loops in AST and sema. Should have correct scope and such now.
Anders Johnsen <skabet@gmail.com>
parents:
144
diff
changeset
|
274 return; |
393a1f47a6d2
For loops in AST and sema. Should have correct scope and such now.
Anders Johnsen <skabet@gmail.com>
parents:
144
diff
changeset
|
275 else |
393a1f47a6d2
For loops in AST and sema. Should have correct scope and such now.
Anders Johnsen <skabet@gmail.com>
parents:
144
diff
changeset
|
276 return StmtT.init; |
393a1f47a6d2
For loops in AST and sema. Should have correct scope and such now.
Anders Johnsen <skabet@gmail.com>
parents:
144
diff
changeset
|
277 } |
5
2c5a8f4c254a
Added very simple if support.
Anders Halager <halager@gmail.com>
parents:
1
diff
changeset
|
278 |
36
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
28
diff
changeset
|
279 StmtT visitSwitchStmt(SwitchStmt s) |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
28
diff
changeset
|
280 { |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
28
diff
changeset
|
281 visitExp(s.cond); |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
28
diff
changeset
|
282 foreach(stmt; s.defaultBlock) |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
28
diff
changeset
|
283 visitStmt(stmt); |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
28
diff
changeset
|
284 foreach (c; s.cases) |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
28
diff
changeset
|
285 { |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
28
diff
changeset
|
286 foreach(lit; c.values) |
143
d76cc5cad4fc
Added partial support for switches.
Anders Johnsen <skabet@gmail.com>
parents:
136
diff
changeset
|
287 visitExp(lit); |
36
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
28
diff
changeset
|
288 foreach(stmt; c.stmts) |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
28
diff
changeset
|
289 visitStmt(stmt); |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
28
diff
changeset
|
290 } |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
28
diff
changeset
|
291 static if (is(StmtT == void)) |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
28
diff
changeset
|
292 return; |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
28
diff
changeset
|
293 else |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
28
diff
changeset
|
294 return StmtT.init; |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
28
diff
changeset
|
295 } |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
28
diff
changeset
|
296 |
1 | 297 StmtT visitExpStmt(ExpStmt s) |
298 { | |
299 visitExp(s.exp); | |
300 static if (is(StmtT == void)) | |
301 return; | |
302 else | |
303 return StmtT.init; | |
304 } | |
305 | |
306 // Expressions: | |
307 ExpT visitAssignExp(AssignExp exp) | |
308 { | |
309 visitExp(exp.identifier); | |
310 visitExp(exp.exp); | |
311 static if (is(ExpT == void)) | |
312 return; | |
313 else | |
314 return ExpT.init; | |
315 } | |
316 | |
317 ExpT visitBinaryExp(BinaryExp exp) | |
318 { | |
319 visitExp(exp.left); | |
320 visitExp(exp.right); | |
321 static if (is(ExpT == void)) | |
322 return; | |
323 else | |
324 return ExpT.init; | |
325 } | |
326 | |
327 ExpT visitCallExp(CallExp exp) | |
328 { | |
329 visitExp(exp.exp); | |
330 foreach (arg; exp.args) | |
331 visitExp(arg); | |
332 static if (is(ExpT == void)) | |
333 return; | |
334 else | |
335 return ExpT.init; | |
336 } | |
337 | |
68
381975d76baf
A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents:
63
diff
changeset
|
338 ExpT visitCastExp(CastExp exp) |
381975d76baf
A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents:
63
diff
changeset
|
339 { |
381975d76baf
A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents:
63
diff
changeset
|
340 visitExp(exp.castType); |
381975d76baf
A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents:
63
diff
changeset
|
341 visitExp(exp.exp); |
381975d76baf
A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents:
63
diff
changeset
|
342 static if (is(ExpT == void)) |
381975d76baf
A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents:
63
diff
changeset
|
343 return; |
381975d76baf
A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents:
63
diff
changeset
|
344 else |
381975d76baf
A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents:
63
diff
changeset
|
345 return ExpT.init; |
381975d76baf
A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents:
63
diff
changeset
|
346 } |
381975d76baf
A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents:
63
diff
changeset
|
347 |
1 | 348 ExpT visitNegateExp(NegateExp exp) |
349 { | |
350 visitExp(exp.exp); | |
351 static if (is(ExpT == void)) | |
352 return; | |
353 else | |
354 return ExpT.init; | |
355 } | |
356 | |
78
ad956143dcdc
Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
357 ExpT visitDerefExp(DerefExp exp) |
ad956143dcdc
Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
358 { |
ad956143dcdc
Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
359 visitExp(exp.exp); |
ad956143dcdc
Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
360 static if (is(ExpT == void)) |
ad956143dcdc
Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
361 return; |
ad956143dcdc
Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
362 else |
ad956143dcdc
Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
363 return ExpT.init; |
ad956143dcdc
Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
364 } |
ad956143dcdc
Parse and gen for dereferences
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
365 |
1 | 366 ExpT visitIntegerLit(IntegerLit exp) |
367 { | |
368 static if (is(ExpT == void)) | |
369 return; | |
370 else | |
371 return ExpT.init; | |
372 } | |
373 | |
106
89db676fbacb
Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents:
102
diff
changeset
|
374 ExpT visitStringExp(StringExp exp) |
89db676fbacb
Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents:
102
diff
changeset
|
375 { |
89db676fbacb
Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents:
102
diff
changeset
|
376 static if (is(ExpT == void)) |
89db676fbacb
Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents:
102
diff
changeset
|
377 return; |
89db676fbacb
Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents:
102
diff
changeset
|
378 else |
89db676fbacb
Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents:
102
diff
changeset
|
379 return ExpT.init; |
89db676fbacb
Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents:
102
diff
changeset
|
380 } |
89db676fbacb
Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents:
102
diff
changeset
|
381 |
1 | 382 ExpT visitIdentifier(Identifier exp) |
383 { | |
384 static if (is(ExpT == void)) | |
385 return; | |
386 else | |
387 return ExpT.init; | |
388 } | |
28
69464d465284
Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
389 |
77
13eea2c4e60d
Now able of --ast-dump-code with Pointer types and also codeGen int* x;
Anders Johnsen <skabet@gmail.com>
parents:
68
diff
changeset
|
390 ExpT visitPointerIdentifier(PointerIdentifier exp) |
13eea2c4e60d
Now able of --ast-dump-code with Pointer types and also codeGen int* x;
Anders Johnsen <skabet@gmail.com>
parents:
68
diff
changeset
|
391 { |
13eea2c4e60d
Now able of --ast-dump-code with Pointer types and also codeGen int* x;
Anders Johnsen <skabet@gmail.com>
parents:
68
diff
changeset
|
392 visitExp(exp.pointerOf); |
13eea2c4e60d
Now able of --ast-dump-code with Pointer types and also codeGen int* x;
Anders Johnsen <skabet@gmail.com>
parents:
68
diff
changeset
|
393 |
13eea2c4e60d
Now able of --ast-dump-code with Pointer types and also codeGen int* x;
Anders Johnsen <skabet@gmail.com>
parents:
68
diff
changeset
|
394 static if (is(ExpT == void)) |
13eea2c4e60d
Now able of --ast-dump-code with Pointer types and also codeGen int* x;
Anders Johnsen <skabet@gmail.com>
parents:
68
diff
changeset
|
395 return; |
13eea2c4e60d
Now able of --ast-dump-code with Pointer types and also codeGen int* x;
Anders Johnsen <skabet@gmail.com>
parents:
68
diff
changeset
|
396 else |
13eea2c4e60d
Now able of --ast-dump-code with Pointer types and also codeGen int* x;
Anders Johnsen <skabet@gmail.com>
parents:
68
diff
changeset
|
397 return ExpT.init; |
13eea2c4e60d
Now able of --ast-dump-code with Pointer types and also codeGen int* x;
Anders Johnsen <skabet@gmail.com>
parents:
68
diff
changeset
|
398 } |
13eea2c4e60d
Now able of --ast-dump-code with Pointer types and also codeGen int* x;
Anders Johnsen <skabet@gmail.com>
parents:
68
diff
changeset
|
399 |
136 | 400 ExpT visitStaticArrayIdentifier(StaticArrayIdentifier exp) |
81 | 401 { |
402 visitExp(exp.arrayOf); | |
403 | |
404 static if (is(ExpT == void)) | |
405 return; | |
406 else | |
407 return ExpT.init; | |
408 } | |
409 | |
83
9e90694f5da0
Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents:
82
diff
changeset
|
410 ExpT visitIndexExp(IndexExp exp) |
9e90694f5da0
Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents:
82
diff
changeset
|
411 { |
9e90694f5da0
Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents:
82
diff
changeset
|
412 visitExp(exp.target); |
9e90694f5da0
Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents:
82
diff
changeset
|
413 visitExp(exp.index); |
9e90694f5da0
Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents:
82
diff
changeset
|
414 |
9e90694f5da0
Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents:
82
diff
changeset
|
415 static if (is(ExpT == void)) |
9e90694f5da0
Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents:
82
diff
changeset
|
416 return; |
9e90694f5da0
Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents:
82
diff
changeset
|
417 else |
9e90694f5da0
Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents:
82
diff
changeset
|
418 return ExpT.init; |
9e90694f5da0
Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents:
82
diff
changeset
|
419 } |
9e90694f5da0
Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents:
82
diff
changeset
|
420 |
55
79cb0afafabe
Now structs are somewhat useable to use.
Anders Johnsen <skabet@gmail.com>
parents:
46
diff
changeset
|
421 ExpT visitMemberReference(MemberReference mem) |
28
69464d465284
Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
422 { |
69464d465284
Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
423 visitExp(mem.target); |
69464d465284
Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
424 visitExp(mem.child); |
69464d465284
Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
425 |
69464d465284
Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
426 static if (is(ExpT == void)) |
69464d465284
Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
427 return; |
69464d465284
Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
428 else |
69464d465284
Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
429 return ExpT.init; |
69464d465284
Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
430 } |
158
57b0b4464a0b
Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents:
149
diff
changeset
|
431 |
57b0b4464a0b
Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents:
149
diff
changeset
|
432 ExpT visitNewExp(NewExp n) |
57b0b4464a0b
Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents:
149
diff
changeset
|
433 { |
57b0b4464a0b
Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents:
149
diff
changeset
|
434 visitExp(n.newType); |
57b0b4464a0b
Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents:
149
diff
changeset
|
435 |
57b0b4464a0b
Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents:
149
diff
changeset
|
436 foreach( a ; n.a_args ) |
57b0b4464a0b
Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents:
149
diff
changeset
|
437 visitExp(a); |
57b0b4464a0b
Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents:
149
diff
changeset
|
438 |
57b0b4464a0b
Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents:
149
diff
changeset
|
439 foreach( c ; n.c_args ) |
57b0b4464a0b
Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents:
149
diff
changeset
|
440 visitExp(c); |
57b0b4464a0b
Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents:
149
diff
changeset
|
441 |
57b0b4464a0b
Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents:
149
diff
changeset
|
442 static if (is(ExpT == void)) |
57b0b4464a0b
Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents:
149
diff
changeset
|
443 return; |
57b0b4464a0b
Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents:
149
diff
changeset
|
444 else |
57b0b4464a0b
Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents:
149
diff
changeset
|
445 return ExpT.init; |
57b0b4464a0b
Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
Anders Johnsen <skabet@gmail.com>
parents:
149
diff
changeset
|
446 } |
1 | 447 } |
448 |