private ArgsUst VisitArguments(Esprima.Ast.List <ArgumentListElement> arguments) { var args = new Collections.List <UstExprs.Expression>(arguments.Count); foreach (ArgumentListElement arg in arguments) { // TODO: all cases of type casting if (arg is SpreadElement spreadElement) { // TODO: spread elements processing Logger.LogDebug("Spread elements are not supported for now"); } else if (arg is Expression expression) { args.Add(VisitExpression(expression)); } else { // TODO: Logger.LogDebug($"{arg.GetType().Name} are not supported for now"); } } return(new ArgsUst(args)); }
private Collections.List <UstStmts.Statement> VisitStatements(Esprima.Ast.List <StatementListItem> listItems) { var statements = new Collections.List <UstStmts.Statement>(listItems.Count); foreach (StatementListItem listItem in listItems) { statements.Add(VisitStatementListItem(listItem).ToStatementIfRequired()); } return(statements); }
private Collections.List <ParameterDeclaration> VisitParameters(Esprima.Ast.List <INode> parameters) { var result = new Collections.List <ParameterDeclaration>(parameters.Count); foreach (INode param in parameters) { UstTokens.IdToken name; if (param is Identifier identifier) { name = VisitIdentifier(identifier); } else { // TODO: extend parameter declaration name = new UstTokens.IdToken("", GetTextSpan(param)); } result.Add(new ParameterDeclaration(null, null, name, name.TextSpan)); } return(result); }