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%2Finternal%2Fderiving%2FShowDeriver.java;fp=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Finternal%2Fderiving%2FShowDeriver.java;h=40c3605e779dc86ac402a4fb80016e3d8298ddff;hp=afd2a4f8943dfe3d5aa711a611ac3a6827f7eae1;hb=fa8e4e5734e954942988f0c66eaa7ca7e823c33f;hpb=309b4b814a1375c2e2bd67bdee77d62bc9abf073 diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/deriving/ShowDeriver.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/deriving/ShowDeriver.java index afd2a4f89..40c3605e7 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/deriving/ShowDeriver.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/deriving/ShowDeriver.java @@ -81,33 +81,55 @@ class ShowDeriver implements InstanceDeriver { for(int i=0;iemptyList()));*/ + } catch (NotPatternException e) { + errorLog.log(e.getExpression().location, "Not a pattern."); + } } - - try { - DValueAst valueAst = new DValueAst(lhs, value); - valueAst.setLocationDeep(der.location); - valueDefs.add(valueAst); - /*valueDefs.addAnnotation("<+", new DAnnotationAst(new EVar("@private"), - Collections.emptyList()));*/ - } catch (NotPatternException e) { - errorLog.log(e.getExpression().location, "Not a pattern."); + + // precedence + { + Expression lhs = new EApply( + new EVar("precedence"), + new EApply(new EVar(constructor.name.name), Expressions.vars(par)) + ); + Expression value; + value = new ELiteral(new IntegerConstant(l == 0 ? 0 : 20)); + + try { + DValueAst valueAst = new DValueAst(lhs, value); + valueAst.setLocationDeep(der.location); + valueDefs.add(valueAst); + } catch (NotPatternException e) { + errorLog.log(e.getExpression().location, "Not a pattern."); + } } } instancesAst.add(new ProcessedDInstanceAst(instanceAst, valueDefs));