public Symbol Add(string name, IrisType type, StorageClass storage, int location, ImportedMember importInfo = null)
        {
            Symbol symbol = new Symbol(name, type, storage, location, importInfo);
            if (storage == StorageClass.Global)
                _global.Add(name, symbol);
            else
                _local.Add(name, symbol);

            return symbol;
        }
        private void MaybeGenerateEntryForSymbol(Symbol symbol)
        {
            if (_context.ArgumentsOnly && symbol.StorageClass != StorageClass.Argument)
            {
                // We are only showing arguments
                return;
            }

            IrisType symbolType = symbol.Type;
            if (symbolType.IsMethod || symbolType == IrisType.Invalid || symbolType == IrisType.Void)
            {
                // This symbol doesn't belong in the Locals window.
                // Don't generate an entry for it.
                return;
            }

            if (symbol.Name.StartsWith("$."))
            {
                // Don't show compiler internal symbols
                return;
            }

            string methodName = _context.NextMethodName();
            IrisType derefType = DerefType(symbolType);

            // Emit code for the method to get the symbol value.
            MethodGenerator.BeginMethod(methodName, derefType, _context.ParameterVariables, _context.LocalVariables, entryPoint: false, methodFileName: null);
            EmitLoadSymbol(symbol, SymbolLoadMode.Dereference);
            MethodGenerator.EndMethod();

            // Generate the local entry to pass back to the debug engine
            DkmClrCompilationResultFlags resultFlags = DkmClrCompilationResultFlags.None;
            if (derefType == IrisType.Boolean)
            {
                // The debugger uses "BoolResult" for breakpoint conditions so setting the flag
                // here has no effect currently, but we set it for the sake of consistency.
                resultFlags |= DkmClrCompilationResultFlags.BoolResult;
            }
            else if (derefType.IsArray)
            {
                // Iris doesn't support modification of an array itself
                resultFlags |= DkmClrCompilationResultFlags.ReadOnlyResult;
            }

            string fullName = symbol.Name;

            _context.GeneratedLocals.Add(DkmClrLocalVariableInfo.Create(
                fullName,
                fullName,
                methodName,
                resultFlags,
                DkmEvaluationResultCategory.Data,
                null));
        }
        public Symbol CreateUndefinedSymbol(string name)
        {
            // We want to add entries to the symbol table for undefined symbols we encounter.
            // This prevents us from spewing many duplicate errors for the same symbol being
            // undefined.
            Symbol symbol;
            if (_local != null)
            {
                symbol = new Symbol(name, IrisType.Invalid, StorageClass.Local, -1, null);
                _local.Add(name, symbol);
            }
            else
            {
                symbol = new Symbol(name, IrisType.Invalid, StorageClass.Global, -1, null);
                _global.Add(name, symbol);
            }

            return symbol;
        }