Example #1
0
 private HashSet/*<Block>*/ filter_blocks (Method method, NormalFlowBlockNavigator nfbnav) {
   HashSet/*<Block>*/ blocksToKill = new HashSet();
   /* We no longer remove the filter blocks.
   ExceptionHandlerList ehs = method.ExceptionHandlers;
   for (int i=0; i<ehs.Length; i++)
     if (ehs[i].HandlerType == NodeType.Filter)
       add_block_plus_succ_to_set(blocksToKill, ehs[i].FilterExpression, nfbnav);
   */
   return blocksToKill;
 }
Example #2
0
        //=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="output">The text writer to which the output is written</param>
        /// <param name="namer">The API namer to use</param>
        /// <param name="resolver">The assembly resolver to use</param>
        /// <param name="filter">The API filter to use</param>
        public ManagedReflectionWriter(TextWriter output, ApiNamer namer, AssemblyResolver resolver,
          ApiFilter filter) : base(resolver, filter)
        {
            assemblyNames = new HashSet<string>();
            descendantIndex = new Dictionary<TypeNode, List<TypeNode>>();
            implementorIndex = new Dictionary<Interface, List<TypeNode>>();

            parsedNamespaces = new List<Namespace>();
            parsedTypes = new List<TypeNode>();
            parsedMembers = new List<Member>();

            startTagCallbacks = new Dictionary<string, List<MRefBuilderCallback>>();
            endTagCallbacks = new Dictionary<string, List<MRefBuilderCallback>>();

            XmlWriterSettings settings = new XmlWriterSettings();
            settings.Indent = true;
            writer = XmlWriter.Create(output, settings);

            this.namer = namer;
        }
Example #3
0
    // build the array all_blocks: the original blocks + the block clones (if any) + special blocks
    private void BuildAllBlockCollection (
      Method method, 
      IList/*<CfgBlock>*/ new_blocks, 
      ISet/*<CfgBlock>*/ filterblocks,
      NormalFlowBlockNavigator nfnav
      ) {
      IMutableSet reach = new HashSet();
      FindReachable(reach, (CfgBlock)method.Body.Statements[0], nfnav);

      int nb_blocks = reach.Count + 2; // entry and exit
      if (!reach.Contains(this.normal_exit_point)) {
        nb_blocks++;
      }
      if (!reach.Contains(this.excp_exit_point)) {
        nb_blocks++;
      }

      CfgBlock[] all_blocks;
      this.all_blocks = all_blocks = new CfgBlock[nb_blocks];

      int index = 0;

      AddBlock(this.entry_point, all_blocks, ref index);

      foreach (CfgBlock block in reach) {
        AddBlock(block, all_blocks, ref index);
      }

#if false
      int nb_blocks = method.Body.Statements.Count - filterblocks.Count + 4;

      nb_blocks += new_blocks.Count;

      CfgBlock[] all_blocks;
      this.all_blocks = all_blocks = new CfgBlock[nb_blocks];
      StatementList blocks = method.Body.Statements;
      int index = 0;

      AddBlock(this.entry_point, all_blocks, ref index);
      for(int i = 0 ; i < blocks.Count; i++) {
        if ( ! filterblocks.Contains(blocks[i])) {
          AddBlock((CfgBlock)blocks[i], all_blocks, ref index);
        }
      }
      if (new_blocks != null) {
        // adding the block clones to all_blocks
        foreach(CfgBlock block in new_blocks) {
          AddBlock(block, all_blocks, ref index);
        }
      }
#endif

      // adding the three special blocks
      if (!reach.Contains(this.normal_exit_point)) {
        AddBlock(this.normal_exit_point, all_blocks, ref index);
      }
      if (!reach.Contains(this.excp_exit_point)) {
        AddBlock(this.excp_exit_point, all_blocks, ref index);
      }
      AddBlock(this.exit_point, all_blocks, ref index);
    }