Loading de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/validation/CodeStyleValidator.xtend +38 −2 Original line number Diff line number Diff line Loading @@ -90,6 +90,9 @@ import static extension org.eclipse.emf.ecore.util.EcoreUtil.* import static extension org.eclipse.xtext.EcoreUtil2.* import org.eclipse.xtext.EcoreUtil2.ElementReferenceAcceptor import org.eclipse.emf.ecore.EReference import de.ugoe.cs.swe.tTCN3.StructFieldDef import de.ugoe.cs.swe.tTCN3.OpCall import de.ugoe.cs.swe.tTCN3.UnionFieldDef class CheckDefinitionComeFirstParameter { public boolean hasOtherDefinitions Loading Loading @@ -886,6 +889,7 @@ class CodeStyleValidator extends AbstractDeclarativeValidator { return } //TODO: overly specific.. //TODO: overly complicated -> simplify and reduce/invert conditions var target = "" val expr = templateOp.template.template.simple.expr // .ref.head Loading @@ -897,14 +901,46 @@ class CodeStyleValidator extends AbstractDeclarativeValidator { if (expr.ref.referencedValue instanceof FormalTemplatePar) { return } if (expr.ref.referencedValue instanceof BaseTemplate) { return } //TODO: add modulepar handling once BNF has been updated if (expr.ref.referencedValue instanceof StructFieldDef || expr.ref.referencedValue instanceof UnionFieldDef ) { if (expr.ref.head.target instanceof SingleTempVarInstance || expr.ref.head.target instanceof FormalTemplatePar ) { return } } target = expr.ref.referencedValue.name //TODO: other conditions? } else { //TODO: check further? //TODO: check further? e.g. predefined values? return } } else if (expr instanceof OpCall) { if (expr.function !== null) { if (expr.function.ref instanceof FunctionDef) { var returnType = (expr.function.ref as FunctionDef).returnType if (returnType.template !== null) { return } if (returnType.restricted !== null) { return } //TODO: add field or revert to template above? target = expr.function.ref.name } else if (expr.function.ref instanceof BaseTemplate) { return } //TODO: handle altsteps and others? } } else { //TODO: check further? e.g. function return types? //TODO: check further? return } statistics.incrementCountStyle Loading Loading
de.ugoe.cs.swe.TTCN3/src/de/ugoe/cs/swe/validation/CodeStyleValidator.xtend +38 −2 Original line number Diff line number Diff line Loading @@ -90,6 +90,9 @@ import static extension org.eclipse.emf.ecore.util.EcoreUtil.* import static extension org.eclipse.xtext.EcoreUtil2.* import org.eclipse.xtext.EcoreUtil2.ElementReferenceAcceptor import org.eclipse.emf.ecore.EReference import de.ugoe.cs.swe.tTCN3.StructFieldDef import de.ugoe.cs.swe.tTCN3.OpCall import de.ugoe.cs.swe.tTCN3.UnionFieldDef class CheckDefinitionComeFirstParameter { public boolean hasOtherDefinitions Loading Loading @@ -886,6 +889,7 @@ class CodeStyleValidator extends AbstractDeclarativeValidator { return } //TODO: overly specific.. //TODO: overly complicated -> simplify and reduce/invert conditions var target = "" val expr = templateOp.template.template.simple.expr // .ref.head Loading @@ -897,14 +901,46 @@ class CodeStyleValidator extends AbstractDeclarativeValidator { if (expr.ref.referencedValue instanceof FormalTemplatePar) { return } if (expr.ref.referencedValue instanceof BaseTemplate) { return } //TODO: add modulepar handling once BNF has been updated if (expr.ref.referencedValue instanceof StructFieldDef || expr.ref.referencedValue instanceof UnionFieldDef ) { if (expr.ref.head.target instanceof SingleTempVarInstance || expr.ref.head.target instanceof FormalTemplatePar ) { return } } target = expr.ref.referencedValue.name //TODO: other conditions? } else { //TODO: check further? //TODO: check further? e.g. predefined values? return } } else if (expr instanceof OpCall) { if (expr.function !== null) { if (expr.function.ref instanceof FunctionDef) { var returnType = (expr.function.ref as FunctionDef).returnType if (returnType.template !== null) { return } if (returnType.restricted !== null) { return } //TODO: add field or revert to template above? target = expr.function.ref.name } else if (expr.function.ref instanceof BaseTemplate) { return } //TODO: handle altsteps and others? } } else { //TODO: check further? e.g. function return types? //TODO: check further? return } statistics.incrementCountStyle Loading