001 /*
002 * Copyright 2010-2015 JetBrains s.r.o.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017 package org.jetbrains.kotlin.cfg;
018
019 import org.jetbrains.kotlin.psi.JetLoopExpression;
020
021 public class LoopInfo extends BreakableBlockInfo {
022 private final Label bodyEntryPoint;
023 private final Label bodyExitPoint;
024 private final Label conditionEntryPoint;
025
026 public LoopInfo(
027 JetLoopExpression loopExpression,
028 Label entryPoint,
029 Label exitPoint,
030 Label bodyEntryPoint,
031 Label bodyExitPoint,
032 Label conditionEntryPoint
033 ) {
034 super(loopExpression, entryPoint, exitPoint);
035 this.bodyEntryPoint = bodyEntryPoint;
036 this.bodyExitPoint = bodyExitPoint;
037 this.conditionEntryPoint = conditionEntryPoint;
038 markReferablePoints(bodyEntryPoint, bodyExitPoint, conditionEntryPoint);
039 }
040
041 @Override
042 public JetLoopExpression getElement() {
043 return (JetLoopExpression) super.getElement();
044 }
045
046 public Label getBodyEntryPoint() {
047 return bodyEntryPoint;
048 }
049
050 public Label getBodyExitPoint() {
051 return bodyExitPoint;
052 }
053
054 public Label getConditionEntryPoint() {
055 return conditionEntryPoint;
056 }
057 }