protected override Boolean handleTry(TryStatementNode tryStatement, HashSet <StatementNode> visited)
        {
            var stmtRes    = handleStatement(tryStatement.Block, visited);
            var isAssigned = tryStatement.Block.getUserData(typeof(StatementInfo)).IsEndPointReachable&& !stmtRes;

            foreach (var node in tryStatement.CatchClauses)
            {
                var stmts = node.Block.Statements;
                if (stmts.size() > 0)
                {
                    isAssigned = isAssigned && !visitStatement(stmts[0], visited) ||
                                 !stmts[stmts.size() - 1].getUserData(typeof(StatementInfo)).IsEndPointReachable;
                }
                else
                {
                    isAssigned = false;
                }
            }
            if (tryStatement.Finally != null)
            {
                stmtRes = handleStatement(tryStatement.Finally, visited);
                if (!isAssigned)
                {
                    isAssigned = tryStatement.Finally.getUserData(typeof(StatementInfo)).IsEndPointReachable&& stmtRes;
                }
            }
            return((isAssigned) ? Boolean.FALSE : Boolean.TRUE);
        }
Пример #2
0
 protected override Void handleTry(TryStatementNode tryStatement, Set <TypeInfo> dependencies)
 {
     handleBlock(tryStatement.Block, dependencies);
     foreach (var cc in tryStatement.CatchClauses)
     {
         if (cc.ExceptionType != null)
         {
             addDependencies(cc.getUserData(typeof(TypeInfo)), dependencies);
         }
         handleBlock(cc.Block, dependencies);
     }
     if (tryStatement.Finally != null)
     {
         handleBlock(tryStatement.Finally, dependencies);
     }
     return(null);
 }
 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);
 }
 public virtual Value evaluate(Context cx, TryStatementNode node)
 {
     output("<TryStatementNode position=\"" + node.pos() + "\">");
     indent_Renamed_Field++;
     if (node.tryblock != null)
     {
         node.tryblock.evaluate(cx, this);
     }
     if (node.catchlist != null)
     {
         node.catchlist.evaluate(cx, this);
     }
     if (node.finallyblock != null)
     {
         node.finallyblock.evaluate(cx, this);
     }
     indent_Renamed_Field--;
     output("</TryStatementNode>");
     return(null);
 }
Пример #5
0
 private static void Walk([NotNull] Agent agent, [NotNull] TryStatementNode tryStatement, bool isStrict)
 {
     //TODO
 }
		public virtual Value evaluate(Context cx, TryStatementNode node)
		{
			output("<TryStatementNode position=\"" + node.pos() + "\">");
			indent_Renamed_Field++;
			if (node.tryblock != null)
			{
				node.tryblock.evaluate(cx, this);
			}
			if (node.catchlist != null)
			{
				node.catchlist.evaluate(cx, this);
			}
			if (node.finallyblock != null)
			{
				node.finallyblock.evaluate(cx, this);
			}
			indent_Renamed_Field--;
			output("</TryStatementNode>");
			return null;
		}
Пример #7
0
 internal override void Visit(TryStatementNode node)
 {
 }