public boolean isOmit() { ITTCN3Template templateBody = templateInst.getTemplateBody(); switch (templateBody.getTemplatetype()) { case OMIT_VALUE: return true; case SPECIFIC_VALUE: return (((SpecificValue_Template) templateBody).getSpecificValue().getValuetype() == IValue.Value_type.OMIT_VALUE); default: return false; } }
public void check(final CompilationTimeStamp timestamp, final Scope scope) { templateInst.setMyScope(scope); if (isOmit()) { // special case, no type needed if (indicator == Indicator_Type.Before_Indicator || indicator == Indicator_Type.After_Indicator) { if (!hasAllKeyword) { final String message = MessageFormat.format( "Keyword `all'' is expected after `omit'' when omitting all fields {0} the specified field", indicator.getDisplayName()); templateInst.getLocation().reportSemanticError(message); } } else { if (hasAllKeyword) { templateInst .getLocation() .reportSemanticError("Unexpected `all' keyword after `omit' when omitting one field"); } } type = null; return; } if (hasAllKeyword) { templateInst .getLocation() .reportSemanticError("Unexpected `all' keyword after the in-line template"); } // determine the type of the tmpl_inst type = templateInst.getExpressionGovernor(timestamp, Expected_Value_type.EXPECTED_TEMPLATE); if (type == null) { templateInst.getTemplateBody().setLoweridToReference(timestamp); type = templateInst.getExpressionGovernor(timestamp, Expected_Value_type.EXPECTED_TEMPLATE); } if (type == null) { templateInst .getLocation() .reportSemanticError("Cannot determine the type of the in-line template"); return; } type.check(timestamp); IType typeLast = type.getTypeRefdLast(timestamp); if (typeLast == null || typeLast.getIsErroneous(timestamp)) { type = null; return; } if (isRaw) { switch (typeLast.getTypetypeTtcn3()) { case TYPE_BITSTRING: case TYPE_OCTETSTRING: case TYPE_CHARSTRING: case TYPE_UCHARSTRING: break; default: templateInst .getLocation() .reportSemanticError( MessageFormat.format( "An in-line template of type `{0}'' cannot be used as a `raw'' erroneous value", typeLast.getTypename())); } } if (templateInst.getDerivedReference() != null) { templateInst .getLocation() .reportSemanticError( "Reference to a constant value was expected instead of an in-line modified template"); type = null; return; } ITTCN3Template templ = templateInst.getTemplateBody(); if (templ.isValue(timestamp)) { value = templ.getValue(); value.setMyGovernor(type); type.checkThisValueRef(timestamp, value); type.checkThisValue( timestamp, value, new ValueCheckingOptions( Expected_Value_type.EXPECTED_CONSTANT, false, false, true, false, false)); } else { templateInst .getLocation() .reportSemanticError("A specific value without matching symbols was expected"); type = null; return; } }