protected override Void handleTry(TryStatementNode tryStatement, Void source)
 {
     handleStatement(tryStatement.Block, source);
     foreach (var node in tryStatement.CatchClauses)
     {
         try {
             context.MemberResolver.enterScope();
             if (node.ExceptionType != null)
             {
                 var etype = CompilerHelper.resolveTypeReference(context, context.CurrentType.PackageName, node.ExceptionType);
                 node.addOrReplaceUserData(etype);
                 if (etype.IsGenericParameter)
                 {
                     throw context.error(CompileErrorId.GenericParameterInCatch, node.ExceptionType,
                                         BytecodeHelper.getDisplayName(etype));
                 }
                 if (!context.TypeSystem.getType("java/lang/Throwable").isAssignableFrom(etype))
                 {
                     throw context.error(CompileErrorId.NoImplicitConversion, node.ExceptionType,
                                         BytecodeHelper.getDisplayName(etype), "java.lang.Throwable");
                 }
                 if (node.NameLength > 0)
                 {
                     var local = context.MemberResolver.defineLocal(context.getIdentifier(node.NameOffset, node.NameLength),
                                                                    etype, context.CodeValidationContext.CurrentMethod);
                     node.addOrReplaceUserData(local);
                 }
             }
             foreach (var s in node.Block.Statements)
             {
                 handleStatement(s, source);
             }
         } finally {
             context.MemberResolver.leaveScope();
         }
     }
     if (tryStatement.Finally != null)
     {
         handleStatement(tryStatement.Finally, source);
     }
     return(null);
 }
 protected override Void handleLocalDeclaration(LocalDeclarationStatementNode localDeclaration, Void source)
 {
     if (localDeclaration.Type == null)
     {
         if (localDeclaration.Declarators.size() > 1)
         {
             context.addError(CompileErrorId.MultipleImplicitVariableDeclarators, localDeclaration);
         }
         var decl = localDeclaration.Declarators[0];
         if (decl.Value == null)
         {
             throw context.error(CompileErrorId.MissingImplicitVariableInitializer, localDeclaration);
         }
         if (decl.Value.ExpressionKind == ExpressionKind.ArrayInitializer)
         {
             throw context.error(CompileErrorId.ImplicitVariableWithArrayInitializer, localDeclaration);
         }
         this.ExpressionValidator.handleExpression(decl.Value, null, true);
         var info = decl.Value.getUserData(typeof(ExpressionInfo));
         if (info == null)
         {
             throw context.error(CompileErrorId.NullImplicitVariableInitializer, localDeclaration);
         }
         localDeclaration.addOrReplaceUserData(new ExpressionInfo(ValidationHelper.getType(context, decl.Value)));
         var name = context.getIdentifier(decl.NameOffset, decl.NameLength);
         if (context.MemberResolver.hasLocal(name))
         {
             context.addError(CompileErrorId.VariableRedefinition, decl, name);
         }
         var local = context.MemberResolver.defineLocal(name, ValidationHelper.getVariableType(context, info.Type),
                                                        context.CodeValidationContext.CurrentMethod);
         decl.addOrReplaceUserData(local);
     }
     else
     {
         var type = CompilerHelper.resolveTypeReference(context, context.CurrentType.PackageName, localDeclaration.Type);
         localDeclaration.addOrReplaceUserData(new ExpressionInfo(type));
         foreach (var decl in localDeclaration.Declarators)
         {
             var name = context.getIdentifier(decl.NameOffset, decl.NameLength);
             if (decl.Value != null)
             {
                 var isArrayInit = decl.Value.ExpressionKind == ExpressionKind.ArrayInitializer;
                 if (isArrayInit && !type.IsArray)
                 {
                     throw context.error(CompileErrorId.ArrayTypeExpected, decl);
                 }
                 this.ExpressionValidator.handleExpression(decl.Value, type, true);
                 ValidationHelper.setBoxing(context, type, decl.Value);
                 if (!ValidationHelper.isAssignable(context, type, decl.Value))
                 {
                     var vinfo = decl.Value.getUserData(typeof(ExpressionInfo));
                     var vtype = (vinfo == null) ? null : vinfo.Type;
                     context.addError(CompileErrorId.NoImplicitConversion, decl.Value,
                                      BytecodeHelper.getDisplayName(vtype),
                                      BytecodeHelper.getDisplayName(type));
                 }
                 if (isArrayInit)
                 {
                     ValidationHelper.setArrayInitializerTypes((ArrayInitializerExpressionNode)decl.Value, type);
                 }
             }
             if (context.MemberResolver.hasLocal(name))
             {
                 context.addError(CompileErrorId.VariableRedefinition, decl, name);
             }
             var local = context.MemberResolver.defineLocal(name, ValidationHelper.getVariableType(context, type),
                                                            context.CodeValidationContext.CurrentMethod);
             decl.addOrReplaceUserData(local);
         }
     }
     return(null);
 }