visitForIn method
dynamic
visitForIn(
- ForInStatement node
)
Implementation
@override
visitForIn(ForInStatement node) {
dynamic right = getValueFromNode(node.right);
dynamic left = node.left.visitBy(this);
if (right is! Map) {
throw JSException(node.line ?? 1,
'for...in is only allowed for js objects or maps. $right is not a map',
detailedError: 'Code: ${getCode(node)}');
}
if (left is! Name) {
throw JSException(node.line ?? 1,
'left side in the for...in expression must be a name node. $node.left is not name',
detailedError: 'Code: ${getCode(node)}');
}
Map map = right;
for (dynamic key in map.keys) {
addToContext(left, key);
try {
node.body.visitBy(this);
} on ControlFlowBreakException catch (e) {
break;
} on ControlFlowContinueException catch (e) {
continue;
}
}
//removeFromContext(left);
}