Ejemplo n.º 1
0
        private void WaddleFunctionDeclaration(FunctionDeclSyntax functionSyntax)
        {
            var parameters =
                functionSyntax.Parameters.Select(param => new VariableDecl(param !.Name, param !.TypeSyntax.ToSymbol())).ToArray();
            var function = new FunctionDecl(functionSyntax.Name, functionSyntax.ReturnType?.ToSymbol(),
                                            functionSyntax.Body.Statements
                                            .OfType <DeclStmtSyntax>()
                                            .Select(stmt => new VariableDecl(stmt.ParameterDeclSyntax.Name, stmt.ParameterDeclSyntax.TypeSyntax.ToSymbol()))
                                            .Concat(parameters),
                                            parameters);

            _functions.Add(function.Name, function);
        }