X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Felaboration%2Fexpressions%2FEMatch.java;h=0ca1d54427d13a636ca11eca672ea330dd688cef;hp=4ad8135c43803367f9584fe3e3158a45f92d106a;hb=a9f88c57e622d9ecf2732bd0278e0989dc0dfd5a;hpb=2f63e7a58e49a233b28c6968b848281060117c43 diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EMatch.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EMatch.java index 4ad8135c4..0ca1d5442 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EMatch.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EMatch.java @@ -41,43 +41,36 @@ public class EMatch extends Expression { this.cases = cases; } - public void collectRefs(TObjectIntHashMap allRefs, TIntHashSet refs) { + @Override + public void collectVars(TObjectIntHashMap allVars, + TIntHashSet vars) { for(Expression s : scrutinee) - s.collectRefs(allRefs, refs); - for(Case case_ : cases) - case_.collectRefs(allRefs, refs); - } - - @Override - public void collectVars(TObjectIntHashMap allVars, - TIntHashSet vars) { - for(Expression s : scrutinee) s.collectVars(allVars, vars); - for(Case case_ : cases) + for(Case case_ : cases) case_.collectVars(allVars, vars); - } - - @Override - protected void updateType() { - setType(cases[0].value.getType()); - } + } + + @Override + protected void updateType() { + setType(cases[0].value.getType()); + } + + @Override + public IVal toVal(CompilationContext context, CodeWriter w) { + ArrayList rows = new ArrayList(cases.length); + for(Case case_ : cases) + rows.add(new Row(case_.patterns, case_.value)); + + IVal[] scrutineeVals = new IVal[scrutinee.length]; + for(int i=0;i rows = new ArrayList(cases.length); - for(Case case_ : cases) - rows.add(new Row(case_.patterns, case_.value)); - - IVal[] scrutineeVals = new IVal[scrutinee.length]; - for(int i=0;i