001 /* 002 * Copyright 2010-2013 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.jet.lang.cfg; 018 019 import org.jetbrains.annotations.NotNull; 020 import org.jetbrains.annotations.Nullable; 021 import org.jetbrains.jet.lang.cfg.pseudocode.Pseudocode; 022 import org.jetbrains.jet.lang.descriptors.ReceiverParameterDescriptor; 023 import org.jetbrains.jet.lang.descriptors.VariableDescriptor; 024 import org.jetbrains.jet.lang.psi.*; 025 import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall; 026 import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant; 027 028 import java.util.List; 029 030 public abstract class JetControlFlowBuilderAdapter implements JetControlFlowBuilder { 031 032 @NotNull 033 protected abstract JetControlFlowBuilder getDelegateBuilder(); 034 035 @Override 036 public void loadUnit(@NotNull JetExpression expression) { 037 getDelegateBuilder().loadUnit(expression); 038 } 039 040 @Override 041 public void loadConstant(@NotNull JetExpression expression, @Nullable CompileTimeConstant<?> constant) { 042 getDelegateBuilder().loadConstant(expression, constant); 043 } 044 045 @Override 046 public void createAnonymousObject(@NotNull JetObjectLiteralExpression expression) { 047 getDelegateBuilder().createAnonymousObject(expression); 048 } 049 050 @Override 051 public void createFunctionLiteral(@NotNull JetFunctionLiteralExpression expression) { 052 getDelegateBuilder().createFunctionLiteral(expression); 053 } 054 055 @Override 056 public void loadStringTemplate(@NotNull JetStringTemplateExpression expression) { 057 getDelegateBuilder().loadStringTemplate(expression); 058 } 059 060 @Override 061 public void readThis(@NotNull JetExpression expression, @Nullable ReceiverParameterDescriptor parameterDescriptor) { 062 getDelegateBuilder().readThis(expression, parameterDescriptor); 063 } 064 065 @Override 066 public void readVariable(@NotNull JetExpression expression, @Nullable VariableDescriptor variableDescriptor) { 067 getDelegateBuilder().readVariable(expression, variableDescriptor); 068 } 069 070 @Override 071 public void call(@NotNull JetExpression expression, @NotNull ResolvedCall<?> resolvedCall) { 072 getDelegateBuilder().call(expression, resolvedCall); 073 } 074 075 @Override 076 public void predefinedOperation(@NotNull JetExpression expression, @Nullable PredefinedOperation operation) { 077 getDelegateBuilder().predefinedOperation(expression, operation); 078 } 079 080 @Override 081 public void compilationError(@NotNull JetElement element, @NotNull String message) { 082 getDelegateBuilder().compilationError(element, message); 083 } 084 085 @Override 086 @NotNull 087 public Label createUnboundLabel() { 088 return getDelegateBuilder().createUnboundLabel(); 089 } 090 091 @NotNull 092 @Override 093 public Label createUnboundLabel(@NotNull String name) { 094 return getDelegateBuilder().createUnboundLabel(name); 095 } 096 097 @Override 098 public void bindLabel(@NotNull Label label) { 099 getDelegateBuilder().bindLabel(label); 100 } 101 102 @Override 103 public void jump(@NotNull Label label) { 104 getDelegateBuilder().jump(label); 105 } 106 107 @Override 108 public void jumpOnFalse(@NotNull Label label) { 109 getDelegateBuilder().jumpOnFalse(label); 110 } 111 112 @Override 113 public void jumpOnTrue(@NotNull Label label) { 114 getDelegateBuilder().jumpOnTrue(label); 115 } 116 117 @Override 118 public void nondeterministicJump(@NotNull Label label) { 119 getDelegateBuilder().nondeterministicJump(label); 120 } 121 122 @Override 123 public void nondeterministicJump(@NotNull List<Label> labels) { 124 getDelegateBuilder().nondeterministicJump(labels); 125 } 126 127 @Override 128 public void jumpToError() { 129 getDelegateBuilder().jumpToError(); 130 } 131 132 @Override 133 public void throwException(@NotNull JetThrowExpression throwExpression) { 134 getDelegateBuilder().throwException(throwExpression); 135 } 136 137 @Override 138 @NotNull 139 public Label getEntryPoint(@NotNull JetElement labelElement) { 140 return getDelegateBuilder().getEntryPoint(labelElement); 141 } 142 143 @NotNull 144 @Override 145 public Label getExitPoint(@NotNull JetElement labelElement) { 146 return getDelegateBuilder().getExitPoint(labelElement); 147 } 148 149 @Override 150 public LoopInfo enterLoop(@NotNull JetExpression expression, @Nullable Label loopExitPoint, Label conditionEntryPoint) { 151 return getDelegateBuilder().enterLoop(expression, loopExitPoint, conditionEntryPoint); 152 } 153 154 @Override 155 public void exitLoop(@NotNull JetExpression expression) { 156 getDelegateBuilder().exitLoop(expression); 157 } 158 159 @Override 160 @Nullable 161 public JetElement getCurrentLoop() { 162 return getDelegateBuilder().getCurrentLoop(); 163 } 164 165 @Override 166 public void enterTryFinally(@NotNull GenerationTrigger trigger) { 167 getDelegateBuilder().enterTryFinally(trigger); 168 } 169 170 @Override 171 public void exitTryFinally() { 172 getDelegateBuilder().exitTryFinally(); 173 } 174 175 @Override 176 public void enterSubroutine(@NotNull JetElement subroutine) { 177 getDelegateBuilder().enterSubroutine(subroutine); 178 } 179 180 @NotNull 181 @Override 182 public Pseudocode exitSubroutine(@NotNull JetElement subroutine) { 183 return getDelegateBuilder().exitSubroutine(subroutine); 184 } 185 186 @NotNull 187 @Override 188 public JetElement getCurrentSubroutine() { 189 return getDelegateBuilder().getCurrentSubroutine(); 190 } 191 192 @Override 193 @Nullable 194 public JetElement getReturnSubroutine() { 195 return getDelegateBuilder().getReturnSubroutine(); 196 } 197 198 @Override 199 public void returnValue(@NotNull JetExpression returnExpression, @NotNull JetElement subroutine) { 200 getDelegateBuilder().returnValue(returnExpression, subroutine); 201 } 202 203 @Override 204 public void returnNoValue(@NotNull JetElement returnExpression, @NotNull JetElement subroutine) { 205 getDelegateBuilder().returnNoValue(returnExpression, subroutine); 206 } 207 208 @Override 209 public void unsupported(JetElement element) { 210 getDelegateBuilder().unsupported(element); 211 } 212 213 @Override 214 public void write(@NotNull JetElement assignment, @NotNull JetElement lValue) { 215 getDelegateBuilder().write(assignment, lValue); 216 } 217 218 @Override 219 public void declareParameter(@NotNull JetParameter parameter) { 220 getDelegateBuilder().declareParameter(parameter); 221 } 222 223 @Override 224 public void declareVariable(@NotNull JetVariableDeclaration property) { 225 getDelegateBuilder().declareVariable(property); 226 } 227 228 @Override 229 public void declareFunction(@NotNull JetElement subroutine, @NotNull Pseudocode pseudocode) { 230 getDelegateBuilder().declareFunction(subroutine, pseudocode); 231 } 232 233 @Override 234 public void repeatPseudocode(@NotNull Label startLabel, @NotNull Label finishLabel) { 235 getDelegateBuilder().repeatPseudocode(startLabel, finishLabel); 236 } 237 238 @Override 239 public void mark(@NotNull JetElement element) { 240 getDelegateBuilder().mark(element); 241 } 242 243 @Override 244 public void enterLexicalScope(@NotNull JetElement element) { 245 getDelegateBuilder().enterLexicalScope(element); 246 } 247 248 @Override 249 public void exitLexicalScope(@NotNull JetElement element) { 250 getDelegateBuilder().exitLexicalScope(element); 251 } 252 }