Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Unified Diff: sdk/lib/_internal/compiler/implementation/ir/inodes.dart

Issue 57873002: Build new IR for functions returning a constant (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
+}

Powered by Google App Engine
This is Rietveld 408576698