Package: WitnessAnnotation

WitnessAnnotation

nameinstructionbranchcomplexitylinemethod
WitnessAnnotation()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
doInit(Object[])
M: 30 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 8 C: 0
0%
M: 1 C: 0
0%
inAfter(PExp, Value, Context)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
inAfter(PStm, Value, Context)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
inBefore(PExp, Context)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
inBefore(PStm, Context)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
typecheckArgs()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: *
3: *        Copyright (c) 2019 Nick Battle.
4: *
5: *        Author: Nick Battle
6: *
7: *        This file is part of Overture.
8: *
9: ******************************************************************************/
10:
11: package org.overture.annotations.examples;
12:
13: import org.overture.ast.analysis.AnalysisException;
14: import org.overture.ast.expressions.PExp;
15: import org.overture.ast.statements.PStm;
16: import org.overture.interpreter.annotations.INAnnotation;
17: import org.overture.interpreter.eval.ExpressionEvaluator;
18: import org.overture.interpreter.runtime.Context;
19: import org.overture.interpreter.values.Value;
20: import org.overture.parser.annotations.ASTAnnotationAdapter;
21:
22: /**
23: * A test of an annotation with an instance init function.
24: */
25: public class WitnessAnnotation extends ASTAnnotationAdapter implements INAnnotation
26: {
27:         public WitnessAnnotation()
28:         {
29:                 super();
30:         }
31:         
32:         public boolean typecheckArgs()
33:         {
34:                 return true;
35:         }
36:         
37:         protected void doInit(Object[] args)
38:         {
39:                 Context ctxt = (Context)args[0];
40:                 ExpressionEvaluator eval = new ExpressionEvaluator();
41:
42:•                for (PExp arg: ast.getArgs())
43:                 {
44:                         try
45:                         {
46:                                 arg.apply(eval, ctxt);
47:                         }
48:                         catch (AnalysisException e)
49:                         {
50:                                 // Ignore
51:                         }
52:                 }
53:         }
54:
55:         @Override
56:         public void inBefore(PStm node, Context ctxt) throws AnalysisException
57:         {
58:         }
59:
60:         @Override
61:         public void inBefore(PExp node, Context ctxt) throws AnalysisException
62:         {
63:         }
64:
65:         @Override
66:         public void inAfter(PStm node, Value value, Context ctxt) throws AnalysisException
67:         {
68:         }
69:
70:         @Override
71:         public void inAfter(PExp node, Value value, Context ctxt) throws AnalysisException
72:         {
73:         }
74: }