Commit 3331805a authored by Woody Guo's avatar Woody Guo Committed by Wouter van Oortmerssen

Dart: Fix default values (#4795)

parent ea06768a
......@@ -518,9 +518,19 @@ class DartGenerator : public BaseGenerator {
code += ".vTableGet(_bc, _bcOffset, " +
NumToString(field.value.offset) + ", ";
if (!field.value.constant.empty() && field.value.constant != "0") {
code += field.value.constant;
if (IsBool(field.value.type.base_type)) {
code += "true";
} else {
code += field.value.constant;
}
} else {
code += "null";
if (IsBool(field.value.type.base_type)) {
code += "false";
} else if (IsScalar(field.value.type.base_type)) {
code += "0";
} else {
code += "null";
}
}
code += ")";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment