/*******************************************************************************
* Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
package org.jacoco.core.internal.analysis;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.jacoco.core.analysis.ISourceNode;
import org.jacoco.core.internal.flow.LabelInfo;
import org.objectweb.asm.Label;
import org.objectweb.asm.tree.AbstractInsnNode;
/**
* Stateful builder for the {@link Instruction}s of a method. All instructions
* of a method must be added in their original sequence along with additional
* information like line numbers. Afterwards the instructions can be obtained
* with the getInstructions() method.
*/
class InstructionsBuilder {
/** Probe array of the class the analyzed method belongs to. */
private final boolean[] probes;
/** The line which belong to subsequently added instructions. */
private int currentLine;
/** The last instruction which has been added. */
private Instruction currentInsn;
/**
* All instructions of a method mapped from the ASM node to the
* corresponding {@link Instruction} instance.
*/
private final Map instructions;
/**
* The labels which mark the subsequent instructions.
*
* Due to ASM issue #315745 there can be more than one label per instruction
*/
private final List