Commit cda94372 authored by Miklos Magyari's avatar Miklos Magyari
Browse files

OOP: report uninitialized constants


Signed-off-by: Miklos Magyari's avatarMiklos Magyari <miklos.magyari@sigmatechnology.se>
parent c13deae6
......@@ -51,8 +51,11 @@ type class BaseFunctionClass {
}
}
const integer cg_uninitConst1;
type class SubFunctionClass extends BaseFunctionClass {
private const integer m_const := 1;
private const integer m_uninitConst2;
public function f_get_one() return integer { // FIXME : incomplete marker
return m_const;
}
......
......@@ -220,6 +220,9 @@ public final class Def_Const extends Definition {
}
if (value == null) {
if (! (getNameParent() instanceof ClassTypeBody)) {
location.reportSemanticError("Constant must be initialized");
}
return;
}
......
......@@ -41,12 +41,14 @@ public class OOP_Semantic_tests {
private ArrayList<MarkerToCheck> oopNegative_ttcn_initializer() {
//oopNegativeSemanticTest.ttcn
ArrayList<MarkerToCheck> markersToCheck = new ArrayList<MarkerToCheck>(5);
ArrayList<MarkerToCheck> markersToCheck = new ArrayList<MarkerToCheck>(6);
int lineNum = 28;
markersToCheck.add(new MarkerToCheck("class type expected", lineNum, IMarker.SEVERITY_ERROR));
lineNum += 17;
markersToCheck.add(new MarkerToCheck("Local Definiton `vl_b' collides with definition inherited from class type `@classesNegativeSemantic.SubClass'", lineNum, IMarker.SEVERITY_ERROR));
lineNum += 11;
lineNum += 9;
markersToCheck.add(new MarkerToCheck("Constant must be initialized", lineNum, IMarker.SEVERITY_ERROR));
lineNum += 5;
markersToCheck.add(new MarkerToCheck("Local Definiton `f_get_one' collides with definition inherited from class type `'", lineNum, IMarker.SEVERITY_ERROR));
lineNum += 12;
markersToCheck.add(new MarkerToCheck("There is no visible definition with name `vl_gsc' in module `classesNegativeSemantic'", lineNum, IMarker.SEVERITY_ERROR));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment