Fixed schema generation

This commit is contained in:
Borna Rajković committed 2022-06-06 01:10:11 +02:00
1 parent 9b7ede933a
commit 1ec8b10ef5
7 files changed
+196 -20

No files matched your search

+14 -6
View File
@@ -285,7 +285,11 @@ namespace domain {
} else {
// if no connection exists than defaults must exist
for (auto &wire: *pin.getWires()) {
tempOutput << wire.stringify() << ", ";
if(wire.isType(Value::NIL)) {
tempOutput << "*, ";
} else {
tempOutput << wire.stringify() << ", ";
}
}
}
}
@@ -311,22 +315,26 @@ namespace domain {
std::vector<Value> defaults;
if (connection->instance->name == name && connection->connection.getComponent().pin == pin) {
wires = connection->connection.getWires();
selected = connection->attributes[0].value.asReference();
selected = connection->attributes[0].value.asString();
defaults = *connection->instance->component.getPin(pin).getWires();
} else {
wires = *connection->connection.getSecondWires();
selected = connection->attributes[1].value.asReference();
selected = connection->attributes[1].value.asString();
defaults = *connection->secondInstance->component.getPin(pin).getWires();
}
for (int i = 0; i < wires.size(); i++) {
if (wires[i].isType(Value::STRING)) {
if (wires[i].asString() == selected) {
buffer << wireNames[connection->bus->name + "." + connection->bus->bus.getWires()[0].getName()]
<< ", ";
auto wireName = connection->bus->name + "." + connection->bus->bus.getWires()[0].getName();
buffer << wireNames[wireName] << ", ";
} else if(defaults[i].isType(Value::NIL)) {
buffer << "*, ";
} else {
buffer << defaults[i].stringify();
buffer << defaults[i].stringify() << ", ";
}
} else if(defaults[i].isType(Value::NIL)) {
buffer << "*, ";
} else {
buffer << wires[i].stringify() << ", ";
}
+2 -2
View File
@@ -736,7 +736,7 @@ namespace domain {
std::optional<Popup> popup;
if (node.popup) {
popup = loadPopup(*node.popup, name, value.getType());
popup = loadPopup(*node.popup, name, toType(node.type));
}
pop();
@@ -958,7 +958,7 @@ namespace domain {
errors.emplace_back(attr.span, "invalid value");
}
attributes.emplace_back(attribute.getName(), toType(attr.value), attribute);
attributes.emplace_back(attribute.getName(), value, attribute);
} else {
errors.emplace_back(attr.name.span, "unknown attribute");
}