public void SetUp()
 {
     _globalScope = new GlobalScope();
     _blockScope = new ErrorScope(_globalScope);
     _internalBlockScope = new LocalScope(_blockScope);
     _someType = TypeSymbol.MakeScalarTypeSymbol("int", _globalScope).Type;
 }
        // Detects possible duplicate declaration of a method identifier.
        // A dummy scope is made to stand in for the method scope.
        public override void Visit(MethodDeclaration node)
        {
            Debug.Assert(CurrentScope is IMethodScope);

            node.Type = CheckDeclaredType(node);
            var methodScope = (IMethodScope) CurrentScope;

            // Note: the symbol is stored on the node even if the attempt
            // to define it fails. This feature can be used in the type
            // checking phase to e.g. check return types for even methods
            // that could not be defined due to a name clash.
            node.Symbol = new MethodSymbol(node.Name, node.Type, methodScope, node.IsStatic);
            IScope scope = node.Symbol.Scope;
            if (!methodScope.Define(node.Symbol))
            {
                ReportSymbolDefinitionError(node);
                scope = new ErrorScope(CurrentScope); // Make an error scope to stand in for the method scope for purposes of recovery.
            }                                         // (Both are IVariableScopes.)

            node.Symbol.Declaration = node;
            node.Scope = scope;

            EnterScope(scope);
        }