X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Felaboration%2Fexpressions%2FEBlock.java;h=e184b1397938e5604e91e90edaefd3699839c88d;hb=d9a283acefae11c2cc094ed1c7b74759f8166f17;hp=a509616bbb4bf669e08e1ece55584d58355309a3;hpb=1ec0193a5a5b8f368b03adb24acd762838ddf8ea;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EBlock.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EBlock.java index a509616bb..e184b1397 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EBlock.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EBlock.java @@ -3,7 +3,7 @@ package org.simantics.scl.compiler.elaboration.expressions; import java.util.ArrayList; import java.util.List; -import org.simantics.scl.compiler.common.exceptions.InternalCompilerError; +import org.simantics.scl.compiler.elaboration.chr.CHRRule; import org.simantics.scl.compiler.elaboration.chr.CHRRuleset; import org.simantics.scl.compiler.elaboration.chr.translation.CHRTranslation; import org.simantics.scl.compiler.elaboration.contexts.TranslationContext; @@ -47,8 +47,10 @@ public class EBlock extends ASTExpression { @Override public Expression resolve(TranslationContext context) { - if(statements.isEmpty()) - throw new InternalCompilerError(); + if(statements.isEmpty()) { + context.getErrorLog().log(location, "Block should not be empty."); + return new EError(location); + } int i = statements.size()-1; Statement last = statements.get(i); if(!(last instanceof GuardStatement)) { @@ -91,8 +93,10 @@ public class EBlock extends ASTExpression { ruleset.location = Locations.combine(statements.get(begin).location, statements.get(end-1).location); for(int i=begin;i