Table constructor
Table(
- dynamic tableName,
- dynamic fields,
- dynamic options
Implementation
Table(tableName, fields, options) {
// For coverage tables with coverage format 2, we do not want to add the coverage data directly to the table object,
// as this will result in wrong encoding order of the coverage data on serialization to bytes.
// The fallback of using the field values directly when not present on the table is handled in types.encode.TABLE() already.
if (fields.length && (fields[0].name != 'coverageFormat' || fields[0].value == 1)) {
for (var i = 0; i < fields.length; i += 1) {
var field = fields[i];
// this[field.name] = field.value;
this.setProperty(field.name, field.value);
}
}
this.tableName = tableName;
this.fields = fields;
if (options != null) {
var optionKeys = options.keys.toList();
for (var i = 0; i < optionKeys.length; i += 1) {
var k = optionKeys[i];
var v = options[k];
if (this.getProperty(k) != null) {
// this[k] = v;
this.setProperty(k, v);
}
}
}
}