Skip to content

Commit

Permalink
Fix test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghislain Fourny committed Aug 2, 2024
1 parent 90e0702 commit 55c60f5
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/rumbledb/compiler/CloneVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
}
Expand Down
60 changes: 60 additions & 0 deletions src/main/java/org/rumbledb/compiler/VisitorHelpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 55c60f5

Please sign in to comment.