btwael / mammouth

Unfancy PHP
http://mammouth.boutglay.com
MIT License
214 stars 22 forks source link

Bug: For each is not translating well #52

Closed sanotto closed 8 years ago

sanotto commented 9 years ago

for each object as key => value echo "Key: $key; Value: $value
\n Translates to... foreach($object as $value => key) { echo "Key: $key; Value: $value
\n"; } The dollar sign is missing in 'key' it should translate to foreach($object as $value => $key) { echo "Key: $key; Value: $value
\n"; }

sanotto commented 9 years ago

Crude hack to get it going ...

case 'Casting': if (element.foreach === true) { //return compile(new nodes.Identifier(element.typec)) + ' => ' + compile(element.variable); return '$'+compile(element.variable)+" => "+compile(new nodes.Identifier(element.typec)) ; } else { return '(' + element.typec + ') ' + compile(element.variable); } break;

in ~/.nvm/current/lib/node_modules/mammouth/lib/rewriter.js

btwael commented 9 years ago

Okey ! thank you :+1:, I'm working a 3rd version now, where all known issue will be fixed

btwael commented 8 years ago

Check mammouth website is fixed I guess