OLD | NEW |
---|---|
(Empty) | |
1 part of ir; | |
2 | |
3 class Position { | |
4 SourceFile sourceFile; | |
ngeoffray
2013/11/05 12:58:35
Probably not something we want to put on each inst
lukas
2013/11/05 17:10:50
True!
| |
5 int offset; | |
6 Position(this.sourceFile, this.offset); | |
7 } | |
8 | |
9 abstract class INode { | |
10 Position pos; | |
11 INode(this.pos); | |
12 } | |
13 | |
14 class NoValue extends INode { | |
15 static NoValue _instance; | |
ngeoffray
2013/11/05 12:58:35
How about a const constructor?
lukas
2013/11/05 17:10:50
Yes, much better.
| |
16 factory NoValue() { | |
17 if (_instance == null) _instance = new NoValue.internal(); | |
18 return _instance; | |
19 } | |
20 NoValue.internal() : super(new Position(null, 0)); | |
21 } | |
22 | |
23 class IFunction extends INode { | |
24 List<INode> statements; | |
25 IFunction(Position pos, this.statements) : super(pos); | |
26 | |
27 bool hasBody() => statements.isNotEmpty; | |
28 } | |
29 | |
30 class IReturn extends INode { | |
31 IFunction function; | |
32 INode value; | |
33 IReturn(Position pos, this.function, this.value) : super(pos); | |
34 } | |
35 | |
36 class IConstant extends INode { | |
37 Constant value; | |
ngeoffray
2013/11/05 12:58:35
final?
lukas
2013/11/05 17:10:50
Done.
| |
38 IConstant(Position pos, this.value) : super(pos); | |
39 } | |
OLD | NEW |