From: adam Date: Mon, 3 Nov 2008 10:08:00 +0000 (+0100) Subject: add error check to Context.makeNext() X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=d96b6af8149ac5be2cbf57a0a9e41176221f0e03;p=fleet.git add error check to Context.makeNext() --- diff --git a/src/edu/berkeley/fleet/ir/Context.java b/src/edu/berkeley/fleet/ir/Context.java index 844851c..436b49a 100644 --- a/src/edu/berkeley/fleet/ir/Context.java +++ b/src/edu/berkeley/fleet/ir/Context.java @@ -97,6 +97,11 @@ public class Context { } } + public LoopFactory makeNext(int new_count) { return makeNext(new_count, null); } + public LoopFactory makeNext(int new_count, String newFriendlyName) { + if (next != null) throw new RuntimeException("loop already has a successor"); + return new LoopFactory(dock, new_count, newFriendlyName, this); + } public LoopFactory getNext() { return next; } private void setNext(LoopFactory next) { if (this.next != null) throw new RuntimeException("attempt to setNext() twice");