Skip to content

Commit

Permalink
Merge branch 'topic/decl_cleanup' into 'master'
Browse files Browse the repository at this point in the history
Cleanup declarations in LKQL JIT sources

Closes #288

See merge request eng/libadalang/langkit-query-language!245
  • Loading branch information
HugoGGuerrier committed Jul 3, 2024
2 parents 49c905f + 0ef57d9 commit 39133dc
Show file tree
Hide file tree
Showing 42 changed files with 54 additions and 474 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,10 @@ public final class LKQLContext {
@CompilerDirectives.CompilationFinal(dimensions = 1)
private Libadalang.ScenarioVariable[] scenarioVars = null;

private Boolean useAutoProvider = null;

/** The ada files passed through the command line. */
@CompilerDirectives.CompilationFinal(dimensions = 1)
private String[] files = null;

/** The error printing mode. */
@CompilerDirectives.CompilationFinal private String errorMode = null;

/** Whether the checker is in debug mode. */
@CompilerDirectives.CompilationFinal private Boolean checkerDebug = null;

Expand Down Expand Up @@ -343,18 +338,6 @@ public boolean isCheckerDebug() {
return this.checkerDebug;
}

/**
* Get the error handling mode.
*
* @return The mode in a string.
*/
public String getErrorMode() {
if (this.errorMode == null) {
this.errorMode = this.env.getOptions().get(LKQLLanguage.errorMode);
}
return this.errorMode;
}

/**
* Get the directories to get the rules from.
*
Expand Down Expand Up @@ -395,7 +378,6 @@ private void invalidateOptionCaches() {
this.isVerbose = null;
this.projectFile = null;
this.files = null;
this.errorMode = null;
this.ruleInstances = null;
this.instancesArgsCache = new HashMap<>();
this.ruleDirectories = null;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import com.adacore.lkql_jit.built_ins.functions.*;
import com.adacore.lkql_jit.built_ins.methods.*;
import com.adacore.lkql_jit.built_ins.selectors.*;
import com.adacore.lkql_jit.checker.built_ins.NodeCheckerFunction;
import com.adacore.lkql_jit.checker.built_ins.UnitCheckerFunction;
import com.adacore.lkql_jit.utils.LKQLTypesHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ public class DocumentBuiltins {
public static final String NAME = "document_builtins";

@CompilerDirectives.TruffleBoundary
public static String documentBuiltinsImpl(MaterializedFrame frame, FunCall call) {
public static String documentBuiltinsImpl(
@SuppressWarnings("unused") MaterializedFrame frame,
@SuppressWarnings("unused") FunCall call) {
var sw = new StringWriter();
try (TextWriter writer = new TextWriter(sw)) {
writer.write("Standard library\n");
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public static class Execute {
/** Execute the function with the cached strategy. */
@Specialization(guards = "function.getCallTarget() == directCallNode.getCallTarget()")
protected static Object doCached(
final LKQLFunction function,
@SuppressWarnings("unused") final LKQLFunction function,
final Object[] arguments,
@Cached("create(function.getCallTarget())") DirectCallNode directCallNode) {
return directCallNode.call(arguments);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public boolean isExecutable() {

/** Placeholder function for the Truffle DSL. */
@ExportMessage
public Object execute(Object[] arguments)
public Object execute(@SuppressWarnings("unused") Object[] arguments)
throws UnsupportedTypeException, ArityException, UnsupportedMessageException {
// TODO (issue #143): implement this method to execute the property as a simple function
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public boolean isExecutable() {

/** Placeholder function for the Truffle DSL. */
@ExportMessage
public Object execute(Object[] arguments)
public Object execute(@SuppressWarnings("unused") Object[] arguments)
throws UnsupportedTypeException, ArityException, UnsupportedMessageException {
// TODO (issue #143): implement this method to execute the selector as a simple function
// returning a selector list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,42 +102,10 @@ public String getMessage() {
return message;
}

public String getHelp() {
return help;
}

public boolean isFollowGenericInstantiations() {
return followGenericInstantiations;
}

public String getCategory() {
return category;
}

public String getSubcategory() {
return subcategory;
}

public Remediation getRemediation() {
return remediation;
}

public long getExecutionCost() {
return executionCost;
}

public boolean isParametricExemption() {
return parametricExemption;
}

public String getImpact() {
return impact;
}

public String getTarget() {
return target;
}

// ----- Setters -----

public void setAlias(String alias) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,6 @@ public static LKQLRuntimeException ignoredExpressionReturn(Node location) {
"Can't ignore the return value of an expr in a block expr", location);
}

/** Create a new exception when a key appears many times in the same object literal. */
public static LKQLRuntimeException multipleSameNameKeys(String key, Node location) {
return LKQLRuntimeException.fromMessage(
"Multiple keys with the same name in the object: \"" + key + "\"", location);
}

// --- Symbol exception

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ public final class LangkitException extends AbstractTruffleException {

@Serial private static final long serialVersionUID = 1755847711876252095L;

/** Kind of the Langkit exception. */
private final String kind;

/** Message of the exception. */
private final String msg;

Expand All @@ -34,22 +31,16 @@ public final class LangkitException extends AbstractTruffleException {
/**
* Create a new Langkit exception.
*
* @param kind The kind of the exception.
* @param msg The message of the exception.
* @param location The location of the exception.
*/
public LangkitException(String kind, String msg, SourceSection location) {
this.kind = kind;
public LangkitException(String msg, SourceSection location) {
this.msg = msg;
this.location = location;
}

// ----- Getters -----

public String getKind() {
return this.kind;
}

public String getMsg() {
return this.msg;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private RuntimeException translationError(Liblkqllang.LkqlNode node, String mess

private RuntimeException multipleSameNameKeys(Liblkqllang.LkqlNode node, String key) {
throw translationError(
node, "Multiple keys with the same name in the " + "object: \"" + key + "\"");
node, "Multiple keys with the same name in the object: \"" + key + "\"");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ public ScriptFrames(
this.current = null;
}

// ----- Getters -----

public AbstractNodeFrame getCurrent() {
return this.current;
}

// ----- Instance methods -----

// --- Frame methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ public ScriptFramesBuilder() {
this.current = null;
}

// ----- Getters -----

public NodeFrameBuilder getCurrent() {
return this.current;
}

// ----- Instance methods -----

// --- Frame methods
Expand Down Expand Up @@ -253,7 +247,6 @@ public ScriptFrames.AbstractNodeFrame build(final ScriptFrames.AbstractNodeFrame
: new ScriptFrames.NodeFrame(this.node, parent);

// Add all bindings to the node frame
final boolean saveNames = this.node instanceof Liblkqllang.TopLevelList;
for (String binding : this.bindings) {
res.addBinding(binding);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,6 @@ public SelectorArm(SourceSection location, BasePattern pattern, Expr expr) {
this.expr = expr;
}

// ----- Getters -----

public BasePattern getPattern() {
return pattern;
}

public Expr getExpr() {
return expr;
}

// ----- Execution methods -----

/**
Expand Down
Loading

0 comments on commit 39133dc

Please sign in to comment.