<commit_before>package hu.elte.txtuml.export.uml2.activity.statement

import hu.elte.txtuml.export.uml2.BaseExporter
import org.eclipse.jdt.core.dom.EnhancedForStatement
import org.eclipse.uml2.uml.ExpansionKind
import org.eclipse.uml2.uml.ExpansionRegion

class ForEachExporter extends ControlExporter<EnhancedForStatement, ExpansionRegion> {
	
	new(BaseExporter<?, ?, ?> parent) {
		super(parent)
	}
	
	override create(EnhancedForStatement access) { factory.createExpansionRegion }
	
	override exportContents(EnhancedForStatement source) {
		result.mode = ExpansionKind.ITERATIVE_LITERAL
		val expr = exportExpression(source.expression)
		val expnode = factory.createExpansionNode
		storeNode(expnode)
		expnode.type = fetchType(source.expression.resolveTypeBinding)
		result.inputElements += expnode
		expr.result.objectFlow(expnode)
		expnode.name = '''«expr.name»_expansion'''
		val loopVar = result.createVariable(source.parameter.name.identifier, expnode.type)
		storeVariable(loopVar)
		exportStatement(source.body)
		result.name = '''foreach («expr.name»)'''
	}
	
}<commit_msg>Corrected the type of foreach loop variable<commit_after>package hu.elte.txtuml.export.uml2.activity.statement

import hu.elte.txtuml.export.uml2.BaseExporter
import org.eclipse.jdt.core.dom.EnhancedForStatement
import org.eclipse.uml2.uml.ExpansionKind
import org.eclipse.uml2.uml.ExpansionRegion

class ForEachExporter extends ControlExporter<EnhancedForStatement, ExpansionRegion> {
	
	new(BaseExporter<?, ?, ?> parent) {
		super(parent)
	}
	
	override create(EnhancedForStatement access) { factory.createExpansionRegion }
	
	override exportContents(EnhancedForStatement source) {
		result.mode = ExpansionKind.ITERATIVE_LITERAL
		val expr = exportExpression(source.expression)
		val expnode = factory.createExpansionNode
		storeNode(expnode)
		expnode.type = fetchType(source.expression.resolveTypeBinding)
		result.inputElements += expnode
		expr.result.objectFlow(expnode)
		expnode.name = '''«expr.name»_expansion'''
		val loopVarType = fetchType(source.parameter.type.resolveBinding)
		val loopVar = result.createVariable(source.parameter.name.identifier, loopVarType)
		storeVariable(loopVar)
		exportStatement(source.body)
		result.name = '''foreach («expr.name»)'''
	}
	
}
{'fraction_non_alphanumeric': 0.10445130013221683, 'fraction_numerical': 0.0035257822829440283, 'mean_word_length': 6.071651090342679, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6966987', 'n_tokens_mistral': 760, 'n_tokens_neox': 710, 'n_words': 119}