Skip to content

Commit

Permalink
fix(translation): add args translation
Browse files Browse the repository at this point in the history
  • Loading branch information
nomocas committed Apr 30, 2017
1 parent fadce95 commit c132c16
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/lexicon/lexicon.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,22 @@ Babelute.prototype._translateLexemsThrough = function(lexicon, firstLevel = fals
lexicon = map[lexem.lexicon];
if (!lexicon)
return null;
const args = translateArgs(lexem.args, lexicon, firstLevel);
const b = new (firstLevel ? lexicon.FirstLevel : lexicon.Atomic)();
return b[lexem.name] && b[lexem.name](...lexem.args);
return b[lexem.name] && b[lexem.name](...args);
});
};

function translateArgs(args, lexicon, firstLevel){
const result = [];
for(let i = 0, len = args.length; i < len; ++i)
if(args[i] && args[i].__babelute__)
result.push(args[i]._translateLexemsThrough(lexicon, firstLevel));
else
result.push(args[i]);
return result;
}



/**
Expand Down

0 comments on commit c132c16

Please # to comment.