internal PlaceholderLocalBinder(
            CSharpSyntaxNode syntax,
            ImmutableArray <Alias> aliases,
            MethodSymbol containingMethod,
            EETypeNameDecoder typeNameDecoder,
            Binder next) :
            base(next)
        {
            _syntax           = syntax;
            _containingMethod = containingMethod;

            var compilation    = next.Compilation;
            var sourceAssembly = compilation.SourceAssembly;

            var aliasesBuilder = ArrayBuilder <LocalSymbol> .GetInstance(aliases.Length);

            var lowercaseBuilder = ImmutableDictionary.CreateBuilder <string, LocalSymbol>();

            foreach (Alias alias in aliases)
            {
                var local = PlaceholderLocalSymbol.Create(
                    typeNameDecoder,
                    containingMethod,
                    sourceAssembly,
                    alias);
                aliasesBuilder.Add(local);

                if (alias.Kind == DkmClrAliasKind.ReturnValue)
                {
                    lowercaseBuilder.Add(local.Name.ToLower(), local);
                }
            }
            _lowercaseReturnValueAliases = lowercaseBuilder.ToImmutableDictionary();
            _aliases = aliasesBuilder.ToImmutableAndFree();
        }
        private MethodSymbol GetConstructedMethod(string source, string methodName, string[] serializedTypeArgumentNames, CSharpInstructionDecoder instructionDecoder)
        {
            var compilation     = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugDll, assemblyName: nameof(InstructionDecoderTests));
            var runtime         = CreateRuntimeInstance(compilation);
            var moduleInstances = runtime.Modules;
            var blocks          = moduleInstances.SelectAsArray(m => m.MetadataBlock);

            compilation = blocks.ToCompilation();
            var frame = (PEMethodSymbol)GetMethodOrTypeBySignature(compilation, methodName);

            // Once we have the method token, we want to look up the method (again)
            // using the same helper as the product code.  This helper will also map
            // async/iterator "MoveNext" methods to the original source method.
            MethodSymbol method = compilation.GetSourceMethod(
                ((PEModuleSymbol)frame.ContainingModule).Module.GetModuleVersionIdOrThrow(),
                MetadataTokens.GetToken(frame.Handle));

            if (serializedTypeArgumentNames != null)
            {
                Assert.NotEmpty(serializedTypeArgumentNames);
                var typeParameters = instructionDecoder.GetAllTypeParameters(method);
                Assert.NotEmpty(typeParameters);
                var typeNameDecoder = new EETypeNameDecoder(compilation, (PEModuleSymbol)method.ContainingModule);
                // Use the same helper method as the FrameDecoder to get the TypeSymbols for the
                // generic type arguments (rather than using EETypeNameDecoder directly).
                var typeArguments = instructionDecoder.GetTypeSymbols(compilation, method, serializedTypeArgumentNames);
                if (!typeArguments.IsEmpty)
                {
                    method = instructionDecoder.ConstructMethod(method, typeParameters, typeArguments);
                }
            }

            return(method);
        }