Commit 1130f87b authored by Kristof Szabados's avatar Kristof Szabados
Browse files

premature declaration.


Signed-off-by: Kristof Szabados's avatarKristof Szabados <Kristof.Szabados@ericsson.com>
parent 023da2e4
......@@ -39,7 +39,6 @@ public class RunsOnScopeReduction extends BaseModuleCodeSmellSpotter{
@Override
protected void process(final IVisitableNode node, final Problems problems) {
final Set<Identifier> definitions = new HashSet<Identifier>();
final Identifier componentIdentifier;
final CompilationTimeStamp timestamp = CompilationTimeStamp.getBaseTimestamp();
final Identifier identifier;
......@@ -77,6 +76,8 @@ public class RunsOnScopeReduction extends BaseModuleCodeSmellSpotter{
final ReferenceCheck chek = new ReferenceCheck();
node.accept(chek);
final Set<Identifier> definitions = new HashSet<Identifier>();
definitions.addAll(chek.getIdentifiers());
if (definitions.isEmpty()) {
......
......@@ -78,7 +78,6 @@ public class SelectUnion extends BaseModuleCodeSmellSpotter {
}
// Check the union, get the types.
final UnionItemVisitor unionVisitor = new UnionItemVisitor();
final List<Identifier> foundIds = new ArrayList<Identifier>();
for(final Reference ref : caseVisitor.getReferenceList()){
final List<ISubReference> reflist = ref.getSubreferences();
......@@ -93,6 +92,8 @@ public class SelectUnion extends BaseModuleCodeSmellSpotter {
if(caseVisitor.getUnionType() == null){
return;
}
final UnionItemVisitor unionVisitor = new UnionItemVisitor();
caseVisitor.getUnionType().accept(unionVisitor);
// Check if the found types are the same as the union types.
......
......@@ -37,9 +37,6 @@ public class UnusedStartedFuncRetVal extends BaseModuleCodeSmellSpotter {
if (node instanceof Start_Component_Statement) {
final CompilationTimeStamp timestamp = CompilationTimeStamp.getBaseTimestamp();
final Start_Component_Statement s = (Start_Component_Statement) node;
final IType compType = Port_Utility.checkComponentReference(timestamp, s, s.getComponent(), false, false, false);
final Assignment assignment = s.getFunctionInstanceReference().getRefdAssignment(timestamp, false);
if (assignment == null) {
return;
......@@ -56,7 +53,7 @@ public class UnusedStartedFuncRetVal extends BaseModuleCodeSmellSpotter {
final Def_Function function = (Def_Function) assignment;
final IType runsOnType = function.getRunsOnType(timestamp);
final IType compType = Port_Utility.checkComponentReference(timestamp, s, s.getComponent(), false, false, false);
if (compType == null || runsOnType == null || !function.isStartable()) {
return;
}
......
......@@ -37,7 +37,6 @@ public class UnusedStartedRefFuncRetVal extends BaseModuleCodeSmellSpotter {
@Override
public void process(final IVisitableNode node, final Problems problems) {
if (node instanceof Start_Referenced_Component_Statement) {
final CompilationTimeStamp timestamp = CompilationTimeStamp.getBaseTimestamp();
final Start_Referenced_Component_Statement s = (Start_Referenced_Component_Statement) node;
final Value dereferredValue = s.getDereferredValue();
......@@ -58,6 +57,7 @@ public class UnusedStartedRefFuncRetVal extends BaseModuleCodeSmellSpotter {
break;
}
final CompilationTimeStamp timestamp = CompilationTimeStamp.getBaseTimestamp();
IType type = dereferredValue.getExpressionGovernor(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE);
if (type != null) {
type = type.getTypeRefdLast(timestamp);
......
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