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

Dart: Fix default values (#4795)

parent ea06768a
......@@ -518,10 +518,20 @@ class DartGenerator : public BaseGenerator {
code += ".vTableGet(_bc, _bcOffset, " +
NumToString(field.value.offset) + ", ";
if (!field.value.constant.empty() && field.value.constant != "0") {
if (IsBool(field.value.type.base_type)) {
code += "true";
} else {
code += field.value.constant;
}
} else {
if (IsBool(field.value.type.base_type)) {
code += "false";
} else if (IsScalar(field.value.type.base_type)) {
code += "0";
} else {
code += "null";
}
}
code += ")";
}
if (field.value.type.enum_def &&
......
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