From a5a43574e0a35b1c9ca7829d731d4e1ce01a2e92 Mon Sep 17 00:00:00 2001 From: Dimitris Kolovos Date: Mon, 18 Nov 2024 10:42:09 +0000 Subject: [PATCH] Updated Stateflow driver to use non-deprecated API and pass tests --- .../epsilon/emc/simulink/model/element/StateflowBlock.java | 4 ++-- .../resources/example_scripts/parent.eol | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/org.eclipse.epsilon.emc.simulink/src/org/eclipse/epsilon/emc/simulink/model/element/StateflowBlock.java b/plugins/org.eclipse.epsilon.emc.simulink/src/org/eclipse/epsilon/emc/simulink/model/element/StateflowBlock.java index 8b0a9f76c7..359a0d92f0 100644 --- a/plugins/org.eclipse.epsilon.emc.simulink/src/org/eclipse/epsilon/emc/simulink/model/element/StateflowBlock.java +++ b/plugins/org.eclipse.epsilon.emc.simulink/src/org/eclipse/epsilon/emc/simulink/model/element/StateflowBlock.java @@ -30,7 +30,7 @@ public class StateflowBlock extends SimulinkModelElement { /** CONSTANTS */ //public static final String STATEFLOW_LIB = "sflib/"; - private static final String SIMPLE_TYPE = "?.classhandle.get('Name');"; + private static final String SIMPLE_TYPE = "class(?);"; private static final String DELETE_SF = "?.delete;"; /** FIELDS */ @@ -333,7 +333,7 @@ public Double getHandle() { public Boolean isCommented() throws EolRuntimeException{ try { String handle = StateflowUtil.getBlockHandleFromId(((SimulinkModel)model), engine, id); - return (Boolean) engine.evalWithResult("isCommented(?);", handle); + return (Boolean) engine.evalWithResult("?.isCommented;", handle); }catch (Exception e) { throw new EolRuntimeException(e.getMessage()); } diff --git a/tests/org.eclipse.epsilon.emc.simulink.test/resources/example_scripts/parent.eol b/tests/org.eclipse.epsilon.emc.simulink.test/resources/example_scripts/parent.eol index f1ed6c82b2..a20a498559 100644 --- a/tests/org.eclipse.epsilon.emc.simulink.test/resources/example_scripts/parent.eol +++ b/tests/org.eclipse.epsilon.emc.simulink.test/resources/example_scripts/parent.eol @@ -46,7 +46,6 @@ foundSfChart.println("Found chart" ); var sA = new `Stateflow.State`; sA.parent = `Stateflow.Chart`.all.first(); sA.path.println; -sA.struct.println; sA.println(">> CREATED: "); chart.parent = subsys;