HashMap<String, DartObjectImpl> fieldMap = new HashMap<String, DartObjectImpl>();
HashMap<String, DartObjectImpl> parameterMap = new HashMap<String, DartObjectImpl>();
ParameterElement[] parameters = constructorBase.getParameters();
int parameterCount = parameters.length;
for (int i = 0; i < parameterCount; i++) {
ParameterElement parameter = parameters[i];
while (parameter instanceof ParameterMember) {
parameter = ((ParameterMember) parameter).getBaseElement();
}
DartObjectImpl argumentValue = null;
if (parameter.getParameterKind() == ParameterKind.NAMED) {
argumentValue = namedArgumentValues.get(parameter.getName());
} else if (i < argumentCount) {
argumentValue = argumentValues[i];
}
if (argumentValue == null && parameter instanceof ParameterElementImpl) {
// The parameter is an optional positional parameter for which no value was provided, so
// use the default value.
beforeGetParameterDefault(parameter);
EvaluationResultImpl evaluationResult = ((ParameterElementImpl) parameter).getEvaluationResult();
if (evaluationResult instanceof ValidResult) {
argumentValue = ((ValidResult) evaluationResult).getValue();
} else if (evaluationResult == null) {
// No default was provided, so the default value is null.
argumentValue = constantVisitor.getNull();
}
}
if (argumentValue != null) {
if (parameter.isInitializingFormal()) {
FieldElement field = ((FieldFormalParameterElement) parameter).getField();
if (field != null) {
String fieldName = field.getName();
fieldMap.put(fieldName, argumentValue);
}
} else {
String name = parameter.getName();
parameterMap.put(name, argumentValue);
}
}
}
ConstantVisitor initializerVisitor = new ConstantVisitor(typeProvider, parameterMap);