public SymbolImplementation BuildMethod(SourceMethodDefinitionSymbol methodSymbol)
        {
            var methodBody = methodSymbol.Syntax.Body;
            var symbolTable = (ISymbolTable) methodSymbol.Parent;

            _rootScope = new SymbolScope(symbolTable);
            _currentScope = _rootScope;

            var symbolContext = methodSymbol;
            var implementationNode = methodBody;

            var statements = new List<BoundStatement>();
            var statementBuilder = new StatementBinder(this, symbolContext, _diagnostics);

            if (symbolContext.Parameters != null)
            {
                int parameterCount = symbolContext.Parameters.Length;
                for (int paramIndex = 0; paramIndex < parameterCount; paramIndex++)
                    _currentScope.AddSymbol(symbolContext.Parameters[paramIndex]);
            }

            foreach (var statementNode in implementationNode.Statements)
            {
                var statement = statementBuilder.BuildStatement(statementNode);
                if (statement != null)
                    statements.Add(statement);
            }

            return new SymbolImplementation(statements.ToImmutableArray(), _rootScope);
        }
        private MethodDefinitionSymbol BindMethodDefinition(FunctionDefinitionSyntax declaration, TypeSymbol parentType)
        {
            var returnType = _symbolSet.ResolveType(declaration.ReturnType, parentType, null);

            Func<MethodSymbol, IEnumerable<ParameterSymbol>> lazyParameterSymbols = fd =>
            {
                var parameterSymbols = new List<ParameterSymbol>();
                foreach (var parameterSyntax in declaration.ParameterList.Parameters)
                {
                    var parameterValueType = _symbolSet.ResolveType(parameterSyntax.Type, null, null);
                    var parameterDirection = SyntaxFacts.GetParameterDirection(parameterSyntax.Modifiers);

                    parameterSymbols.Add(new SourceParameterSymbol(
                        parameterSyntax,
                        fd,
                        parameterValueType,
                        parameterDirection));
                }
                return parameterSymbols;
            };

            var symbol = new SourceMethodDefinitionSymbol(declaration, parentType, returnType, lazyParameterSymbols);
            _bindingResult.AddSymbol(declaration, symbol);

            return symbol;
        }