@@ -190,76 +190,49 @@ private List<Statement> getPerformExpressionList(String inputParamId, String out
190190 List <Statement > performStatement = expressionList .stream ().map (ExpressionStmt ::new ).collect (Collectors .toList ());
191191 final String exceptionVariable = "e" ;
192192 final String outputSocketForEachVariableId = "outputSocket" ;
193- final TryStmt performTry = new TryStmt (
194- new BlockStmt (
195- Arrays .asList (
193+
194+ performStatement . addAll (
195+ Arrays .asList (
196196 /* Make the operation function call */
197- new ExpressionStmt (
198- getFunctionCallExpression ()
199- ),
197+ new ExpressionStmt (
198+ getFunctionCallExpression ()
199+ ),
200200 /*
201201 * Afterwards iterate over all of the output sockets and call setValue using the value
202202 * stored.
203203 */
204- new ForeachStmt (
205- new VariableDeclarationExpr (
206- 0 ,
207- ASTHelper .createReferenceType ("OutputSocket" , 0 ),
208- Collections .singletonList (
209- new VariableDeclarator (
210- new VariableDeclaratorId (outputSocketForEachVariableId )
211- )
212- )
213- ),
214- new NameExpr (outputParamId ),
215- new BlockStmt (
216- Collections .singletonList (
217- new ExpressionStmt (
218- new MethodCallExpr (
219- new NameExpr (outputSocketForEachVariableId ),
220- "setValueOptional" ,
221- Collections .singletonList (
222- new MethodCallExpr (
223- new NameExpr (outputSocketForEachVariableId ),
224- "getValue"
225- )
226- )
227- )
228- )
204+ new ForeachStmt (
205+ new VariableDeclarationExpr (
206+ 0 ,
207+ ASTHelper .createReferenceType ("OutputSocket" , 0 ),
208+ Collections .singletonList (
209+ new VariableDeclarator (
210+ new VariableDeclaratorId (outputSocketForEachVariableId )
229211 )
230212 )
231- )
232- )
233- ),
234- Collections .singletonList (
235- new CatchClause (
236- new MultiTypeParameter (
237- ModifierSet .FINAL ,
238- null ,
239- Collections .singletonList (
240- ASTHelper .createReferenceType ("Exception" , 0 )
241- ),
242- new VariableDeclaratorId (exceptionVariable )
243213 ),
214+ new NameExpr (outputParamId ),
244215 new BlockStmt (
245- // TODO: Add some sort of indication that an error has occurred
246216 Collections .singletonList (
247217 new ExpressionStmt (
248218 new MethodCallExpr (
249- new NameExpr (exceptionVariable ),
250- "printStackTrace"
219+ new NameExpr (outputSocketForEachVariableId ),
220+ "setValueOptional" ,
221+ Collections .singletonList (
222+ new MethodCallExpr (
223+ new NameExpr (outputSocketForEachVariableId ),
224+ "getValue"
225+ )
226+ )
251227 )
252228 )
253229 )
254230 )
255231 )
256- ),
257- null
232+ )
258233 );
259- // This is needed to prevent a null pointer
260- performTry .setResources (Collections .emptyList ());
261234
262- performStatement . add ( performTry );
235+
263236 return performStatement ;
264237 }
265238
0 commit comments