use of org.eclipse.titan.designer.AST.TTCN3.values.expressions.MatchExpression in project titan.EclipsePlug-ins by eclipse.
the class LogArgument method checkValue.
/**
* Does the semantic checking of the log argument. Once it was
* determined that it is a value.
*
* @param timestamp
* the timestamp of the actual semantic check cycle.
* @param value
* the value contained in the log argument.
*/
private void checkValue(final CompilationTimeStamp timestamp, final IValue value) {
final IValue temp = value.setLoweridToReference(timestamp);
switch(temp.getValuetype()) {
case CHARSTRING_VALUE:
internalLogArgument = new String_InternalLogArgument(((Charstring_Value) temp).getValue());
break;
case REFERENCED_VALUE:
final Reference reference = ((Referenced_Value) temp).getReference();
internalLogArgument = new Reference_InternalLogArgument(reference);
checkReference(timestamp, reference);
return;
case EXPRESSION_VALUE:
final Expression_Value castedValue = (Expression_Value) temp;
if (Operation_type.MATCH_OPERATION.equals(castedValue.getOperationType())) {
internalLogArgument = new Match_InternalLogArgument((MatchExpression) castedValue);
} else {
internalLogArgument = new Value_InternalLogArgument(temp);
}
break;
case MACRO_VALUE:
internalLogArgument = new Macro_InternalLogArgument((Macro_Value) temp);
break;
default:
internalLogArgument = new Value_InternalLogArgument(temp);
break;
}
final IType governor = temp.getExpressionGovernor(timestamp, Expected_Value_type.EXPECTED_TEMPLATE);
if (governor == null) {
getLocation().reportSemanticError("Cannot determine the type of the argument");
isErroneous = true;
return;
}
// TODO: Is the next part necessary ???
temp.setMyGovernor(governor);
// TODO:WHY
governor.checkThisValue(timestamp, temp, null, new ValueCheckingOptions(Expected_Value_type.EXPECTED_TEMPLATE, true, true, true, true, false));
final IReferenceChain chain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
if (ArgumentType.Value.equals(internalLogArgument.getArgumentType()) && !temp.isUnfoldable(timestamp)) {
final IValue last = temp.getValueRefdLast(timestamp, chain);
if (Value_type.CHARSTRING_VALUE.equals(last.getValuetype())) {
internalLogArgument = new String_InternalLogArgument(((Charstring_Value) last).getValue());
}
} else if (ArgumentType.Macro.equals(internalLogArgument.getArgumentType())) {
final IValue last = temp.getValueRefdLast(timestamp, chain);
switch(last.getValuetype()) {
case CHARSTRING_VALUE:
internalLogArgument = new String_InternalLogArgument(((Charstring_Value) last).getValue());
break;
case MACRO_VALUE:
break;
default:
internalLogArgument = new Value_InternalLogArgument(temp);
break;
}
}
chain.release();
}
Aggregations