use of org.codehaus.groovy.util.ListHashMap in project groovy by apache.
the class StaticTypeCheckingVisitor method saveVariableExpressionMetadata.
protected void saveVariableExpressionMetadata(final Set<VariableExpression> closureSharedExpressions, final Map<VariableExpression, ListHashMap> typesBeforeVisit) {
for (VariableExpression ve : closureSharedExpressions) {
// GROOVY-6921: We must force a call to getType in order to update closure shared variable which types are
// inferred thanks to closure parameter type inference
getType(ve);
ListHashMap<StaticTypesMarker, Object> metadata = new ListHashMap<StaticTypesMarker, Object>();
for (StaticTypesMarker marker : StaticTypesMarker.values()) {
Object value = ve.getNodeMetaData(marker);
if (value != null) {
metadata.put(marker, value);
}
}
typesBeforeVisit.put(ve, metadata);
Variable accessedVariable = ve.getAccessedVariable();
if (accessedVariable != ve && accessedVariable instanceof VariableExpression) {
saveVariableExpressionMetadata(Collections.singleton((VariableExpression) accessedVariable), typesBeforeVisit);
}
}
}
Aggregations