diff --git a/src/main/java/org/rumbledb/compiler/CloneVisitor.java b/src/main/java/org/rumbledb/compiler/CloneVisitor.java index 546af9628..d308ed910 100644 --- a/src/main/java/org/rumbledb/compiler/CloneVisitor.java +++ b/src/main/java/org/rumbledb/compiler/CloneVisitor.java @@ -448,7 +448,7 @@ public Node visitInlineFunctionExpr(InlineFunctionExpression expression, Node ar expression.getAnnotations(), expression.getName(), expression.getParams(), - expression.getReturnType(), + expression.getActualReturnType(), (StatementsAndOptionalExpr) visit(expression.getBody(), argument), expression.getMetadata() ); diff --git a/src/main/java/org/rumbledb/compiler/ExpressionClassificationVisitor.java b/src/main/java/org/rumbledb/compiler/ExpressionClassificationVisitor.java index 946772fb2..b585665fa 100644 --- a/src/main/java/org/rumbledb/compiler/ExpressionClassificationVisitor.java +++ b/src/main/java/org/rumbledb/compiler/ExpressionClassificationVisitor.java @@ -375,8 +375,11 @@ public ExpressionClassification visitInlineFunctionExpr( if (expression.isUpdating()) { if (expression.getActualReturnType() != null) { + System.err.println(expression); throw new UpdatingFunctionHasReturnTypeException( - "An updating function cannot have a return type", + "An updating function cannot have a return type. Return type " + + expression.getActualReturnType() + + " is specified.", expression.getMetadata() ); } diff --git a/src/main/java/org/rumbledb/compiler/VisitorHelpers.java b/src/main/java/org/rumbledb/compiler/VisitorHelpers.java index 691fb1318..7c78ec877 100644 --- a/src/main/java/org/rumbledb/compiler/VisitorHelpers.java +++ b/src/main/java/org/rumbledb/compiler/VisitorHelpers.java @@ -154,17 +154,77 @@ public static MainModule parseJSONiqMainModule( if (main == null) { throw new ParsingException("A library module is not executable.", ExceptionMetadata.EMPTY_METADATA); } + if (configuration.isPrintIteratorTree()) { + System.err.println("***************"); + System.err.println("Parsing program"); + System.err.println("***************"); + } MainModule mainModule = (MainModule) visitor.visit(main); + if (configuration.isPrintIteratorTree()) { + System.err.println("***************"); + System.err.println("Pruning modules"); + System.err.println("***************"); + } pruneModules(mainModule, configuration); + if (configuration.isPrintIteratorTree()) { + System.err.println("**********************"); + System.err.println("Resolving dependencies"); + System.err.println("**********************"); + } resolveDependencies(mainModule, configuration); + if (configuration.isPrintIteratorTree()) { + System.err.println("*************************************"); + System.err.println("Populating sequential classifications"); + System.err.println("*************************************"); + } populateSequentialClassifications(mainModule, configuration); + if (configuration.isPrintIteratorTree()) { + System.err.println("***************************************"); + System.err.println("Applying type independent optimizations"); + System.err.println("***************************************"); + } mainModule = applyTypeIndependentOptimizations(mainModule, configuration); + if (configuration.isPrintIteratorTree()) { + System.err.println("*************************"); + System.err.println("Populating static context"); + System.err.println("*************************"); + } populateStaticContext(mainModule, configuration); + if (configuration.isPrintIteratorTree()) { + System.err.println("*************************************"); + System.err.println("Populating expression classifications"); + System.err.println("*************************************"); + } populateExpressionClassifications(mainModule, configuration); + if (configuration.isPrintIteratorTree()) { + System.err.println("**************"); + System.err.println("Infering types"); + System.err.println("**************"); + } inferTypes(mainModule, configuration); + if (configuration.isPrintIteratorTree()) { + System.err.println("************************"); + System.err.println("Applying type dependent optimizations"); + System.err.println("************************"); + } mainModule = applyTypeDependentOptimizations(mainModule); + if (configuration.isPrintIteratorTree()) { + System.err.println("***************************************"); + System.err.println("Populating execution modes"); + System.err.println("***************************************"); + } populateExecutionModes(mainModule, configuration); + if (configuration.isPrintIteratorTree()) { + System.err.println("*************************************"); + System.err.println("Populating expression classifications"); + System.err.println("*************************************"); + } populateExpressionClassifications(mainModule, configuration); + if (configuration.isPrintIteratorTree()) { + System.err.println("********************************"); + System.err.println("Verify composability constraints"); + System.err.println("********************************"); + } verifyComposabilityConstraints(mainModule, configuration); return mainModule; } catch (ParseCancellationException ex) {