addGlobalConstant<T> method
Add a constant value with type T to the table.
Implementation
int addGlobalConstant<T>(T value) {
var table = constants[T];
if (table == null) {
constants[T] = table = <T>[];
}
int index;
if (value is bool || value is int || value is double || value is String) {
index = table.indexOf(value);
} else {
index = table.length;
table.add(value);
}
if (index == -1) {
table.add(value);
return table.length - 1;
} else {
return index;
}
}