Skip to content

Commit

Permalink
Fixes to deal with PythonGenerator accessing (through CGenerator) pro…
Browse files Browse the repository at this point in the history
…perties that it does not support
  • Loading branch information
lhstrh committed Oct 17, 2023
1 parent 5d89828 commit 33dc1b1
Show file tree
Hide file tree
Showing 48 changed files with 425 additions and 687 deletions.
2 changes: 2 additions & 0 deletions core/src/main/java/org/lflang/Target.java
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,8 @@ public void initialize(TargetConfig config) {
TracingProperty.INSTANCE,
WorkersProperty.INSTANCE);
case Python -> config.register(
AuthProperty.INSTANCE,
BuildCommandsProperty.INSTANCE,
BuildTypeProperty.INSTANCE,
ClockSyncModeProperty.INSTANCE,
ClockSyncOptionsProperty.INSTANCE,
Expand Down
34 changes: 0 additions & 34 deletions core/src/main/java/org/lflang/TargetProperty.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,6 @@ protected TargetProperty(S type) {
this.type = type;
}

/**
* If this target property is not supported by the given target, report a warning through the
* message reporter at the location of the given key-value pair.
*
* @param pair The ast node that matches this target property.
* @param target The target to check against.
* @param reporter The reporter to issue a warning through if this property is not supported by
* the given target.
*/
public void checkSupport(KeyValuePair pair, Target target, MessageReporter reporter) {
if (!this.isSupported(target)) {
reporter
.at(pair, Literals.KEY_VALUE_PAIR__NAME)
.warning(
String.format(
"The target property: %s is not supported by the %s target and will thus be"
+ " ignored.",
pair.getName(), target));
}
}

/**
* If the given key-value pair does not match the type required by this target property, report an
* error through the given reporter.
Expand All @@ -66,16 +45,6 @@ public void checkType(KeyValuePair pair, MessageReporter reporter) {
}
}

/**
* Return {@code true} if this target property is supported by the given target, {@code false}
* otherwise.
*
* @param target The target to check against.
*/
public final boolean isSupported(Target target) {
return supportedTargets().contains(target);
}

@Override
public String toString() {
return this.name();
Expand Down Expand Up @@ -116,9 +85,6 @@ public void validate(KeyValuePair pair, Model ast, MessageReporter reporter) {}
*/
protected abstract T fromString(String string, MessageReporter reporter);

/** Return a list of targets that support this target property. */
public abstract List<Target> supportedTargets();

/**
* Return an AST node that represents this target property and the value currently assigned to it.
*/
Expand Down
Loading

0 comments on commit 33dc1b1

Please sign in to comment.