Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/ir/inodes.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/ir/inodes.dart b/sdk/lib/_internal/compiler/implementation/ir/inodes.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..750bdbcb33c43a1b09889bf220a895088d7fc175 |
| --- /dev/null |
| +++ b/sdk/lib/_internal/compiler/implementation/ir/inodes.dart |
| @@ -0,0 +1,39 @@ |
| +part of ir; |
| + |
| +class Position { |
| + 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!
|
| + int offset; |
| + Position(this.sourceFile, this.offset); |
| +} |
| + |
| +abstract class INode { |
| + Position pos; |
| + INode(this.pos); |
| +} |
| + |
| +class NoValue extends INode { |
| + 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.
|
| + factory NoValue() { |
| + if (_instance == null) _instance = new NoValue.internal(); |
| + return _instance; |
| + } |
| + NoValue.internal() : super(new Position(null, 0)); |
| +} |
| + |
| +class IFunction extends INode { |
| + List<INode> statements; |
| + IFunction(Position pos, this.statements) : super(pos); |
| + |
| + bool hasBody() => statements.isNotEmpty; |
| +} |
| + |
| +class IReturn extends INode { |
| + IFunction function; |
| + INode value; |
| + IReturn(Position pos, this.function, this.value) : super(pos); |
| +} |
| + |
| +class IConstant extends INode { |
| + Constant value; |
|
ngeoffray
2013/11/05 12:58:35
final?
lukas
2013/11/05 17:10:50
Done.
|
| + IConstant(Position pos, this.value) : super(pos); |
| +} |