BindingTrace & Context refactored to heterogeneous containers
This commit is contained in:
@@ -29,6 +29,7 @@ public interface JetNodeTypes {
|
||||
JetNodeType DELEGATOR_BY = new JetNodeType("DELEGATOR_BY", JetDelegatorByExpressionSpecifier.class);
|
||||
JetNodeType DELEGATOR_SUPER_CALL = new JetNodeType("DELEGATOR_SUPER_CALL", JetDelegatorToSuperCall.class);
|
||||
JetNodeType DELEGATOR_SUPER_CLASS = new JetNodeType("DELEGATOR_SUPER_CLASS", JetDelegatorToSuperClass.class);
|
||||
JetNodeType CONSTRUCTOR_CALLEE = new JetNodeType("CONSTRUCTOR_CALLEE", JetConstructorCalleeExpression.class);
|
||||
JetNodeType VALUE_PARAMETER_LIST = new JetNodeType("VALUE_PARAMETER_LIST", JetParameterList.class);
|
||||
JetNodeType VALUE_PARAMETER = new JetNodeType("VALUE_PARAMETER", JetParameter.class);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.jetbrains.jet.codegen;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
@@ -29,7 +30,7 @@ public abstract class ClassBodyCodegen {
|
||||
|
||||
public ClassBodyCodegen(JetClassOrObject aClass, ClassContext context, ClassVisitor v, GenerationState state) {
|
||||
this.state = state;
|
||||
descriptor = state.getBindingContext().getClassDescriptor(aClass);
|
||||
descriptor = state.getBindingContext().get(BindingContext.CLASS, aClass);
|
||||
myClass = aClass;
|
||||
this.context = context;
|
||||
this.kind = context.getContextKind();
|
||||
@@ -81,14 +82,14 @@ public abstract class ClassBodyCodegen {
|
||||
OwnerKind kind = context.getContextKind();
|
||||
for (JetParameter p : getPrimaryConstructorParameters()) {
|
||||
if (p.getValOrVarNode() != null) {
|
||||
PropertyDescriptor propertyDescriptor = state.getBindingContext().getPropertyDescriptor(p);
|
||||
PropertyDescriptor propertyDescriptor = state.getBindingContext().get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, p);
|
||||
if (propertyDescriptor != null) {
|
||||
propertyCodegen.generateDefaultGetter(propertyDescriptor, Opcodes.ACC_PUBLIC);
|
||||
if (propertyDescriptor.isVar()) {
|
||||
propertyCodegen.generateDefaultSetter(propertyDescriptor, Opcodes.ACC_PUBLIC);
|
||||
}
|
||||
|
||||
if (!(kind instanceof OwnerKind.DelegateKind) && kind != OwnerKind.INTERFACE && state.getBindingContext().hasBackingField(propertyDescriptor)) {
|
||||
if (!(kind instanceof OwnerKind.DelegateKind) && kind != OwnerKind.INTERFACE && state.getBindingContext().get(BindingContext.BACKING_FIELD_REQUIRED, propertyDescriptor)) {
|
||||
v.visitField(Opcodes.ACC_PRIVATE, p.getName(), state.getTypeMapper().mapType(propertyDescriptor.getOutType()).getDescriptor(), null, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.jetbrains.jet.codegen;
|
||||
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.commons.InstructionAdapter;
|
||||
@@ -30,7 +31,7 @@ public class ClassCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
ClassDescriptor descriptor = state.getBindingContext().getClassDescriptor(aClass);
|
||||
ClassDescriptor descriptor = state.getBindingContext().get(BindingContext.CLASS, aClass);
|
||||
final ClassContext contextForInners = parentContext.intoClass(descriptor, OwnerKind.IMPLEMENTATION);
|
||||
for (JetDeclaration declaration : aClass.getDeclarations()) {
|
||||
if (declaration instanceof JetClass && !(declaration instanceof JetEnumEntry)) {
|
||||
@@ -40,13 +41,13 @@ public class ClassCodegen {
|
||||
}
|
||||
|
||||
private void generateInterface(ClassContext parentContext, JetClassOrObject aClass) {
|
||||
ClassDescriptor descriptor = state.getBindingContext().getClassDescriptor(aClass);
|
||||
ClassDescriptor descriptor = state.getBindingContext().get(BindingContext.CLASS, aClass);
|
||||
final ClassVisitor visitor = state.forClassInterface(descriptor);
|
||||
new InterfaceBodyCodegen(aClass, parentContext.intoClass(descriptor, OwnerKind.INTERFACE), visitor, state).generate();
|
||||
}
|
||||
|
||||
private void generateImplementation(ClassContext parentContext, JetClassOrObject aClass, OwnerKind kind) {
|
||||
ClassDescriptor descriptor = state.getBindingContext().getClassDescriptor(aClass);
|
||||
ClassDescriptor descriptor = state.getBindingContext().get(BindingContext.CLASS, aClass);
|
||||
ClassVisitor v = kind == OwnerKind.IMPLEMENTATION
|
||||
? state.forClassImplementation(descriptor)
|
||||
: state.forClassDelegatingImplementation(descriptor);
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.VariableDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetFunctionLiteral;
|
||||
import org.jetbrains.jet.lang.psi.JetFunctionLiteralExpression;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
@@ -83,7 +84,7 @@ public class ClosureCodegen {
|
||||
public GeneratedAnonymousClassDescriptor gen(JetFunctionLiteralExpression fun) {
|
||||
final Pair<String, ClassVisitor> nameAndVisitor = state.forAnonymousSubclass(fun);
|
||||
|
||||
final FunctionDescriptor funDescriptor = (FunctionDescriptor) state.getBindingContext().getDeclarationDescriptor(fun);
|
||||
final FunctionDescriptor funDescriptor = (FunctionDescriptor) state.getBindingContext().get(BindingContext.DECLARATION_TO_DESCRIPTOR, fun);
|
||||
|
||||
cv = nameAndVisitor.getSecond();
|
||||
name = nameAndVisitor.getFirst();
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.jetbrains.jet.codegen.intrinsics.IntrinsicMethods;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContextUtils;
|
||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.jet.lang.types.JetStandardClasses;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
@@ -166,7 +167,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
|
||||
@Override
|
||||
public void visitIfExpression(JetIfExpression expression) {
|
||||
JetType expressionType = bindingContext.getExpressionType(expression);
|
||||
JetType expressionType = bindingContext.get(BindingContext.EXPRESSION_TYPE, expression);
|
||||
Type asmType = typeMapper.mapType(expressionType);
|
||||
StackValue condition = generateIntermediateValue(expression.getCondition());
|
||||
|
||||
@@ -248,14 +249,14 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
@Override
|
||||
public void visitForExpression(JetForExpression expression) {
|
||||
final JetExpression loopRange = expression.getLoopRange();
|
||||
final JetType expressionType = bindingContext.getExpressionType(loopRange);
|
||||
final JetType expressionType = bindingContext.get(BindingContext.EXPRESSION_TYPE, loopRange);
|
||||
Type loopRangeType = typeMapper.mapType(expressionType);
|
||||
if (loopRangeType.getSort() == Type.ARRAY) {
|
||||
new ForInArrayLoopGenerator(expression, loopRangeType).invoke();
|
||||
}
|
||||
else {
|
||||
final DeclarationDescriptor descriptor = expressionType.getConstructor().getDeclarationDescriptor();
|
||||
final PsiElement declaration = bindingContext.getDeclarationPsiElement(descriptor);
|
||||
final PsiElement declaration = bindingContext.get(BindingContext.DESCRIPTOR_TO_DECLARATION, descriptor);
|
||||
if (declaration instanceof PsiClass) {
|
||||
final Project project = declaration.getProject();
|
||||
final PsiClass iterable = JavaPsiFacade.getInstance(project).findClass("java.lang.Iterable", ProjectScope.getAllScope(project));
|
||||
@@ -274,7 +275,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
|
||||
private void generateForInIterable(JetForExpression expression, Type loopRangeType) {
|
||||
final JetParameter loopParameter = expression.getLoopParameter();
|
||||
final VariableDescriptor parameterDescriptor = bindingContext.getVariableDescriptor(loopParameter);
|
||||
final VariableDescriptor parameterDescriptor = bindingContext.get(BindingContext.VALUE_PARAMETER, loopParameter);
|
||||
JetType paramType = parameterDescriptor.getOutType();
|
||||
Type asmParamType = typeMapper.mapType(paramType);
|
||||
|
||||
@@ -335,7 +336,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
this.expression = expression;
|
||||
this.loopRangeType = loopRangeType;
|
||||
final JetParameter loopParameter = expression.getLoopParameter();
|
||||
this.parameterDescriptor = bindingContext.getVariableDescriptor(loopParameter);
|
||||
this.parameterDescriptor = bindingContext.get(BindingContext.VALUE_PARAMETER, loopParameter);
|
||||
}
|
||||
|
||||
public void invoke() {
|
||||
@@ -490,7 +491,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
|
||||
@Override
|
||||
public void visitConstantExpression(JetConstantExpression expression) {
|
||||
CompileTimeConstant<?> compileTimeValue = bindingContext.getCompileTimeValue(expression);
|
||||
CompileTimeConstant<?> compileTimeValue = bindingContext.get(BindingContext.COMPILE_TIME_VALUE, expression);
|
||||
assert compileTimeValue != null;
|
||||
myStack.push(StackValue.constant(compileTimeValue.getValue(), expressionType(expression)));
|
||||
}
|
||||
@@ -541,7 +542,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
|
||||
@Override
|
||||
public void visitFunctionLiteralExpression(JetFunctionLiteralExpression expression) {
|
||||
if (bindingContext.isBlock(expression)) {
|
||||
if ((boolean) bindingContext.get(BindingContext.BLOCK, expression)) {
|
||||
generateBlock(expression.getFunctionLiteral().getBodyExpression().getStatements());
|
||||
}
|
||||
else {
|
||||
@@ -579,7 +580,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
|
||||
for (JetElement statement : statements) {
|
||||
if (statement instanceof JetProperty) {
|
||||
final VariableDescriptor variableDescriptor = bindingContext.getVariableDescriptor((JetProperty) statement);
|
||||
final VariableDescriptor variableDescriptor = bindingContext.get(BindingContext.VARIABLE, (JetProperty) statement);
|
||||
final Type type = typeMapper.mapType(variableDescriptor.getOutType());
|
||||
myMap.enter(variableDescriptor, type.getSize());
|
||||
}
|
||||
@@ -601,7 +602,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
for (JetElement statement : statements) {
|
||||
if (statement instanceof JetProperty) {
|
||||
JetProperty var = (JetProperty) statement;
|
||||
VariableDescriptor variableDescriptor = bindingContext.getVariableDescriptor(var);
|
||||
VariableDescriptor variableDescriptor = bindingContext.get(BindingContext.VARIABLE, var);
|
||||
Type outType = typeMapper.mapType(variableDescriptor.getOutType());
|
||||
|
||||
int index = myMap.leave(variableDescriptor);
|
||||
@@ -646,7 +647,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
|
||||
@Override
|
||||
public void visitSimpleNameExpression(JetSimpleNameExpression expression) {
|
||||
DeclarationDescriptor descriptor = bindingContext.resolveReferenceExpression(expression);
|
||||
DeclarationDescriptor descriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, expression);
|
||||
if (descriptor instanceof NamespaceDescriptor) return; // No code to generate
|
||||
|
||||
if (descriptor instanceof VariableAsFunctionDescriptor) {
|
||||
@@ -662,7 +663,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
|
||||
final DeclarationDescriptor container = descriptor.getContainingDeclaration();
|
||||
|
||||
PsiElement declaration = bindingContext.getDeclarationPsiElement(descriptor);
|
||||
PsiElement declaration = bindingContext.get(BindingContext.DESCRIPTOR_TO_DECLARATION, descriptor);
|
||||
if (declaration instanceof PsiField) {
|
||||
PsiField psiField = (PsiField) declaration;
|
||||
final String owner = JetTypeMapper.jvmName(psiField.getContainingClass());
|
||||
@@ -686,7 +687,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
if (declaration instanceof JetParameter) {
|
||||
if (PsiTreeUtil.getParentOfType(expression, JetDelegationSpecifier.class) != null) {
|
||||
JetClass aClass = PsiTreeUtil.getParentOfType(expression, JetClass.class);
|
||||
ConstructorDescriptor constructorDescriptor = bindingContext.getConstructorDescriptor(aClass);
|
||||
ConstructorDescriptor constructorDescriptor = bindingContext.get(BindingContext.CONSTRUCTOR, aClass);
|
||||
List<ValueParameterDescriptor> parameters = constructorDescriptor.getValueParameters();
|
||||
for (ValueParameterDescriptor parameter : parameters) {
|
||||
if (parameter.getName().equals(descriptor.getName())) {
|
||||
@@ -700,7 +701,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
|
||||
if (declaration instanceof JetObjectDeclarationName) {
|
||||
JetObjectDeclaration objectDeclaration = PsiTreeUtil.getParentOfType(declaration, JetObjectDeclaration.class);
|
||||
ClassDescriptor classDescriptor = bindingContext.getClassDescriptor(objectDeclaration);
|
||||
ClassDescriptor classDescriptor = bindingContext.get(BindingContext.CLASS, objectDeclaration);
|
||||
myStack.push(StackValue.field(typeMapper.jvmType(classDescriptor, OwnerKind.IMPLEMENTATION),
|
||||
typeMapper.jvmName(classDescriptor, OwnerKind.IMPLEMENTATION),
|
||||
"$instance",
|
||||
@@ -840,7 +841,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
if (intrinsic != null) {
|
||||
return intrinsic;
|
||||
}
|
||||
PsiElement declarationPsiElement = bindingContext.getDeclarationPsiElement(fd);
|
||||
PsiElement declarationPsiElement = bindingContext.get(BindingContext.DESCRIPTOR_TO_DECLARATION, fd);
|
||||
|
||||
CallableMethod callableMethod;
|
||||
if (declarationPsiElement instanceof PsiMethod || declarationPsiElement instanceof JetNamedFunction) {
|
||||
@@ -860,7 +861,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
if (!(callee instanceof JetSimpleNameExpression)) {
|
||||
throw new UnsupportedOperationException("Don't know how to generate a call to " + callee);
|
||||
}
|
||||
DeclarationDescriptor funDescriptor = bindingContext.resolveReferenceExpression((JetSimpleNameExpression) callee);
|
||||
DeclarationDescriptor funDescriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, (JetSimpleNameExpression) callee);
|
||||
if (funDescriptor == null) {
|
||||
throw new CompilationException("Cannot resolve: " + callee.getText());
|
||||
}
|
||||
@@ -892,9 +893,9 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
private void setOwnerFromCall(CallableMethod callableMethod, JetCall expression) {
|
||||
if (expression.getParent() instanceof JetQualifiedExpression) {
|
||||
final JetExpression receiver = ((JetQualifiedExpression) expression.getParent()).getReceiverExpression();
|
||||
JetType expressionType = bindingContext.getExpressionType(receiver);
|
||||
JetType expressionType = bindingContext.get(BindingContext.EXPRESSION_TYPE, receiver);
|
||||
DeclarationDescriptor declarationDescriptor = expressionType.getConstructor().getDeclarationDescriptor();
|
||||
PsiElement ownerDeclaration = bindingContext.getDeclarationPsiElement(declarationDescriptor);
|
||||
PsiElement ownerDeclaration = bindingContext.get(BindingContext.DESCRIPTOR_TO_DECLARATION, declarationDescriptor);
|
||||
if (ownerDeclaration instanceof PsiClass) {
|
||||
callableMethod.setOwner(typeMapper.mapType(expressionType).getInternalName());
|
||||
}
|
||||
@@ -1017,11 +1018,11 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
}
|
||||
|
||||
public Type expressionType(JetExpression expr) {
|
||||
return typeMapper.mapType(bindingContext.getExpressionType(expr));
|
||||
return typeMapper.mapType(bindingContext.get(BindingContext.EXPRESSION_TYPE, expr));
|
||||
}
|
||||
|
||||
public int indexOfLocal(JetReferenceExpression lhs) {
|
||||
final DeclarationDescriptor declarationDescriptor = bindingContext.resolveReferenceExpression(lhs);
|
||||
final DeclarationDescriptor declarationDescriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, lhs);
|
||||
return lookupLocal(declarationDescriptor);
|
||||
}
|
||||
|
||||
@@ -1036,8 +1037,8 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
|
||||
private boolean resolvesToClassOrPackage(JetExpression receiver) {
|
||||
if (receiver instanceof JetReferenceExpression) {
|
||||
DeclarationDescriptor declaration = bindingContext.resolveReferenceExpression((JetReferenceExpression) receiver);
|
||||
PsiElement declarationElement = bindingContext.getDeclarationPsiElement(declaration);
|
||||
DeclarationDescriptor declaration = bindingContext.get(BindingContext.REFERENCE_TARGET, (JetReferenceExpression) receiver);
|
||||
PsiElement declarationElement = bindingContext.get(BindingContext.DESCRIPTOR_TO_DECLARATION, declaration);
|
||||
if (declarationElement instanceof PsiClass) {
|
||||
return true;
|
||||
}
|
||||
@@ -1056,7 +1057,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
v.goTo(end);
|
||||
v.mark(ifnull);
|
||||
// null is already on stack here after the dup
|
||||
JetType expressionType = bindingContext.getExpressionType(expression);
|
||||
JetType expressionType = bindingContext.get(BindingContext.EXPRESSION_TYPE, expression);
|
||||
if (expressionType.equals(JetStandardClasses.getUnitType())) {
|
||||
v.pop();
|
||||
}
|
||||
@@ -1076,7 +1077,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
v.pop();
|
||||
v.aconst(null);
|
||||
v.mark(end);
|
||||
myStack.push(StackValue.onStack(typeMapper.mapType(bindingContext.getExpressionType(expression))));
|
||||
myStack.push(StackValue.onStack(typeMapper.mapType(bindingContext.get(BindingContext.EXPRESSION_TYPE, expression))));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1106,7 +1107,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
generateElvis(expression);
|
||||
}
|
||||
else {
|
||||
DeclarationDescriptor op = bindingContext.resolveReferenceExpression(expression.getOperationReference());
|
||||
DeclarationDescriptor op = bindingContext.get(BindingContext.REFERENCE_TARGET, expression.getOperationReference());
|
||||
final Callable callable = resolveToCallable(op);
|
||||
if (callable instanceof IntrinsicMethod) {
|
||||
IntrinsicMethod intrinsic = (IntrinsicMethod) callable;
|
||||
@@ -1264,11 +1265,11 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
}
|
||||
|
||||
private void generateAugmentedAssignment(JetBinaryExpression expression) {
|
||||
DeclarationDescriptor op = bindingContext.resolveReferenceExpression(expression.getOperationReference());
|
||||
DeclarationDescriptor op = bindingContext.get(BindingContext.REFERENCE_TARGET, expression.getOperationReference());
|
||||
final Callable callable = resolveToCallable(op);
|
||||
final JetExpression lhs = expression.getLeft();
|
||||
Type lhsType = expressionType(lhs);
|
||||
if (bindingContext.isVariableReassignment(expression)) {
|
||||
if ((boolean) bindingContext.get(BindingContext.VARIABLE_REASSIGNMENT, expression)) {
|
||||
if (callable instanceof IntrinsicMethod) {
|
||||
StackValue value = generateIntermediateValue(lhs); // receiver
|
||||
value.dupReceiver(v, 0); // receiver receiver
|
||||
@@ -1330,7 +1331,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
|
||||
@Override
|
||||
public void visitPrefixExpression(JetPrefixExpression expression) {
|
||||
DeclarationDescriptor op = bindingContext.resolveReferenceExpression(expression.getOperationSign());
|
||||
DeclarationDescriptor op = bindingContext.get(BindingContext.REFERENCE_TARGET, expression.getOperationSign());
|
||||
final Callable callable = resolveToCallable(op);
|
||||
if (callable instanceof IntrinsicMethod) {
|
||||
IntrinsicMethod intrinsic = (IntrinsicMethod) callable;
|
||||
@@ -1350,12 +1351,12 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
|
||||
@Override
|
||||
public void visitPostfixExpression(JetPostfixExpression expression) {
|
||||
DeclarationDescriptor op = bindingContext.resolveReferenceExpression(expression.getOperationSign());
|
||||
DeclarationDescriptor op = bindingContext.get(BindingContext.REFERENCE_TARGET, expression.getOperationSign());
|
||||
if (op instanceof FunctionDescriptor) {
|
||||
final Type asmType = expressionType(expression);
|
||||
DeclarationDescriptor cls = op.getContainingDeclaration();
|
||||
if (isNumberPrimitive(cls) && (op.getName().equals("inc") || op.getName().equals("dec"))) {
|
||||
if (bindingContext.isStatement(expression)) {
|
||||
if ((boolean) bindingContext.get(BindingContext.STATEMENT, expression)) {
|
||||
generateIncrement(op, asmType, expression.getBaseExpression());
|
||||
}
|
||||
else {
|
||||
@@ -1402,7 +1403,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
|
||||
@Override
|
||||
public void visitProperty(JetProperty property) {
|
||||
VariableDescriptor variableDescriptor = bindingContext.getVariableDescriptor(property);
|
||||
VariableDescriptor variableDescriptor = bindingContext.get(BindingContext.VARIABLE, property);
|
||||
int index = lookupLocal(variableDescriptor);
|
||||
|
||||
assert index >= 0;
|
||||
@@ -1416,14 +1417,14 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
}
|
||||
|
||||
private void generateConstructorCall(JetCallExpression expression, JetSimpleNameExpression constructorReference) {
|
||||
DeclarationDescriptor constructorDescriptor = bindingContext.resolveReferenceExpression(constructorReference);
|
||||
final PsiElement declaration = bindingContext.getDeclarationPsiElement(constructorDescriptor);
|
||||
DeclarationDescriptor constructorDescriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, constructorReference);
|
||||
final PsiElement declaration = bindingContext.get(BindingContext.DESCRIPTOR_TO_DECLARATION, constructorDescriptor);
|
||||
Type type;
|
||||
if (declaration instanceof PsiMethod) {
|
||||
type = generateJavaConstructorCall(expression, (PsiMethod) declaration);
|
||||
}
|
||||
else if (constructorDescriptor instanceof ConstructorDescriptor) {
|
||||
type = typeMapper.mapType(bindingContext.getExpressionType(expression), OwnerKind.IMPLEMENTATION);
|
||||
type = typeMapper.mapType(bindingContext.get(BindingContext.EXPRESSION_TYPE, expression), OwnerKind.IMPLEMENTATION);
|
||||
if (type.getSort() == Type.ARRAY) {
|
||||
generateNewArray(expression, type);
|
||||
}
|
||||
@@ -1453,7 +1454,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
}
|
||||
|
||||
public void pushTypeArgument(JetTypeProjection jetTypeArgument) {
|
||||
JetType typeArgument = bindingContext.resolveTypeReference(jetTypeArgument.getTypeReference());
|
||||
JetType typeArgument = bindingContext.get(BindingContext.TYPE, jetTypeArgument.getTypeReference());
|
||||
generateTypeInfo(typeArgument);
|
||||
}
|
||||
|
||||
@@ -1493,7 +1494,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
myStack.push(StackValue.arrayElement(elementType));
|
||||
}
|
||||
else {
|
||||
final PsiElement declaration = bindingContext.resolveToDeclarationPsiElement(expression);
|
||||
final PsiElement declaration = BindingContextUtils.resolveToDeclarationPsiElement(bindingContext, expression);
|
||||
final CallableMethod accessor;
|
||||
if (declaration instanceof PsiMethod) {
|
||||
accessor = JetTypeMapper.mapToCallableMethod((PsiMethod) declaration);
|
||||
@@ -1525,7 +1526,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
|
||||
@Override
|
||||
public void visitThisExpression(JetThisExpression expression) {
|
||||
final DeclarationDescriptor descriptor = bindingContext.resolveReferenceExpression(expression.getThisReference());
|
||||
final DeclarationDescriptor descriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, expression.getThisReference());
|
||||
if (descriptor instanceof ClassDescriptor) {
|
||||
myStack.push(generateThisOrOuter((ClassDescriptor) descriptor));
|
||||
}
|
||||
@@ -1560,7 +1561,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
Label clauseStart = new Label();
|
||||
v.mark(clauseStart);
|
||||
|
||||
VariableDescriptor descriptor = bindingContext.getVariableDescriptor(clause.getCatchParameter());
|
||||
VariableDescriptor descriptor = bindingContext.get(BindingContext.VALUE_PARAMETER, clause.getCatchParameter());
|
||||
Type descriptorType = typeMapper.mapType(descriptor.getOutType());
|
||||
myMap.enter(descriptor, 1);
|
||||
int index = lookupLocal(descriptor);
|
||||
@@ -1600,7 +1601,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
}
|
||||
else {
|
||||
JetTypeReference typeReference = expression.getRight();
|
||||
JetType jetType = bindingContext.resolveTypeReference(typeReference);
|
||||
JetType jetType = bindingContext.get(BindingContext.TYPE, typeReference);
|
||||
DeclarationDescriptor descriptor = jetType.getConstructor().getDeclarationDescriptor();
|
||||
if (!(descriptor instanceof ClassDescriptor)) {
|
||||
throw new UnsupportedOperationException("don't know how to handle non-class types in as/as?");
|
||||
@@ -1634,7 +1635,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
@Nullable Label nextEntry) {
|
||||
if (pattern instanceof JetTypePattern) {
|
||||
JetTypeReference typeReference = ((JetTypePattern) pattern).getTypeReference();
|
||||
JetType jetType = bindingContext.resolveTypeReference(typeReference);
|
||||
JetType jetType = bindingContext.get(BindingContext.TYPE, typeReference);
|
||||
expressionToMatch.dupReceiver(v, 0);
|
||||
generateInstanceOf(expressionToMatch, jetType, false);
|
||||
StackValue value = StackValue.onStack(Type.BOOLEAN_TYPE);
|
||||
@@ -1657,7 +1658,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
}
|
||||
else if (pattern instanceof JetBindingPattern) {
|
||||
final JetProperty var = ((JetBindingPattern) pattern).getVariableDeclaration();
|
||||
final VariableDescriptor variableDescriptor = bindingContext.getVariableDescriptor(var);
|
||||
final VariableDescriptor variableDescriptor = bindingContext.get(BindingContext.VARIABLE, var);
|
||||
final Type varType = typeMapper.mapType(variableDescriptor.getOutType());
|
||||
myMap.enter(variableDescriptor, varType.getSize());
|
||||
expressionToMatch.dupReceiver(v, 0);
|
||||
@@ -1867,7 +1868,7 @@ public class ExpressionCodegen extends JetVisitorVoid {
|
||||
conditionValue = invokeFunction((JetCallExpression) call, (FunctionDescriptor) declarationDescriptor, true);
|
||||
}
|
||||
else if (call instanceof JetSimpleNameExpression) {
|
||||
final DeclarationDescriptor descriptor = bindingContext.resolveReferenceExpression((JetSimpleNameExpression) call);
|
||||
final DeclarationDescriptor descriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, (JetSimpleNameExpression) call);
|
||||
if (descriptor instanceof PropertyDescriptor) {
|
||||
v.load(subjectLocal, subjectType);
|
||||
conditionValue = intermediateValueForProperty((PropertyDescriptor) descriptor, false, false);
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
@@ -31,7 +32,7 @@ public class FunctionCodegen {
|
||||
|
||||
public void gen(JetNamedFunction f) {
|
||||
Method method = state.getTypeMapper().mapToCallableMethod(f).getSignature();
|
||||
final FunctionDescriptor functionDescriptor = state.getBindingContext().getFunctionDescriptor(f);
|
||||
final FunctionDescriptor functionDescriptor = state.getBindingContext().get(BindingContext.FUNCTION, f);
|
||||
generateMethod(f, method, functionDescriptor);
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ public class GenerationState {
|
||||
public GeneratedAnonymousClassDescriptor generateObjectLiteral(JetObjectLiteralExpression literal, ExpressionCodegen context, ClassContext classContext) {
|
||||
Pair<String, ClassVisitor> nameAndVisitor = forAnonymousSubclass(literal.getObjectDeclaration());
|
||||
|
||||
final ClassContext objectContext = classContext.intoClass(getBindingContext().getClassDescriptor(literal.getObjectDeclaration()), OwnerKind.IMPLEMENTATION);
|
||||
final ClassContext objectContext = classContext.intoClass(getBindingContext().get(BindingContext.CLASS, literal.getObjectDeclaration()), OwnerKind.IMPLEMENTATION);
|
||||
|
||||
new ImplementationBodyCodegen(literal.getObjectDeclaration(), objectContext, nameAndVisitor.getSecond(), this).generate();
|
||||
return new GeneratedAnonymousClassDescriptor(nameAndVisitor.first, new Method("<init>", "()V"), false);
|
||||
@@ -122,4 +122,5 @@ public class GenerationState {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.lexer.JetTokens;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
@@ -61,9 +62,9 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
|
||||
JetDelegationSpecifier first = delegationSpecifiers.get(0);
|
||||
if (first instanceof JetDelegatorToSuperClass || first instanceof JetDelegatorToSuperCall) {
|
||||
JetType superType = state.getBindingContext().resolveTypeReference(first.getTypeReference());
|
||||
JetType superType = state.getBindingContext().get(BindingContext.TYPE, first.getTypeReference());
|
||||
ClassDescriptor superClassDescriptor = (ClassDescriptor) superType.getConstructor().getDeclarationDescriptor();
|
||||
final PsiElement declaration = state.getBindingContext().getDeclarationPsiElement(superClassDescriptor);
|
||||
final PsiElement declaration = state.getBindingContext().get(BindingContext.DESCRIPTOR_TO_DECLARATION, superClassDescriptor);
|
||||
if (declaration instanceof PsiClass && ((PsiClass) declaration).isInterface()) {
|
||||
return "java/lang/Object";
|
||||
}
|
||||
@@ -146,7 +147,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
}
|
||||
|
||||
protected void generatePrimaryConstructor() {
|
||||
ConstructorDescriptor constructorDescriptor = state.getBindingContext().getConstructorDescriptor((JetElement) myClass);
|
||||
ConstructorDescriptor constructorDescriptor = state.getBindingContext().get(BindingContext.CONSTRUCTOR, (JetElement) myClass);
|
||||
if (constructorDescriptor == null && !(myClass instanceof JetObjectDeclaration) && !isEnum(myClass)) return;
|
||||
|
||||
Method method;
|
||||
@@ -182,7 +183,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
// TODO correct calculation of super class
|
||||
String superClass = "java/lang/Object";
|
||||
if (!specifiers.isEmpty()) {
|
||||
final JetType superType = state.getBindingContext().resolveTypeReference(specifiers.get(0).getTypeReference());
|
||||
final JetType superType = state.getBindingContext().get(BindingContext.TYPE, specifiers.get(0).getTypeReference());
|
||||
ClassDescriptor superClassDescriptor = (ClassDescriptor) superType.getConstructor().getDeclarationDescriptor();
|
||||
if (superClassDescriptor.hasConstructors()) {
|
||||
superClass = getSuperClass();
|
||||
@@ -215,7 +216,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
HashSet<FunctionDescriptor> overridden = new HashSet<FunctionDescriptor>();
|
||||
for (JetDeclaration declaration : myClass.getDeclarations()) {
|
||||
if (declaration instanceof JetFunction) {
|
||||
overridden.addAll(state.getBindingContext().getFunctionDescriptor((JetNamedFunction) declaration).getOverriddenFunctions());
|
||||
overridden.addAll(state.getBindingContext().get(BindingContext.FUNCTION, (JetNamedFunction) declaration).getOverriddenFunctions());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +230,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
}
|
||||
|
||||
if (specifier instanceof JetDelegatorToSuperCall) {
|
||||
ConstructorDescriptor constructorDescriptor1 = state.getBindingContext().resolveSuperConstructor((JetDelegatorToSuperCall) specifier);
|
||||
ConstructorDescriptor constructorDescriptor1 = (ConstructorDescriptor) state.getBindingContext().get(BindingContext.REFERENCE_TARGET, ((JetDelegatorToSuperCall) specifier).getCalleeExpression().getConstructorReferenceExpression());
|
||||
generateDelegatorToConstructorCall(iv, codegen, (JetDelegatorToSuperCall) specifier, constructorDescriptor1, n == 0, frameMap);
|
||||
}
|
||||
else if (specifier instanceof JetDelegatorByExpressionSpecifier) {
|
||||
@@ -237,7 +238,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
}
|
||||
|
||||
if (delegateOnStack) {
|
||||
JetType superType = state.getBindingContext().resolveTypeReference(specifier.getTypeReference());
|
||||
JetType superType = state.getBindingContext().get(BindingContext.TYPE, specifier.getTypeReference());
|
||||
ClassDescriptor superClassDescriptor = (ClassDescriptor) superType.getConstructor().getDeclarationDescriptor();
|
||||
String delegateField = "$delegate_" + n;
|
||||
Type fieldType = JetTypeMapper.jetInterfaceType(superClassDescriptor);
|
||||
@@ -245,7 +246,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
v.visitField(Opcodes.ACC_PRIVATE, delegateField, fieldDesc, /*TODO*/null, null);
|
||||
iv.putfield(classname, delegateField, fieldDesc);
|
||||
|
||||
JetClass superClass = (JetClass) state.getBindingContext().getDeclarationPsiElement(superClassDescriptor);
|
||||
JetClass superClass = (JetClass) state.getBindingContext().get(BindingContext.DESCRIPTOR_TO_DECLARATION, superClassDescriptor);
|
||||
final ClassContext delegateContext = context.intoClass(superClassDescriptor,
|
||||
new OwnerKind.DelegateKind(StackValue.field(fieldType, classname, delegateField, false),
|
||||
JetTypeMapper.jvmNameForInterface(superClassDescriptor)));
|
||||
@@ -298,7 +299,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
ConstructorFrameMap frameMap) {
|
||||
ClassDescriptor classDecl = constructorDescriptor.getContainingDeclaration();
|
||||
boolean isDelegating = kind == OwnerKind.DELEGATING_IMPLEMENTATION;
|
||||
PsiElement declaration = state.getBindingContext().getDeclarationPsiElement(classDecl);
|
||||
PsiElement declaration = state.getBindingContext().get(BindingContext.DESCRIPTOR_TO_DECLARATION, classDecl);
|
||||
Type type;
|
||||
if (declaration instanceof PsiClass) {
|
||||
type = JetTypeMapper.psiClassType((PsiClass) declaration);
|
||||
@@ -348,7 +349,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
}
|
||||
|
||||
private void generateSecondaryConstructor(JetConstructor constructor) {
|
||||
ConstructorDescriptor constructorDescriptor = state.getBindingContext().getConstructorDescriptor(constructor);
|
||||
ConstructorDescriptor constructorDescriptor = state.getBindingContext().get(BindingContext.CONSTRUCTOR, constructor);
|
||||
if (constructorDescriptor == null) {
|
||||
throw new UnsupportedOperationException("failed to get descriptor for secondary constructor");
|
||||
}
|
||||
@@ -365,7 +366,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
for (JetDelegationSpecifier initializer : constructor.getInitializers()) {
|
||||
if (initializer instanceof JetDelegatorToThisCall) {
|
||||
JetDelegatorToThisCall thisCall = (JetDelegatorToThisCall) initializer;
|
||||
DeclarationDescriptor thisDescriptor = state.getBindingContext().resolveReferenceExpression(thisCall.getThisReference());
|
||||
DeclarationDescriptor thisDescriptor = state.getBindingContext().get(BindingContext.REFERENCE_TARGET, thisCall.getThisReference());
|
||||
if (!(thisDescriptor instanceof ConstructorDescriptor)) {
|
||||
throw new UnsupportedOperationException("expected 'this' delegator to resolve to constructor");
|
||||
}
|
||||
@@ -409,8 +410,8 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
protected void generateInitializers(ExpressionCodegen codegen, InstructionAdapter iv) {
|
||||
for (JetDeclaration declaration : myClass.getDeclarations()) {
|
||||
if (declaration instanceof JetProperty) {
|
||||
final PropertyDescriptor propertyDescriptor = (PropertyDescriptor) state.getBindingContext().getVariableDescriptor((JetProperty) declaration);
|
||||
if (state.getBindingContext().hasBackingField(propertyDescriptor)) {
|
||||
final PropertyDescriptor propertyDescriptor = (PropertyDescriptor) state.getBindingContext().get(BindingContext.VARIABLE, (JetProperty) declaration);
|
||||
if ((boolean) state.getBindingContext().get(BindingContext.BACKING_FIELD_REQUIRED, propertyDescriptor)) {
|
||||
final JetExpression initializer = ((JetProperty) declaration).getInitializer();
|
||||
if (initializer != null) {
|
||||
iv.load(0, JetTypeMapper.TYPE_OBJECT);
|
||||
@@ -435,7 +436,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
propertyCodegen.gen((JetProperty) declaration);
|
||||
}
|
||||
else if (declaration instanceof JetFunction) {
|
||||
if (!overriden.contains(state.getBindingContext().getFunctionDescriptor((JetNamedFunction) declaration))) {
|
||||
if (!overriden.contains(state.getBindingContext().get(BindingContext.FUNCTION, (JetNamedFunction) declaration))) {
|
||||
functionCodegen.gen((JetNamedFunction) declaration);
|
||||
}
|
||||
}
|
||||
@@ -443,7 +444,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
|
||||
for (JetParameter p : toClass.getPrimaryConstructorParameters()) {
|
||||
if (p.getValOrVarNode() != null) {
|
||||
PropertyDescriptor propertyDescriptor = state.getBindingContext().getPropertyDescriptor(p);
|
||||
PropertyDescriptor propertyDescriptor = state.getBindingContext().get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, p);
|
||||
if (propertyDescriptor != null) {
|
||||
propertyCodegen.generateDefaultGetter(propertyDescriptor, Opcodes.ACC_PUBLIC);
|
||||
if (propertyDescriptor.isVar()) {
|
||||
|
||||
@@ -47,9 +47,9 @@ public class InterfaceBodyCodegen extends ClassBodyCodegen {
|
||||
String superClassName = null;
|
||||
Set<String> superInterfaces = new LinkedHashSet<String>();
|
||||
for (JetDelegationSpecifier specifier : delegationSpecifiers) {
|
||||
JetType superType = bindingContext.resolveTypeReference(specifier.getTypeReference());
|
||||
JetType superType = bindingContext.get(BindingContext.TYPE, specifier.getTypeReference());
|
||||
ClassDescriptor superClassDescriptor = (ClassDescriptor) superType.getConstructor().getDeclarationDescriptor();
|
||||
PsiElement superPsi = bindingContext.getDeclarationPsiElement(superClassDescriptor);
|
||||
PsiElement superPsi = bindingContext.get(BindingContext.DESCRIPTOR_TO_DECLARATION, superClassDescriptor);
|
||||
|
||||
if (superPsi instanceof PsiClass) {
|
||||
PsiClass psiClass = (PsiClass) superPsi;
|
||||
@@ -120,7 +120,7 @@ public class InterfaceBodyCodegen extends ClassBodyCodegen {
|
||||
final JetDelegationSpecifier specifier = delegationSpecifiers.get(0);
|
||||
if (specifier instanceof JetDelegatorToSuperCall) {
|
||||
final JetDelegatorToSuperCall superCall = (JetDelegatorToSuperCall) specifier;
|
||||
ConstructorDescriptor constructorDescriptor = state.getBindingContext().resolveSuperConstructor(superCall);
|
||||
ConstructorDescriptor constructorDescriptor = (ConstructorDescriptor) state.getBindingContext().get(BindingContext.REFERENCE_TARGET, superCall.getCalleeExpression().getConstructorReferenceExpression());
|
||||
CallableMethod method = state.getTypeMapper().mapToCallableMethod(constructorDescriptor, OwnerKind.IMPLEMENTATION);
|
||||
codegen.invokeMethodWithArguments(method, superCall);
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ public class JetTypeMapper {
|
||||
}
|
||||
|
||||
public String jvmName(ClassDescriptor jetClass, OwnerKind kind) {
|
||||
PsiElement declaration = bindingContext.getDeclarationPsiElement(jetClass);
|
||||
PsiElement declaration = bindingContext.get(BindingContext.DESCRIPTOR_TO_DECLARATION, jetClass);
|
||||
if (declaration instanceof PsiClass) {
|
||||
return jvmName((PsiClass) declaration);
|
||||
}
|
||||
@@ -146,7 +146,7 @@ public class JetTypeMapper {
|
||||
final PsiElement parent = declaration.getParent();
|
||||
if (parent instanceof JetClassObject) {
|
||||
JetClass containingClass = PsiTreeUtil.getParentOfType(parent, JetClass.class);
|
||||
final ClassDescriptor containingClassDescriptor = bindingContext.getClassDescriptor(containingClass);
|
||||
final ClassDescriptor containingClassDescriptor = bindingContext.get(BindingContext.CLASS, containingClass);
|
||||
return jvmName(containingClassDescriptor, OwnerKind.INTERFACE) + "$$ClassObj";
|
||||
}
|
||||
String className = classNamesForAnonymousClasses.get(declaration);
|
||||
@@ -159,12 +159,12 @@ public class JetTypeMapper {
|
||||
}
|
||||
|
||||
public String jvmName(JetClassObject classObject) {
|
||||
final ClassDescriptor descriptor = bindingContext.getClassDescriptor(classObject.getObjectDeclaration());
|
||||
final ClassDescriptor descriptor = bindingContext.get(BindingContext.CLASS, classObject.getObjectDeclaration());
|
||||
return jvmName(descriptor, OwnerKind.IMPLEMENTATION);
|
||||
}
|
||||
|
||||
public boolean isInterface(ClassDescriptor jetClass, OwnerKind kind) {
|
||||
PsiElement declaration = bindingContext.getDeclarationPsiElement(jetClass);
|
||||
PsiElement declaration = bindingContext.get(BindingContext.DESCRIPTOR_TO_DECLARATION, jetClass);
|
||||
if (declaration instanceof JetObjectDeclaration) {
|
||||
return false;
|
||||
}
|
||||
@@ -372,14 +372,14 @@ public class JetTypeMapper {
|
||||
|
||||
private Method mapSignature(JetNamedFunction f, List<Type> valueParameterTypes) {
|
||||
final JetTypeReference receiverTypeRef = f.getReceiverTypeRef();
|
||||
final JetType receiverType = receiverTypeRef == null ? null : bindingContext.resolveTypeReference(receiverTypeRef);
|
||||
final JetType receiverType = receiverTypeRef == null ? null : bindingContext.get(BindingContext.TYPE, receiverTypeRef);
|
||||
final List<JetParameter> parameters = f.getValueParameters();
|
||||
List<Type> parameterTypes = new ArrayList<Type>();
|
||||
if (receiverType != null) {
|
||||
parameterTypes.add(mapType(receiverType));
|
||||
}
|
||||
for (JetParameter parameter : parameters) {
|
||||
final Type type = mapType(bindingContext.resolveTypeReference(parameter.getTypeReference()));
|
||||
final Type type = mapType(bindingContext.get(BindingContext.TYPE, parameter.getTypeReference()));
|
||||
valueParameterTypes.add(type);
|
||||
parameterTypes.add(type);
|
||||
}
|
||||
@@ -389,12 +389,12 @@ public class JetTypeMapper {
|
||||
final JetTypeReference returnTypeRef = f.getReturnTypeRef();
|
||||
Type returnType;
|
||||
if (returnTypeRef == null) {
|
||||
final FunctionDescriptor functionDescriptor = bindingContext.getFunctionDescriptor(f);
|
||||
final FunctionDescriptor functionDescriptor = bindingContext.get(BindingContext.FUNCTION, f);
|
||||
final JetType type = functionDescriptor.getReturnType();
|
||||
returnType = mapType(type);
|
||||
}
|
||||
else {
|
||||
returnType = mapType(bindingContext.resolveTypeReference(returnTypeRef));
|
||||
returnType = mapType(bindingContext.get(BindingContext.TYPE, returnTypeRef));
|
||||
}
|
||||
return new Method(f.getName(), returnType, parameterTypes.toArray(new Type[parameterTypes.size()]));
|
||||
}
|
||||
@@ -407,7 +407,7 @@ public class JetTypeMapper {
|
||||
throw new UnsupportedOperationException("unknown declaration type " + declaration);
|
||||
}
|
||||
JetNamedFunction f = (JetNamedFunction) declaration;
|
||||
final FunctionDescriptor functionDescriptor = bindingContext.getFunctionDescriptor(f);
|
||||
final FunctionDescriptor functionDescriptor = bindingContext.get(BindingContext.FUNCTION, f);
|
||||
final DeclarationDescriptor functionParent = functionDescriptor.getContainingDeclaration();
|
||||
final List<Type> valueParameterTypes = new ArrayList<Type>();
|
||||
Method descriptor = mapSignature(f, valueParameterTypes);
|
||||
@@ -561,7 +561,7 @@ public class JetTypeMapper {
|
||||
baseName = NamespaceCodegen.getJVMClassName(((JetNamespace) container).getFQName());
|
||||
}
|
||||
else {
|
||||
ClassDescriptor aClass = bindingContext.getClassDescriptor((JetClassOrObject) container);
|
||||
ClassDescriptor aClass = bindingContext.get(BindingContext.CLASS, (JetClassOrObject) container);
|
||||
baseName = JetTypeMapper.jvmNameForInterface(aClass);
|
||||
}
|
||||
|
||||
@@ -577,7 +577,7 @@ public class JetTypeMapper {
|
||||
|
||||
public Collection<String> allJvmNames(JetClassOrObject jetClass) {
|
||||
Set<String> result = new HashSet<String>();
|
||||
final ClassDescriptor classDescriptor = bindingContext.getClassDescriptor(jetClass);
|
||||
final ClassDescriptor classDescriptor = bindingContext.get(BindingContext.CLASS, jetClass);
|
||||
if (classDescriptor != null) {
|
||||
result.add(jvmName(classDescriptor, OwnerKind.INTERFACE));
|
||||
result.add(jvmName(classDescriptor, OwnerKind.IMPLEMENTATION));
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.jetbrains.jet.codegen;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
@@ -33,7 +34,7 @@ public class NamespaceCodegen {
|
||||
}
|
||||
|
||||
public void generate(JetNamespace namespace) {
|
||||
final ClassContext context = ClassContext.STATIC.intoNamespace(state.getBindingContext().getNamespaceDescriptor(namespace));
|
||||
final ClassContext context = ClassContext.STATIC.intoNamespace(state.getBindingContext().get(BindingContext.NAMESPACE, namespace));
|
||||
|
||||
final FunctionCodegen functionCodegen = new FunctionCodegen(context, v, state);
|
||||
final PropertyCodegen propertyCodegen = new PropertyCodegen(context, v, functionCodegen, state);
|
||||
@@ -78,7 +79,7 @@ public class NamespaceCodegen {
|
||||
if (declaration instanceof JetProperty) {
|
||||
final JetExpression initializer = ((JetProperty) declaration).getInitializer();
|
||||
if (initializer != null && !(initializer instanceof JetConstantExpression)) {
|
||||
final PropertyDescriptor descriptor = (PropertyDescriptor) state.getBindingContext().getVariableDescriptor((JetProperty) declaration);
|
||||
final PropertyDescriptor descriptor = (PropertyDescriptor) state.getBindingContext().get(BindingContext.VARIABLE, (JetProperty) declaration);
|
||||
codegen.genToJVMStack(initializer);
|
||||
codegen.intermediateValueForProperty(descriptor, true, false).store(new InstructionAdapter(mv));
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.PropertySetterDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.VariableDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.jet.lexer.JetTokens;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
@@ -30,7 +31,7 @@ public class PropertyCodegen {
|
||||
}
|
||||
|
||||
public void gen(JetProperty p) {
|
||||
final VariableDescriptor descriptor = state.getBindingContext().getVariableDescriptor(p);
|
||||
final VariableDescriptor descriptor = state.getBindingContext().get(BindingContext.VARIABLE, p);
|
||||
if (!(descriptor instanceof PropertyDescriptor)) {
|
||||
throw new UnsupportedOperationException("expect a property to have a property descriptor");
|
||||
}
|
||||
@@ -67,12 +68,12 @@ public class PropertyCodegen {
|
||||
}
|
||||
|
||||
private void generateBackingField(JetProperty p, PropertyDescriptor propertyDescriptor) {
|
||||
if (state.getBindingContext().hasBackingField(propertyDescriptor)) {
|
||||
if ((boolean) state.getBindingContext().get(BindingContext.BACKING_FIELD_REQUIRED, propertyDescriptor)) {
|
||||
Object value = null;
|
||||
final JetExpression initializer = p.getInitializer();
|
||||
if (initializer != null) {
|
||||
if (initializer instanceof JetConstantExpression) {
|
||||
CompileTimeConstant<?> compileTimeValue = state.getBindingContext().getCompileTimeValue(initializer);
|
||||
CompileTimeConstant<?> compileTimeValue = state.getBindingContext().get(BindingContext.COMPILE_TIME_VALUE, initializer);
|
||||
assert compileTimeValue != null;
|
||||
value = compileTimeValue.getValue();
|
||||
}
|
||||
@@ -126,7 +127,7 @@ public class PropertyCodegen {
|
||||
}
|
||||
|
||||
private void generateDefaultGetter(JetProperty p, JetDeclaration declaration) {
|
||||
final PropertyDescriptor propertyDescriptor = (PropertyDescriptor) state.getBindingContext().getVariableDescriptor(p);
|
||||
final PropertyDescriptor propertyDescriptor = (PropertyDescriptor) state.getBindingContext().get(BindingContext.VARIABLE, p);
|
||||
int flags = JetTypeMapper.getAccessModifiers(declaration, Opcodes.ACC_PUBLIC);
|
||||
generateDefaultGetter(propertyDescriptor, flags);
|
||||
}
|
||||
@@ -166,7 +167,7 @@ public class PropertyCodegen {
|
||||
}
|
||||
|
||||
private void generateDefaultSetter(JetProperty p, JetDeclaration declaration) {
|
||||
final PropertyDescriptor propertyDescriptor = (PropertyDescriptor) state.getBindingContext().getVariableDescriptor(p);
|
||||
final PropertyDescriptor propertyDescriptor = (PropertyDescriptor) state.getBindingContext().get(BindingContext.VARIABLE, p);
|
||||
int flags = JetTypeMapper.getAccessModifiers(declaration, Opcodes.ACC_PUBLIC);
|
||||
generateDefaultSetter(propertyDescriptor, flags);
|
||||
}
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
package org.jetbrains.jet.lang;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetExpression;
|
||||
import org.jetbrains.jet.lang.psi.JetReferenceExpression;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
|
||||
import java.util.Stack;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class ErrorHandlerWithRegions extends ErrorHandler {
|
||||
|
||||
public class DiagnosticsRegion {
|
||||
private final CollectingErrorHandler errorHandler;
|
||||
private boolean committed = false;
|
||||
|
||||
private DiagnosticsRegion(CollectingErrorHandler errorHandler) {
|
||||
this.errorHandler = errorHandler;
|
||||
}
|
||||
|
||||
public CollectingErrorHandler getErrorHandler() {
|
||||
assert !committed;
|
||||
return errorHandler;
|
||||
}
|
||||
|
||||
public void commit() {
|
||||
assert !committed;
|
||||
AnalyzingUtils.applyHandler(parent, errorHandler.getDiagnostics());
|
||||
committed = true;
|
||||
}
|
||||
}
|
||||
|
||||
private final ErrorHandler parent;
|
||||
private final Stack<CollectingErrorHandler> workers;
|
||||
private ErrorHandler worker;
|
||||
|
||||
public ErrorHandlerWithRegions(ErrorHandler parent) {
|
||||
this.parent = parent;
|
||||
this.worker = parent;
|
||||
this.workers = new Stack<CollectingErrorHandler>();
|
||||
}
|
||||
|
||||
public void openRegion() {
|
||||
CollectingErrorHandler newWorker = new CollectingErrorHandler();
|
||||
workers.push(newWorker);
|
||||
worker = newWorker;
|
||||
}
|
||||
|
||||
public void closeAndCommitCurrentRegion() {
|
||||
assert !workers.isEmpty();
|
||||
CollectingErrorHandler region = workers.pop();
|
||||
AnalyzingUtils.applyHandler(parent, region.getDiagnostics());
|
||||
|
||||
setWorker();
|
||||
}
|
||||
|
||||
public DiagnosticsRegion closeAndReturnCurrentRegion() {
|
||||
assert !workers.isEmpty();
|
||||
CollectingErrorHandler currentWorker = workers.pop();
|
||||
setWorker();
|
||||
return new DiagnosticsRegion(currentWorker);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
assert workers.isEmpty() : "Open regions remain: " + workers;
|
||||
}
|
||||
|
||||
private void setWorker() {
|
||||
worker = workers.isEmpty() ? parent : workers.peek();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unresolvedReference(@NotNull JetReferenceExpression referenceExpression) {
|
||||
worker.unresolvedReference(referenceExpression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void typeMismatch(@NotNull JetExpression expression, @NotNull JetType expectedType, @NotNull JetType actualType) {
|
||||
worker.typeMismatch(expression, expectedType, actualType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void redeclaration(@NotNull DeclarationDescriptor existingDescriptor, @NotNull DeclarationDescriptor redeclaredDescriptor) {
|
||||
worker.redeclaration(existingDescriptor, redeclaredDescriptor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genericError(@NotNull ASTNode node, @NotNull String errorMessage) {
|
||||
worker.genericError(node, errorMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genericWarning(@NotNull ASTNode node, @NotNull String message) {
|
||||
worker.genericWarning(node, message);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.JetSemanticServices;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||
import org.jetbrains.jet.lang.types.JetTypeInferrer;
|
||||
import org.jetbrains.jet.lexer.JetTokens;
|
||||
@@ -85,7 +86,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
JetElement result = stack.peek();
|
||||
trace.recordLabelResolution(labelExpression, result);
|
||||
trace.record(BindingContext.LABEL_TARGET, labelExpression, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -351,9 +351,11 @@ public class JetParsing extends AbstractJetParsing {
|
||||
|
||||
PsiBuilder.Marker attribute = mark();
|
||||
|
||||
PsiBuilder.Marker reference = mark();
|
||||
PsiBuilder.Marker typeReference = mark();
|
||||
parseUserType();
|
||||
typeReference.done(TYPE_REFERENCE);
|
||||
reference.done(CONSTRUCTOR_CALLEE);
|
||||
|
||||
parseTypeArgumentList(-1);
|
||||
|
||||
@@ -723,7 +725,9 @@ public class JetParsing extends AbstractJetParsing {
|
||||
type = THIS_CALL;
|
||||
}
|
||||
else if (atSet(TYPE_REF_FIRST)) {
|
||||
PsiBuilder.Marker reference = mark();
|
||||
parseTypeRef();
|
||||
reference.done(CONSTRUCTOR_CALLEE);
|
||||
type = DELEGATOR_SUPER_CALL;
|
||||
} else {
|
||||
errorWithRecovery("Expecting constructor call (this(...)) or supertype initializer", TokenSet.create(LBRACE, COMMA));
|
||||
@@ -1094,18 +1098,23 @@ public class JetParsing extends AbstractJetParsing {
|
||||
private void parseDelegationSpecifier() {
|
||||
PsiBuilder.Marker delegator = mark();
|
||||
parseAnnotations(false);
|
||||
|
||||
PsiBuilder.Marker reference = mark();
|
||||
parseTypeRef();
|
||||
|
||||
if (at(BY_KEYWORD)) {
|
||||
reference.drop();
|
||||
advance(); // BY_KEYWORD
|
||||
createForByClause(myBuilder).myExpressionParsing.parseExpression();
|
||||
delegator.done(DELEGATOR_BY);
|
||||
}
|
||||
else if (at(LPAR)) {
|
||||
reference.done(CONSTRUCTOR_CALLEE);
|
||||
myExpressionParsing.parseValueArgumentList();
|
||||
delegator.done(DELEGATOR_SUPER_CALL);
|
||||
}
|
||||
else {
|
||||
reference.drop();
|
||||
delegator.done(DELEGATOR_SUPER_CLASS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,13 +29,16 @@ public class JetAnnotationEntry extends JetElement implements JetCall {
|
||||
|
||||
@Nullable @IfNotParsed
|
||||
public JetTypeReference getTypeReference() {
|
||||
return (JetTypeReference) findChildByType(JetNodeTypes.TYPE_REFERENCE);
|
||||
JetConstructorCalleeExpression calleeExpression = getCalleeExpression();
|
||||
if (calleeExpression == null) {
|
||||
return null;
|
||||
}
|
||||
return calleeExpression.getTypeReference();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetExpression getCalleeExpression() {
|
||||
// Make callee an expression instead of a type reference
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
public JetConstructorCalleeExpression getCalleeExpression() {
|
||||
return (JetConstructorCalleeExpression) findChildByType(JetNodeTypes.CONSTRUCTOR_CALLEE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package org.jetbrains.jet.lang.psi;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class JetConstructorCalleeExpression extends JetExpression {
|
||||
public JetConstructorCalleeExpression(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@Nullable @IfNotParsed
|
||||
public JetTypeReference getTypeReference() {
|
||||
return findChildByClass(JetTypeReference.class);
|
||||
}
|
||||
|
||||
@Nullable @IfNotParsed
|
||||
public JetReferenceExpression getConstructorReferenceExpression() {
|
||||
JetTypeReference typeReference = getTypeReference();
|
||||
if (typeReference == null) {
|
||||
return null;
|
||||
}
|
||||
JetTypeElement typeElement = typeReference.getTypeElement();
|
||||
assert typeElement instanceof JetUserType;
|
||||
return ((JetUserType) typeElement).getReferenceExpression();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,9 +28,8 @@ public class JetDelegatorToSuperCall extends JetDelegationSpecifier implements J
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public JetExpression getCalleeExpression() {
|
||||
// Change the AST so the the callee is an expression
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
public JetConstructorCalleeExpression getCalleeExpression() {
|
||||
return (JetConstructorCalleeExpression) findChildByType(JetNodeTypes.CONSTRUCTOR_CALLEE);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -50,6 +49,11 @@ public class JetDelegatorToSuperCall extends JetDelegationSpecifier implements J
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetTypeReference getTypeReference() {
|
||||
return getCalleeExpression().getTypeReference();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<JetTypeProjection> getTypeArguments() {
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContextUtils;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
@@ -19,7 +20,7 @@ public abstract class JetReferenceExpression extends JetExpression {
|
||||
protected PsiElement doResolve() {
|
||||
JetFile file = (JetFile) getContainingFile();
|
||||
BindingContext bindingContext = AnalyzingUtils.analyzeFileWithCache(file);
|
||||
PsiElement psiElement = bindingContext.resolveToDeclarationPsiElement(this);
|
||||
PsiElement psiElement = BindingContextUtils.resolveToDeclarationPsiElement(bindingContext, this);
|
||||
return psiElement == null
|
||||
? file
|
||||
: psiElement;
|
||||
|
||||
@@ -91,7 +91,7 @@ public class JetSimpleNameExpression extends JetReferenceExpression {
|
||||
JetExpression receiverExpression = qualifiedExpression.getReceiverExpression();
|
||||
JetFile file = (JetFile) getContainingFile();
|
||||
BindingContext bindingContext = AnalyzingUtils.analyzeFileWithCache(file);
|
||||
final JetType expressionType = bindingContext.getExpressionType(receiverExpression);
|
||||
final JetType expressionType = bindingContext.get(BindingContext.EXPRESSION_TYPE, receiverExpression);
|
||||
if (expressionType != null) {
|
||||
return collectLookupElements(bindingContext, expressionType.getMemberScope());
|
||||
}
|
||||
@@ -99,7 +99,7 @@ public class JetSimpleNameExpression extends JetReferenceExpression {
|
||||
else {
|
||||
JetFile file = (JetFile) getContainingFile();
|
||||
BindingContext bindingContext = AnalyzingUtils.analyzeFileWithCache(file);
|
||||
JetScope resolutionScope = bindingContext.getResolutionScope(JetSimpleNameExpression.this);
|
||||
JetScope resolutionScope = bindingContext.get(BindingContext.RESOLUTION_SCOPE, JetSimpleNameExpression.this);
|
||||
if (resolutionScope != null) {
|
||||
return collectLookupElements(bindingContext, resolutionScope);
|
||||
}
|
||||
@@ -119,7 +119,7 @@ public class JetSimpleNameExpression extends JetReferenceExpression {
|
||||
private Object[] collectLookupElements(BindingContext bindingContext, JetScope scope) {
|
||||
List<LookupElement> result = Lists.newArrayList();
|
||||
for (final DeclarationDescriptor descriptor : scope.getAllDescriptors()) {
|
||||
PsiElement declaration = bindingContext.getDeclarationPsiElement(descriptor.getOriginal());
|
||||
PsiElement declaration = bindingContext.get(BindingContext.DESCRIPTOR_TO_DECLARATION, descriptor.getOriginal());
|
||||
LookupElementBuilder element = LookupElementBuilder.create(descriptor.getName());
|
||||
String typeText = "";
|
||||
String tailText = "";
|
||||
|
||||
@@ -87,7 +87,7 @@ public class AnnotationResolver {
|
||||
for (JetAnnotationEntry annotation : annotations) {
|
||||
AnnotationDescriptor annotationDescriptor = new AnnotationDescriptor();
|
||||
result.add(annotationDescriptor);
|
||||
trace.recordAnnotationResolution(annotation, annotationDescriptor);
|
||||
trace.record(BindingContext.ANNOTATION, annotation, annotationDescriptor);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package org.jetbrains.jet.lang.resolve;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.JetDiagnostic;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.util.*;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -16,46 +15,93 @@ import java.util.Collection;
|
||||
* @author abreslav
|
||||
*/
|
||||
public interface BindingContext {
|
||||
@Deprecated // "Tests only"
|
||||
DeclarationDescriptor getDeclarationDescriptor(PsiElement declaration);
|
||||
WritableSlice<JetAnnotationEntry, AnnotationDescriptor> ANNOTATION = ManyMapSlices.createSimpleSlice("ANNOTATION");
|
||||
WritableSlice<JetExpression, CompileTimeConstant<?>> COMPILE_TIME_VALUE = ManyMapSlices.createSimpleSlice("COMPILE_TIME_VALUE");
|
||||
WritableSlice<JetTypeReference, JetType> TYPE = ManyMapSlices.createSimpleSlice("TYPE");
|
||||
WritableSlice<JetExpression, JetType> EXPRESSION_TYPE = new BasicWritableSlice<JetExpression, JetType>("EXPRESSION_TYPE", RewritePolicy.DO_NOTHING);
|
||||
WritableSlice<JetReferenceExpression, DeclarationDescriptor> REFERENCE_TARGET = new BasicWritableSlice<JetReferenceExpression, DeclarationDescriptor>("REFERENCE_TARGET", RewritePolicy.DO_NOTHING);
|
||||
WritableSlice<JetExpression, JetType> AUTOCAST = ManyMapSlices.createSimpleSlice("AUTOCAST");
|
||||
WritableSlice<JetExpression, JetScope> RESOLUTION_SCOPE = ManyMapSlices.createSimpleSlice("RESOLUTION_SCOPE");
|
||||
|
||||
NamespaceDescriptor getNamespaceDescriptor(JetNamespace declaration);
|
||||
ClassDescriptor getClassDescriptor(JetClassOrObject declaration);
|
||||
TypeParameterDescriptor getTypeParameterDescriptor(JetTypeParameter declaration);
|
||||
FunctionDescriptor getFunctionDescriptor(JetNamedFunction declaration);
|
||||
ConstructorDescriptor getConstructorDescriptor(JetElement declaration);
|
||||
AnnotationDescriptor getAnnotationDescriptor(JetAnnotationEntry annotationEntry);
|
||||
WritableSlice<JetExpression, Boolean> VARIABLE_REASSIGNMENT = ManyMapSlices.createSimpleSetSlice("VARIABLE_REASSIGNMENT");
|
||||
WritableSlice<JetExpression, Boolean> PROCESSED = ManyMapSlices.createSimpleSetSlice("PROCESSED");
|
||||
WritableSlice<JetElement, Boolean> STATEMENT = ManyMapSlices.createRemovableSetSlice("STATEMENT");
|
||||
|
||||
@Nullable
|
||||
CompileTimeConstant<?> getCompileTimeValue(JetExpression expression);
|
||||
WritableSlice<PropertyDescriptor, Boolean> BACKING_FIELD_REQUIRED = new ManyMapSlices.SetSlice<PropertyDescriptor>("BACKING_FIELD_REQUIRED", RewritePolicy.DO_NOTHING) {
|
||||
@Override
|
||||
public Boolean computeValue(ManyMap map, PropertyDescriptor propertyDescriptor, Boolean backingFieldRequired, boolean valueNotFound) {
|
||||
backingFieldRequired = valueNotFound ? false : backingFieldRequired;
|
||||
assert backingFieldRequired != null;
|
||||
PsiElement declarationPsiElement = map.get(DESCRIPTOR_TO_DECLARATION, propertyDescriptor);
|
||||
if (declarationPsiElement instanceof JetParameter) {
|
||||
JetParameter jetParameter = (JetParameter) declarationPsiElement;
|
||||
return jetParameter.getValOrVarNode() != null ||
|
||||
backingFieldRequired;
|
||||
}
|
||||
if (propertyDescriptor.getModifiers().isAbstract()) return false;
|
||||
PropertyGetterDescriptor getter = propertyDescriptor.getGetter();
|
||||
PropertySetterDescriptor setter = propertyDescriptor.getSetter();
|
||||
if (getter == null) {
|
||||
return true;
|
||||
}
|
||||
else if (propertyDescriptor.isVar() && setter == null) {
|
||||
return true;
|
||||
}
|
||||
else if (setter != null && !setter.hasBody() && !setter.getModifiers().isAbstract()) {
|
||||
return true;
|
||||
}
|
||||
else if (!getter.hasBody() && !getter.getModifiers().isAbstract()) {
|
||||
return true;
|
||||
}
|
||||
return backingFieldRequired;
|
||||
}
|
||||
};
|
||||
|
||||
VariableDescriptor getVariableDescriptor(JetProperty declaration);
|
||||
VariableDescriptor getVariableDescriptor(JetParameter declaration);
|
||||
WritableSlice<JetFunctionLiteralExpression, Boolean> BLOCK = new ManyMapSlices.SetSlice<JetFunctionLiteralExpression>("BLOCK", RewritePolicy.DO_NOTHING) {
|
||||
@Override
|
||||
public Boolean computeValue(ManyMap map, JetFunctionLiteralExpression expression, Boolean isBlock, boolean valueNotFound) {
|
||||
isBlock = valueNotFound ? false : isBlock;
|
||||
assert isBlock != null;
|
||||
return isBlock && !expression.getFunctionLiteral().hasParameterSpecification();
|
||||
}
|
||||
};
|
||||
|
||||
PropertyDescriptor getPropertyDescriptor(JetParameter primaryConstructorParameter);
|
||||
PropertyDescriptor getPropertyDescriptor(JetObjectDeclarationName objectDeclarationName);
|
||||
ManyMapSlices.KeyNormalizer<DeclarationDescriptor> DECLARATION_DESCRIPTOR_NORMALIZER = new ManyMapSlices.KeyNormalizer<DeclarationDescriptor>() {
|
||||
@Override
|
||||
public DeclarationDescriptor normalize(DeclarationDescriptor declarationDescriptor) {
|
||||
if (declarationDescriptor instanceof VariableAsFunctionDescriptor) {
|
||||
VariableAsFunctionDescriptor descriptor = (VariableAsFunctionDescriptor) declarationDescriptor;
|
||||
return descriptor.getVariableDescriptor().getOriginal();
|
||||
}
|
||||
return declarationDescriptor.getOriginal();
|
||||
}
|
||||
};
|
||||
ReadOnlySlice<DeclarationDescriptor, PsiElement> DESCRIPTOR_TO_DECLARATION = ManyMapSlices.<DeclarationDescriptor, PsiElement>sliceBuilder("DECLARATION_TO_DESCRIPTOR").setKeyNormalizer(DECLARATION_DESCRIPTOR_NORMALIZER).build();
|
||||
|
||||
JetType getExpressionType(JetExpression expression);
|
||||
WritableSlice<PsiElement, NamespaceDescriptor> NAMESPACE = ManyMapSlices.<PsiElement, NamespaceDescriptor>sliceBuilder("DECLARATION").setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
WritableSlice<PsiElement, ClassDescriptor> CLASS = ManyMapSlices.<PsiElement, ClassDescriptor>sliceBuilder("CLASS").setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
WritableSlice<JetTypeParameter, TypeParameterDescriptor> TYPE_PARAMETER = ManyMapSlices.<JetTypeParameter, TypeParameterDescriptor>sliceBuilder("TYPE_PARAMETER").setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
WritableSlice<PsiElement, FunctionDescriptor> FUNCTION = ManyMapSlices.<PsiElement, FunctionDescriptor>sliceBuilder("FUNCTION").setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
WritableSlice<PsiElement, ConstructorDescriptor> CONSTRUCTOR = ManyMapSlices.<PsiElement, ConstructorDescriptor>sliceBuilder("CONSTRUCTOR").setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
WritableSlice<PsiElement, VariableDescriptor> VARIABLE = ManyMapSlices.<PsiElement, VariableDescriptor>sliceBuilder("VARIABLE").setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
WritableSlice<JetParameter, VariableDescriptor> VALUE_PARAMETER = ManyMapSlices.<JetParameter, VariableDescriptor>sliceBuilder("VALUE_PARAMETER").setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
WritableSlice<JetPropertyAccessor, PropertyAccessorDescriptor> PROPERTY_ACCESSOR = ManyMapSlices.<JetPropertyAccessor, PropertyAccessorDescriptor>sliceBuilder("PROPERTY_ACCESSOR").setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
|
||||
DeclarationDescriptor resolveReferenceExpression(JetReferenceExpression referenceExpression);
|
||||
// normalize value to getOriginal(value)
|
||||
WritableSlice<PsiElement, PropertyDescriptor> PRIMARY_CONSTRUCTOR_PARAMETER = ManyMapSlices.<PsiElement, PropertyDescriptor>sliceBuilder("PRIMARY_CONSTRUCTOR_PARAMETER").setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
WritableSlice<JetObjectDeclarationName, PropertyDescriptor> OBJECT_DECLARATION = ManyMapSlices.<JetObjectDeclarationName, PropertyDescriptor>sliceBuilder("OBJECT_DECLARATION").setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
|
||||
JetType resolveTypeReference(JetTypeReference typeReference);
|
||||
PsiElement resolveToDeclarationPsiElement(JetReferenceExpression referenceExpression);
|
||||
PsiElement getDeclarationPsiElement(DeclarationDescriptor descriptor);
|
||||
WritableSlice[] DECLARATIONS_TO_DESCRIPTORS = new WritableSlice[] {
|
||||
NAMESPACE, CLASS, TYPE_PARAMETER, FUNCTION, CONSTRUCTOR, VARIABLE, VALUE_PARAMETER, PRIMARY_CONSTRUCTOR_PARAMETER, OBJECT_DECLARATION
|
||||
};
|
||||
|
||||
boolean isBlock(JetFunctionLiteralExpression expression);
|
||||
boolean isStatement(JetExpression expression);
|
||||
boolean hasBackingField(PropertyDescriptor propertyDescriptor);
|
||||
ReadOnlySlice<PsiElement, DeclarationDescriptor> DECLARATION_TO_DESCRIPTOR = ManyMapSlices.<PsiElement, DeclarationDescriptor>sliceBuilder("DECLARATION_TO_DESCRIPTOR")
|
||||
.setFurtherLookupSlices(DECLARATIONS_TO_DESCRIPTORS).build();
|
||||
|
||||
boolean isVariableReassignment(JetExpression expression);
|
||||
|
||||
ConstructorDescriptor resolveSuperConstructor(JetDelegatorToSuperCall superCall);
|
||||
|
||||
@Nullable
|
||||
JetType getAutoCastType(@NotNull JetExpression expression);
|
||||
|
||||
@Nullable
|
||||
JetScope getResolutionScope(@NotNull JetExpression expression);
|
||||
WritableSlice<JetReferenceExpression, PsiElement> LABEL_TARGET = ManyMapSlices.<JetReferenceExpression, PsiElement>sliceBuilder("LABEL_TARGET").build();
|
||||
WritableSlice<JetParameter, PropertyDescriptor> VALUE_PARAMETER_AS_PROPERTY = ManyMapSlices.<JetParameter, PropertyDescriptor>sliceBuilder("VALUE_PARAMETER_AS_PROPERTY").build();
|
||||
|
||||
Collection<JetDiagnostic> getDiagnostics();
|
||||
|
||||
<K, V> V get(ReadOnlySlice<K, V> slice, K key);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.jetbrains.jet.lang.resolve;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetReferenceExpression;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class BindingContextUtils {
|
||||
public static PsiElement resolveToDeclarationPsiElement(BindingContext bindingContext, JetReferenceExpression referenceExpression) {
|
||||
DeclarationDescriptor declarationDescriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, referenceExpression);
|
||||
if (declarationDescriptor == null) {
|
||||
return bindingContext.get(BindingContext.LABEL_TARGET, referenceExpression);
|
||||
}
|
||||
return bindingContext.get(BindingContext.DESCRIPTOR_TO_DECLARATION, declarationDescriptor);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,56 +1,24 @@
|
||||
package org.jetbrains.jet.lang.resolve;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.ErrorHandlerWithRegions;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.lang.ErrorHandler;
|
||||
import org.jetbrains.jet.util.ReadOnlySlice;
|
||||
import org.jetbrains.jet.util.WritableSlice;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public interface BindingTrace {
|
||||
|
||||
void recordExpressionType(@NotNull JetExpression expression, @NotNull JetType type);
|
||||
|
||||
void recordReferenceResolution(@NotNull JetReferenceExpression expression, @NotNull DeclarationDescriptor descriptor);
|
||||
|
||||
void recordLabelResolution(@NotNull JetReferenceExpression expression, @NotNull PsiElement element);
|
||||
|
||||
void recordDeclarationResolution(@NotNull PsiElement declaration, @NotNull DeclarationDescriptor descriptor);
|
||||
|
||||
void recordValueParameterAsPropertyResolution(@NotNull JetParameter declaration, @NotNull PropertyDescriptor descriptor);
|
||||
|
||||
void recordTypeResolution(@NotNull JetTypeReference typeReference, @NotNull JetType type);
|
||||
|
||||
void recordAnnotationResolution(@NotNull JetAnnotationEntry annotationEntry, @NotNull AnnotationDescriptor annotationDescriptor);
|
||||
|
||||
void recordCompileTimeValue(@NotNull JetExpression expression, @NotNull CompileTimeConstant<?> value);
|
||||
|
||||
void recordBlock(JetFunctionLiteralExpression expression);
|
||||
|
||||
void recordStatement(@NotNull JetElement statement);
|
||||
|
||||
void recordVariableReassignment(@NotNull JetExpression expression);
|
||||
|
||||
void recordResolutionScope(@NotNull JetExpression expression, @NotNull JetScope scope);
|
||||
|
||||
void removeStatementRecord(@NotNull JetElement statement);
|
||||
|
||||
void requireBackingField(@NotNull PropertyDescriptor propertyDescriptor);
|
||||
|
||||
void recordAutoCast(@NotNull JetExpression expression, @NotNull JetType type);
|
||||
|
||||
@NotNull
|
||||
ErrorHandlerWithRegions getErrorHandler();
|
||||
|
||||
boolean isProcessed(@NotNull JetExpression expression);
|
||||
|
||||
void markAsProcessed(@NotNull JetExpression expression);
|
||||
ErrorHandler getErrorHandler();
|
||||
|
||||
BindingContext getBindingContext();
|
||||
|
||||
<K, V> void record(WritableSlice<K, V> slice, K key, V value);
|
||||
|
||||
// Writes TRUE for a boolean value
|
||||
<K> void record(WritableSlice<K, Boolean> slice, K key);
|
||||
|
||||
<K, V> V get(ReadOnlySlice<K, V> slice, K key);
|
||||
}
|
||||
|
||||
@@ -1,112 +1,61 @@
|
||||
package org.jetbrains.jet.lang.resolve;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.ErrorHandlerWithRegions;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.lang.ErrorHandler;
|
||||
import org.jetbrains.jet.util.ReadOnlySlice;
|
||||
import org.jetbrains.jet.util.WritableSlice;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class BindingTraceAdapter implements BindingTrace {
|
||||
private final BindingTrace originalTrace;
|
||||
|
||||
@Override
|
||||
public void recordAutoCast(@NotNull JetExpression expression, @NotNull JetType type) {
|
||||
originalTrace.recordAutoCast(expression, type);
|
||||
public interface RecordHandler<K, V> {
|
||||
void handleRecord(WritableSlice<K, V> slice, K key, V value);
|
||||
}
|
||||
|
||||
private final BindingTrace originalTrace;
|
||||
private Map<WritableSlice, RecordHandler> handlers = Maps.newHashMap();
|
||||
|
||||
public BindingTraceAdapter(BindingTrace originalTrace) {
|
||||
this.originalTrace = originalTrace;
|
||||
}
|
||||
|
||||
public void recordExpressionType(@NotNull JetExpression expression, @NotNull JetType type) {
|
||||
originalTrace.recordExpressionType(expression, type);
|
||||
}
|
||||
|
||||
public void recordReferenceResolution(@NotNull JetReferenceExpression expression, @NotNull DeclarationDescriptor descriptor) {
|
||||
originalTrace.recordReferenceResolution(expression, descriptor);
|
||||
}
|
||||
|
||||
public void recordLabelResolution(@NotNull JetReferenceExpression expression, @NotNull PsiElement element) {
|
||||
originalTrace.recordLabelResolution(expression, element);
|
||||
}
|
||||
|
||||
public void recordDeclarationResolution(@NotNull PsiElement declaration, @NotNull DeclarationDescriptor descriptor) {
|
||||
originalTrace.recordDeclarationResolution(declaration, descriptor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordValueParameterAsPropertyResolution(@NotNull JetParameter declaration, @NotNull PropertyDescriptor descriptor) {
|
||||
originalTrace.recordValueParameterAsPropertyResolution(declaration, descriptor);
|
||||
}
|
||||
|
||||
public void recordTypeResolution(@NotNull JetTypeReference typeReference, @NotNull JetType type) {
|
||||
originalTrace.recordTypeResolution(typeReference, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordAnnotationResolution(@NotNull JetAnnotationEntry annotationEntry, @NotNull AnnotationDescriptor annotationDescriptor) {
|
||||
originalTrace.recordAnnotationResolution(annotationEntry, annotationDescriptor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordCompileTimeValue(@NotNull JetExpression expression, @NotNull CompileTimeConstant<?> value) {
|
||||
originalTrace.recordCompileTimeValue(expression, value);
|
||||
}
|
||||
|
||||
public void recordBlock(JetFunctionLiteralExpression expression) {
|
||||
originalTrace.recordBlock(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordStatement(@NotNull JetElement statement) {
|
||||
originalTrace.recordStatement(statement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordVariableReassignment(@NotNull JetExpression expression) {
|
||||
originalTrace.recordVariableReassignment(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requireBackingField(@NotNull PropertyDescriptor propertyDescriptor) {
|
||||
originalTrace.requireBackingField(propertyDescriptor);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ErrorHandlerWithRegions getErrorHandler() {
|
||||
public ErrorHandler getErrorHandler() {
|
||||
return originalTrace.getErrorHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeStatementRecord(@NotNull JetElement statement) {
|
||||
originalTrace.removeStatementRecord(statement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markAsProcessed(@NotNull JetExpression expression) {
|
||||
originalTrace.markAsProcessed(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isProcessed(@NotNull JetExpression expression) {
|
||||
return originalTrace.isProcessed(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BindingContext getBindingContext() {
|
||||
return originalTrace.getBindingContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordResolutionScope(@NotNull JetExpression expression, @NotNull JetScope scope) {
|
||||
originalTrace.recordResolutionScope(expression, scope);
|
||||
public <K, V> void record(WritableSlice<K, V> slice, K key, V value) {
|
||||
originalTrace.record(slice, key, value);
|
||||
RecordHandler recordHandler = handlers.get(slice);
|
||||
if (recordHandler != null) {
|
||||
recordHandler.handleRecord(slice, key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K> void record(WritableSlice<K, Boolean> slice, K key) {
|
||||
record(slice, key, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> V get(ReadOnlySlice<K, V> slice, K key) {
|
||||
return originalTrace.get(slice, key);
|
||||
}
|
||||
|
||||
public <K, V> BindingTraceAdapter addHandler(@NotNull WritableSlice<K, V> slice, @NotNull RecordHandler<K, V> handler) {
|
||||
handlers.put(slice, handler);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,238 +1,42 @@
|
||||
package org.jetbrains.jet.lang.resolve;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.CollectingErrorHandler;
|
||||
import org.jetbrains.jet.lang.ErrorHandlerWithRegions;
|
||||
import org.jetbrains.jet.lang.ErrorHandler;
|
||||
import org.jetbrains.jet.lang.JetDiagnostic;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.util.ManyMapImpl;
|
||||
import org.jetbrains.jet.util.MutableManyMap;
|
||||
import org.jetbrains.jet.util.ReadOnlySlice;
|
||||
import org.jetbrains.jet.util.WritableSlice;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class BindingTraceContext implements BindingTrace {
|
||||
private final Map<JetExpression, JetType> expressionTypes = new HashMap<JetExpression, JetType>();
|
||||
private final Map<JetReferenceExpression, DeclarationDescriptor> resolutionResults = new HashMap<JetReferenceExpression, DeclarationDescriptor>();
|
||||
private final Map<JetReferenceExpression, PsiElement> labelResolutionResults = new HashMap<JetReferenceExpression, PsiElement>();
|
||||
private final Map<JetTypeReference, JetType> types = new HashMap<JetTypeReference, JetType>();
|
||||
private final Map<DeclarationDescriptor, PsiElement> descriptorToDeclarations = new HashMap<DeclarationDescriptor, PsiElement>();
|
||||
private final Map<PsiElement, DeclarationDescriptor> declarationsToDescriptors = new HashMap<PsiElement, DeclarationDescriptor>();
|
||||
private final Map<PsiElement, ConstructorDescriptor> constructorDeclarationsToDescriptors = new HashMap<PsiElement, ConstructorDescriptor>();
|
||||
private final Map<PsiElement, NamespaceDescriptor> namespaceDeclarationsToDescriptors = Maps.newHashMap();
|
||||
private final Map<PsiElement, PropertyDescriptor> primaryConstructorParameterDeclarationsToPropertyDescriptors = Maps.newHashMap();
|
||||
private final Map<JetExpression, JetType> autoCasts = Maps.newHashMap();
|
||||
private final Map<JetExpression, JetScope> resolutionScopes = Maps.newHashMap();
|
||||
|
||||
private final Set<JetExpression> variableReassignments = Sets.newHashSet();
|
||||
|
||||
private final Set<JetFunctionLiteralExpression> blocks = new HashSet<JetFunctionLiteralExpression>();
|
||||
private final Set<JetElement> statements = new HashSet<JetElement>();
|
||||
private final Set<PropertyDescriptor> backingFieldRequired = new HashSet<PropertyDescriptor>();
|
||||
private final Set<JetExpression> processed = Sets.newHashSet();
|
||||
|
||||
private final List<JetDiagnostic> diagnostics = Lists.newArrayList();
|
||||
|
||||
private final ErrorHandlerWithRegions errorHandler = new ErrorHandlerWithRegions(new CollectingErrorHandler(diagnostics));
|
||||
private Map<JetAnnotationEntry, AnnotationDescriptor> annotationDescriptos = Maps.newHashMap();
|
||||
private Map<JetExpression, CompileTimeConstant<?>> compileTimeValues = Maps.newHashMap();
|
||||
private final ErrorHandler errorHandler = new CollectingErrorHandler(diagnostics);
|
||||
private final MutableManyMap map = ManyMapImpl.create();
|
||||
|
||||
private final BindingContext bindingContext = new BindingContext() {
|
||||
@Override
|
||||
public DeclarationDescriptor getDeclarationDescriptor(PsiElement declaration) {
|
||||
if (declaration instanceof JetNamespace) {
|
||||
JetNamespace namespace = (JetNamespace) declaration;
|
||||
return getNamespaceDescriptor(namespace);
|
||||
}
|
||||
return declarationsToDescriptors.get(declaration);
|
||||
}
|
||||
|
||||
public NamespaceDescriptor getNamespaceDescriptor(JetNamespace declaration) {
|
||||
return namespaceDeclarationsToDescriptors.get(declaration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassDescriptor getClassDescriptor(JetClassOrObject declaration) {
|
||||
return (ClassDescriptor) declarationsToDescriptors.get((JetDeclaration) declaration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypeParameterDescriptor getTypeParameterDescriptor(JetTypeParameter declaration) {
|
||||
return (TypeParameterDescriptor) declarationsToDescriptors.get(declaration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FunctionDescriptor getFunctionDescriptor(JetNamedFunction declaration) {
|
||||
return (FunctionDescriptor) declarationsToDescriptors.get(declaration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VariableDescriptor getVariableDescriptor(JetProperty declaration) {
|
||||
return (VariableDescriptor) declarationsToDescriptors.get(declaration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VariableDescriptor getVariableDescriptor(JetParameter declaration) {
|
||||
return (VariableDescriptor) declarationsToDescriptors.get(declaration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyDescriptor getPropertyDescriptor(JetParameter primaryConstructorParameter) {
|
||||
return primaryConstructorParameterDeclarationsToPropertyDescriptors.get(primaryConstructorParameter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyDescriptor getPropertyDescriptor(JetObjectDeclarationName objectDeclarationName) {
|
||||
return (PropertyDescriptor) declarationsToDescriptors.get(objectDeclarationName);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ConstructorDescriptor getConstructorDescriptor(@NotNull JetElement declaration) {
|
||||
return constructorDeclarationsToDescriptors.get(declaration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnnotationDescriptor getAnnotationDescriptor(JetAnnotationEntry annotationEntry) {
|
||||
return annotationDescriptos.get(annotationEntry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompileTimeConstant<?> getCompileTimeValue(JetExpression expression) {
|
||||
return compileTimeValues.get(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetType resolveTypeReference(JetTypeReference typeReference) {
|
||||
return types.get(typeReference);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetType getExpressionType(JetExpression expression) {
|
||||
return expressionTypes.get(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeclarationDescriptor resolveReferenceExpression(JetReferenceExpression referenceExpression) {
|
||||
return resolutionResults.get(referenceExpression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement resolveToDeclarationPsiElement(JetReferenceExpression referenceExpression) {
|
||||
DeclarationDescriptor declarationDescriptor = resolveReferenceExpression(referenceExpression);
|
||||
if (declarationDescriptor == null) {
|
||||
return labelResolutionResults.get(referenceExpression);
|
||||
}
|
||||
return descriptorToDeclarations.get(getOriginal(declarationDescriptor));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement getDeclarationPsiElement(@NotNull DeclarationDescriptor descriptor) {
|
||||
return descriptorToDeclarations.get(getOriginal(descriptor));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlock(JetFunctionLiteralExpression expression) {
|
||||
return !expression.getFunctionLiteral().hasParameterSpecification() && blocks.contains(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStatement(@NotNull JetExpression expression) {
|
||||
return statements.contains(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBackingField(@NotNull PropertyDescriptor propertyDescriptor) {
|
||||
PsiElement declarationPsiElement = getDeclarationPsiElement(propertyDescriptor);
|
||||
if (declarationPsiElement instanceof JetParameter) {
|
||||
JetParameter jetParameter = (JetParameter) declarationPsiElement;
|
||||
return jetParameter.getValOrVarNode() != null ||
|
||||
backingFieldRequired.contains(propertyDescriptor);
|
||||
}
|
||||
if (propertyDescriptor.getModifiers().isAbstract()) return false;
|
||||
PropertyGetterDescriptor getter = propertyDescriptor.getGetter();
|
||||
PropertySetterDescriptor setter = propertyDescriptor.getSetter();
|
||||
if (getter == null) {
|
||||
return true;
|
||||
}
|
||||
else if (propertyDescriptor.isVar() && setter == null) {
|
||||
return true;
|
||||
}
|
||||
else if (setter != null && !setter.hasBody() && !setter.getModifiers().isAbstract()) {
|
||||
return true;
|
||||
}
|
||||
else if (!getter.hasBody() && !getter.getModifiers().isAbstract()) {
|
||||
return true;
|
||||
}
|
||||
return backingFieldRequired.contains(propertyDescriptor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVariableReassignment(JetExpression expression) {
|
||||
return variableReassignments.contains(expression);
|
||||
}
|
||||
|
||||
public ConstructorDescriptor resolveSuperConstructor(JetDelegatorToSuperCall superCall) {
|
||||
JetTypeReference typeReference = superCall.getTypeReference();
|
||||
if (typeReference == null) return null;
|
||||
|
||||
JetTypeElement typeElement = typeReference.getTypeElement();
|
||||
if (!(typeElement instanceof JetUserType)) return null;
|
||||
|
||||
DeclarationDescriptor descriptor = resolveReferenceExpression(((JetUserType) typeElement).getReferenceExpression());
|
||||
return descriptor instanceof ConstructorDescriptor ? (ConstructorDescriptor) descriptor : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetType getAutoCastType(@NotNull JetExpression expression) {
|
||||
return autoCasts.get(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetScope getResolutionScope(@NotNull JetExpression expression) {
|
||||
return resolutionScopes.get(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<JetDiagnostic> getDiagnostics() {
|
||||
return diagnostics;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> V get(ReadOnlySlice<K, V> slice, K key) {
|
||||
return BindingTraceContext.this.get(slice, key);
|
||||
}
|
||||
};
|
||||
|
||||
public BindingTraceContext() {
|
||||
}
|
||||
|
||||
public void destructiveMerge(BindingTraceContext other) {
|
||||
safePutAll(expressionTypes, other.expressionTypes);
|
||||
resolutionResults.putAll(other.resolutionResults);
|
||||
safePutAll(labelResolutionResults, other.labelResolutionResults);
|
||||
safePutAll(types, other.types);
|
||||
safePutAll(descriptorToDeclarations, other.descriptorToDeclarations);
|
||||
safePutAll(declarationsToDescriptors, other.declarationsToDescriptors);
|
||||
safePutAll(constructorDeclarationsToDescriptors, other.constructorDeclarationsToDescriptors);
|
||||
safePutAll(namespaceDeclarationsToDescriptors, other.namespaceDeclarationsToDescriptors);
|
||||
safePutAll(primaryConstructorParameterDeclarationsToPropertyDescriptors, other.primaryConstructorParameterDeclarationsToPropertyDescriptors);
|
||||
safePutAll(autoCasts, other.autoCasts);
|
||||
safePutAll(resolutionScopes, other.resolutionScopes);
|
||||
|
||||
blocks.addAll(other.blocks);
|
||||
statements.addAll(other.statements);
|
||||
backingFieldRequired.addAll(other.backingFieldRequired);
|
||||
processed.addAll(other.processed);
|
||||
|
||||
variableReassignments.addAll(other.variableReassignments);
|
||||
|
||||
diagnostics.addAll(other.diagnostics);
|
||||
@NotNull
|
||||
@Override
|
||||
public ErrorHandler getErrorHandler() {
|
||||
return errorHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -240,145 +44,18 @@ public class BindingTraceContext implements BindingTrace {
|
||||
return bindingContext;
|
||||
}
|
||||
|
||||
private <K, V> void safePutAll(Map<K, V> my, Map<K, V> other) {
|
||||
assert keySetIntersection(my, other).isEmpty() : keySetIntersection(my, other);
|
||||
|
||||
my.putAll(other);
|
||||
}
|
||||
|
||||
private <K, V> HashSet<K> keySetIntersection(Map<K, V> my, Map<K, V> other) {
|
||||
HashSet<K> keySet = Sets.newHashSet(my.keySet());
|
||||
keySet.retainAll(other.keySet());
|
||||
return keySet;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@NotNull
|
||||
public ErrorHandlerWithRegions getErrorHandler() {
|
||||
return errorHandler;
|
||||
@Override
|
||||
public <K, V> void record(WritableSlice<K, V> slice, K key, V value) {
|
||||
map.put(slice, key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordExpressionType(@NotNull JetExpression expression, @NotNull JetType type) {
|
||||
safePut(expressionTypes, expression, type);
|
||||
public <K> void record(WritableSlice<K, Boolean> slice, K key) {
|
||||
record(slice, key, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordReferenceResolution(@NotNull JetReferenceExpression expression, @NotNull DeclarationDescriptor descriptor) {
|
||||
resolutionResults.put(expression, descriptor);
|
||||
public <K, V> V get(ReadOnlySlice<K, V> slice, K key) {
|
||||
return map.get(slice, key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordLabelResolution(@NotNull JetReferenceExpression expression, @NotNull PsiElement element) {
|
||||
safePut(labelResolutionResults, expression, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordTypeResolution(@NotNull JetTypeReference typeReference, @NotNull JetType type) {
|
||||
safePut(types, typeReference, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordAnnotationResolution(@NotNull JetAnnotationEntry annotationEntry, @NotNull AnnotationDescriptor annotationDescriptor) {
|
||||
safePut(annotationDescriptos, annotationEntry, annotationDescriptor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordCompileTimeValue(@NotNull JetExpression expression, @NotNull CompileTimeConstant<?> value) {
|
||||
safePut(compileTimeValues, expression, value, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordDeclarationResolution(@NotNull PsiElement declaration, @NotNull DeclarationDescriptor descriptor) {
|
||||
safePut(descriptorToDeclarations, getOriginal(descriptor), declaration);
|
||||
descriptor.accept(new DeclarationDescriptorVisitor<Void, PsiElement>() {
|
||||
@Override
|
||||
public Void visitConstructorDescriptor(ConstructorDescriptor constructorDescriptor, PsiElement declaration) {
|
||||
safePut(constructorDeclarationsToDescriptors, declaration, constructorDescriptor);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void visitNamespaceDescriptor(NamespaceDescriptor descriptor, PsiElement declaration) {
|
||||
safePut(namespaceDeclarationsToDescriptors, declaration, descriptor);
|
||||
return null;
|
||||
}
|
||||
|
||||
public Void visitDeclarationDescriptor(DeclarationDescriptor descriptor, PsiElement declaration) {
|
||||
safePut(declarationsToDescriptors, declaration, getOriginal(descriptor));
|
||||
return null;
|
||||
}
|
||||
}, declaration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordValueParameterAsPropertyResolution(@NotNull JetParameter declaration, @NotNull PropertyDescriptor descriptor) {
|
||||
safePut(primaryConstructorParameterDeclarationsToPropertyDescriptors, declaration, (PropertyDescriptor) getOriginal(descriptor));
|
||||
safePut(descriptorToDeclarations, getOriginal(descriptor), declaration);
|
||||
}
|
||||
|
||||
private <K, V> void safePut(Map<K, V> map, K key, V value) {
|
||||
safePut(map, key, value, false);
|
||||
}
|
||||
|
||||
private <K, V> void safePut(Map<K, V> map, K key, V value, boolean canBeEquals) {
|
||||
V oldValue = map.put(key, value);
|
||||
assert oldValue == null || oldValue == value || (!canBeEquals || oldValue.equals(value)) :
|
||||
(key instanceof PsiElement ? key.toString() + " \"" + ((PsiElement) key).getText() + "\"" : key.toString()) + " -> " + oldValue + " and " + value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requireBackingField(@NotNull PropertyDescriptor propertyDescriptor) {
|
||||
backingFieldRequired.add(propertyDescriptor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordAutoCast(@NotNull JetExpression expression, @NotNull JetType type) {
|
||||
safePut(autoCasts, expression, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordBlock(JetFunctionLiteralExpression expression) {
|
||||
blocks.add(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordStatement(@NotNull JetElement statement) {
|
||||
statements.add(statement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordVariableReassignment(@NotNull JetExpression expression) {
|
||||
variableReassignments.add(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordResolutionScope(@NotNull JetExpression expression, @NotNull JetScope scope) {
|
||||
safePut(resolutionScopes, expression, scope);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeStatementRecord(@NotNull JetElement statement) {
|
||||
statements.remove(statement);
|
||||
}
|
||||
|
||||
private DeclarationDescriptor getOriginal(DeclarationDescriptor declarationDescriptor) {
|
||||
if (declarationDescriptor instanceof VariableAsFunctionDescriptor) {
|
||||
VariableAsFunctionDescriptor descriptor = (VariableAsFunctionDescriptor) declarationDescriptor;
|
||||
return descriptor.getVariableDescriptor().getOriginal();
|
||||
}
|
||||
return declarationDescriptor.getOriginal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markAsProcessed(@NotNull JetExpression expression) {
|
||||
processed.add(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isProcessed(@NotNull JetExpression expression) {
|
||||
return processed.contains(expression);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,254 +0,0 @@
|
||||
package org.jetbrains.jet.lang.resolve;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.JetDiagnostic;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class ChildBindingTrace extends BindingTraceContext {
|
||||
|
||||
private final BindingContext parentBindingContext;
|
||||
|
||||
private final BindingContext bindingContext = new BindingContext() {
|
||||
@Override
|
||||
@Deprecated
|
||||
public DeclarationDescriptor getDeclarationDescriptor(PsiElement declaration) {
|
||||
DeclarationDescriptor value = ChildBindingTrace.super.getBindingContext().getDeclarationDescriptor(declaration);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
return parentBindingContext.getDeclarationDescriptor(declaration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamespaceDescriptor getNamespaceDescriptor(JetNamespace declaration) {
|
||||
NamespaceDescriptor value = ChildBindingTrace.super.getBindingContext().getNamespaceDescriptor(declaration);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
return parentBindingContext.getNamespaceDescriptor(declaration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassDescriptor getClassDescriptor(JetClassOrObject declaration) {
|
||||
ClassDescriptor value = ChildBindingTrace.super.getBindingContext().getClassDescriptor(declaration);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
return parentBindingContext.getClassDescriptor(declaration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypeParameterDescriptor getTypeParameterDescriptor(JetTypeParameter declaration) {
|
||||
TypeParameterDescriptor value = ChildBindingTrace.super.getBindingContext().getTypeParameterDescriptor(declaration);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
return parentBindingContext.getTypeParameterDescriptor(declaration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FunctionDescriptor getFunctionDescriptor(JetNamedFunction declaration) {
|
||||
FunctionDescriptor value = ChildBindingTrace.super.getBindingContext().getFunctionDescriptor(declaration);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
return parentBindingContext.getFunctionDescriptor(declaration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstructorDescriptor getConstructorDescriptor(JetElement declaration) {
|
||||
ConstructorDescriptor value = ChildBindingTrace.super.getBindingContext().getConstructorDescriptor(declaration);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
return parentBindingContext.getConstructorDescriptor(declaration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnnotationDescriptor getAnnotationDescriptor(JetAnnotationEntry annotationEntry) {
|
||||
AnnotationDescriptor value = ChildBindingTrace.super.getBindingContext().getAnnotationDescriptor(annotationEntry);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
return parentBindingContext.getAnnotationDescriptor(annotationEntry);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public CompileTimeConstant<?> getCompileTimeValue(JetExpression expression) {
|
||||
return parentBindingContext.getCompileTimeValue(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VariableDescriptor getVariableDescriptor(JetProperty declaration) {
|
||||
VariableDescriptor value = ChildBindingTrace.super.getBindingContext().getVariableDescriptor(declaration);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
return parentBindingContext.getVariableDescriptor(declaration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VariableDescriptor getVariableDescriptor(JetParameter declaration) {
|
||||
VariableDescriptor value = ChildBindingTrace.super.getBindingContext().getVariableDescriptor(declaration);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
return parentBindingContext.getVariableDescriptor(declaration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyDescriptor getPropertyDescriptor(JetParameter primaryConstructorParameter) {
|
||||
PropertyDescriptor value = ChildBindingTrace.super.getBindingContext().getPropertyDescriptor(primaryConstructorParameter);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
return parentBindingContext.getPropertyDescriptor(primaryConstructorParameter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyDescriptor getPropertyDescriptor(JetObjectDeclarationName objectDeclarationName) {
|
||||
PropertyDescriptor value = ChildBindingTrace.super.getBindingContext().getPropertyDescriptor(objectDeclarationName);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
return parentBindingContext.getPropertyDescriptor(objectDeclarationName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetType getExpressionType(JetExpression expression) {
|
||||
JetType value = ChildBindingTrace.super.getBindingContext().getExpressionType(expression);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
return parentBindingContext.getExpressionType(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeclarationDescriptor resolveReferenceExpression(JetReferenceExpression referenceExpression) {
|
||||
DeclarationDescriptor value = ChildBindingTrace.super.getBindingContext().resolveReferenceExpression(referenceExpression);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
return parentBindingContext.resolveReferenceExpression(referenceExpression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetType resolveTypeReference(JetTypeReference typeReference) {
|
||||
JetType value = ChildBindingTrace.super.getBindingContext().resolveTypeReference(typeReference);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
return parentBindingContext.resolveTypeReference(typeReference);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement resolveToDeclarationPsiElement(JetReferenceExpression referenceExpression) {
|
||||
PsiElement value = ChildBindingTrace.super.getBindingContext().resolveToDeclarationPsiElement(referenceExpression);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
return parentBindingContext.resolveToDeclarationPsiElement(referenceExpression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement getDeclarationPsiElement(DeclarationDescriptor descriptor) {
|
||||
PsiElement value = ChildBindingTrace.super.getBindingContext().getDeclarationPsiElement(descriptor);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
return parentBindingContext.getDeclarationPsiElement(descriptor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlock(JetFunctionLiteralExpression expression) {
|
||||
boolean value = ChildBindingTrace.super.getBindingContext().isBlock(expression);
|
||||
if (!value) {
|
||||
return value;
|
||||
}
|
||||
return parentBindingContext.isBlock(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStatement(JetExpression expression) {
|
||||
boolean value = ChildBindingTrace.super.getBindingContext().isStatement(expression);
|
||||
if (!value) {
|
||||
return value;
|
||||
}
|
||||
return parentBindingContext.isStatement(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBackingField(PropertyDescriptor propertyDescriptor) {
|
||||
boolean value = ChildBindingTrace.super.getBindingContext().hasBackingField(propertyDescriptor);
|
||||
if (!value) {
|
||||
return value;
|
||||
}
|
||||
return parentBindingContext.hasBackingField(propertyDescriptor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVariableReassignment(JetExpression expression) {
|
||||
boolean value = ChildBindingTrace.super.getBindingContext().isVariableReassignment(expression);
|
||||
if (!value) {
|
||||
return value;
|
||||
}
|
||||
return parentBindingContext.isVariableReassignment(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstructorDescriptor resolveSuperConstructor(JetDelegatorToSuperCall superCall) {
|
||||
ConstructorDescriptor value = ChildBindingTrace.super.getBindingContext().resolveSuperConstructor(superCall);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
return parentBindingContext.resolveSuperConstructor(superCall);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JetType getAutoCastType(@NotNull JetExpression expression) {
|
||||
JetType value = ChildBindingTrace.super.getBindingContext().getAutoCastType(expression);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
return parentBindingContext.getAutoCastType(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JetScope getResolutionScope(@NotNull JetExpression expression) {
|
||||
JetScope value = ChildBindingTrace.super.getBindingContext().getResolutionScope(expression);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
return parentBindingContext.getResolutionScope(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<JetDiagnostic> getDiagnostics() {
|
||||
// This deliberately returns only my own diagnostics
|
||||
return ChildBindingTrace.super.getBindingContext().getDiagnostics();
|
||||
}
|
||||
};
|
||||
|
||||
public ChildBindingTrace(BindingContext parent) {
|
||||
this.parentBindingContext = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BindingContext getBindingContext() {
|
||||
return parentBindingContext;
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ public class ClassDescriptorResolver {
|
||||
annotationResolver.resolveAnnotations(scope, classElement.getModifierList()),
|
||||
JetPsiUtil.safeName(classElement.getName()));
|
||||
|
||||
trace.recordDeclarationResolution(classElement, classDescriptor);
|
||||
trace.record(BindingContext.CLASS, classElement, classDescriptor);
|
||||
|
||||
final WritableScope parameterScope = new WritableScopeImpl(scope, classDescriptor, trace.getErrorHandler());
|
||||
|
||||
@@ -134,7 +134,7 @@ public class ClassDescriptorResolver {
|
||||
JetPsiUtil.safeName(typeParameter.getName()),
|
||||
index
|
||||
);
|
||||
trace.recordDeclarationResolution(typeParameter, typeParameterDescriptor);
|
||||
trace.record(BindingContext.TYPE_PARAMETER, typeParameter, typeParameterDescriptor);
|
||||
typeParameters.add(typeParameterDescriptor);
|
||||
index++;
|
||||
}
|
||||
@@ -142,7 +142,7 @@ public class ClassDescriptorResolver {
|
||||
|
||||
descriptor.setOpen(classElement.hasModifier(JetTokens.OPEN_KEYWORD) || classElement.hasModifier(JetTokens.ABSTRACT_KEYWORD));
|
||||
|
||||
trace.recordDeclarationResolution(classElement, descriptor);
|
||||
trace.record(BindingContext.CLASS, classElement, descriptor);
|
||||
}
|
||||
|
||||
public void resolveSupertypes(@NotNull JetClassOrObject jetClass, @NotNull MutableClassDescriptor descriptor) {
|
||||
@@ -151,7 +151,7 @@ public class ClassDescriptorResolver {
|
||||
// TODO : beautify
|
||||
if (jetClass instanceof JetEnumEntry) {
|
||||
JetClassOrObject parent = PsiTreeUtil.getParentOfType(jetClass, JetClassOrObject.class);
|
||||
ClassDescriptor parentDescriptor = trace.getBindingContext().getClassDescriptor(parent);
|
||||
ClassDescriptor parentDescriptor = trace.getBindingContext().get(BindingContext.CLASS, parent);
|
||||
if (parentDescriptor.getTypeConstructor().getParameters().isEmpty()) {
|
||||
defaultSupertype = parentDescriptor.getDefaultType();
|
||||
}
|
||||
@@ -227,7 +227,7 @@ public class ClassDescriptorResolver {
|
||||
valueParameterDescriptors,
|
||||
returnType);
|
||||
|
||||
trace.recordDeclarationResolution(function, functionDescriptor);
|
||||
trace.record(BindingContext.FUNCTION, function, functionDescriptor);
|
||||
return functionDescriptor;
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ public class ClassDescriptorResolver {
|
||||
);
|
||||
// TODO : Default values???
|
||||
|
||||
trace.recordDeclarationResolution(valueParameter, valueParameterDescriptor);
|
||||
trace.record(BindingContext.VALUE_PARAMETER, valueParameter, valueParameterDescriptor);
|
||||
return valueParameterDescriptor;
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ public class ClassDescriptorResolver {
|
||||
);
|
||||
// typeParameterDescriptor.addUpperBound(bound);
|
||||
extensibleScope.addTypeParameterDescriptor(typeParameterDescriptor);
|
||||
trace.recordDeclarationResolution(typeParameter, typeParameterDescriptor);
|
||||
trace.record(BindingContext.TYPE_PARAMETER, typeParameter, typeParameterDescriptor);
|
||||
return typeParameterDescriptor;
|
||||
}
|
||||
|
||||
@@ -330,14 +330,14 @@ public class ClassDescriptorResolver {
|
||||
ClassifierDescriptor classifier = scope.getClassifier(referencedName);
|
||||
if (classifier != null) {
|
||||
trace.getErrorHandler().genericError(subjectTypeParameterName.getNode(), referencedName + " does not refer to a type parameter of " + declaration.getName());
|
||||
trace.recordReferenceResolution(subjectTypeParameterName, classifier);
|
||||
trace.record(BindingContext.REFERENCE_TARGET, subjectTypeParameterName, classifier);
|
||||
}
|
||||
else {
|
||||
trace.getErrorHandler().unresolvedReference(subjectTypeParameterName);
|
||||
}
|
||||
}
|
||||
else {
|
||||
trace.recordReferenceResolution(subjectTypeParameterName, typeParameterDescriptor);
|
||||
trace.record(BindingContext.REFERENCE_TARGET, subjectTypeParameterName, typeParameterDescriptor);
|
||||
JetTypeReference boundTypeReference = constraint.getBoundTypeReference();
|
||||
if (boundTypeReference != null) {
|
||||
JetType bound = resolveAndCheckUpperBoundType(boundTypeReference, scope, constraint.isClassObjectContraint());
|
||||
@@ -430,7 +430,7 @@ public class ClassDescriptorResolver {
|
||||
JetPsiUtil.safeName(parameter.getName()),
|
||||
type,
|
||||
parameter.isMutable());
|
||||
trace.recordDeclarationResolution(parameter, variableDescriptor);
|
||||
trace.record(BindingContext.VALUE_PARAMETER, parameter, variableDescriptor);
|
||||
return variableDescriptor;
|
||||
}
|
||||
|
||||
@@ -449,7 +449,7 @@ public class ClassDescriptorResolver {
|
||||
JetPsiUtil.safeName(property.getName()),
|
||||
type,
|
||||
property.isVar());
|
||||
trace.recordDeclarationResolution(property, variableDescriptor);
|
||||
trace.record(BindingContext.VARIABLE, property, variableDescriptor);
|
||||
return variableDescriptor;
|
||||
}
|
||||
|
||||
@@ -472,7 +472,7 @@ public class ClassDescriptorResolver {
|
||||
|
||||
JetObjectDeclarationName nameAsDeclaration = objectDeclaration.getNameAsDeclaration();
|
||||
if (nameAsDeclaration != null) {
|
||||
trace.recordDeclarationResolution(nameAsDeclaration, propertyDescriptor);
|
||||
trace.record(BindingContext.OBJECT_DECLARATION, nameAsDeclaration, propertyDescriptor);
|
||||
}
|
||||
return propertyDescriptor;
|
||||
}
|
||||
@@ -520,7 +520,7 @@ public class ClassDescriptorResolver {
|
||||
resolvePropertyGetterDescriptor(scopeWithTypeParameters, property, propertyDescriptor),
|
||||
resolvePropertySetterDescriptor(scopeWithTypeParameters, property, propertyDescriptor));
|
||||
|
||||
trace.recordDeclarationResolution(property, propertyDescriptor);
|
||||
trace.record(BindingContext.VARIABLE, property, propertyDescriptor);
|
||||
return propertyDescriptor;
|
||||
}
|
||||
|
||||
@@ -612,7 +612,7 @@ public class ClassDescriptorResolver {
|
||||
MutableValueParameterDescriptor valueParameterDescriptor = resolveValueParameterDescriptor(setterDescriptor, parameter, 0, type);
|
||||
setterDescriptor.initialize(valueParameterDescriptor);
|
||||
}
|
||||
trace.recordDeclarationResolution(setter, setterDescriptor);
|
||||
trace.record(BindingContext.PROPERTY_ACCESSOR, setter, setterDescriptor);
|
||||
}
|
||||
return setterDescriptor;
|
||||
}
|
||||
@@ -633,7 +633,7 @@ public class ClassDescriptorResolver {
|
||||
getterDescriptor = new PropertyGetterDescriptor(
|
||||
resolveModifiers(getter.getModifierList(), DEFAULT_MODIFIERS), // TODO : default modifiers differ in different contexts
|
||||
propertyDescriptor, annotations, returnType, getter.getBodyExpression() != null);
|
||||
trace.recordDeclarationResolution(getter, getterDescriptor);
|
||||
trace.record(BindingContext.PROPERTY_ACCESSOR, getter, getterDescriptor);
|
||||
}
|
||||
return getterDescriptor;
|
||||
}
|
||||
@@ -656,7 +656,7 @@ public class ClassDescriptorResolver {
|
||||
annotationResolver.resolveAnnotations(scope, modifierList),
|
||||
isPrimary
|
||||
);
|
||||
trace.recordDeclarationResolution(declarationToTrace, constructorDescriptor);
|
||||
trace.record(BindingContext.CONSTRUCTOR, declarationToTrace, constructorDescriptor);
|
||||
return constructorDescriptor.initialize(
|
||||
typeParameters,
|
||||
resolveValueParameters(
|
||||
@@ -704,7 +704,7 @@ public class ClassDescriptorResolver {
|
||||
isMutable ? type : null,
|
||||
type);
|
||||
propertyDescriptor.initialize(Collections.<TypeParameterDescriptor>emptyList(), null, null);
|
||||
trace.recordValueParameterAsPropertyResolution(parameter, propertyDescriptor);
|
||||
trace.record(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, parameter, propertyDescriptor);
|
||||
return propertyDescriptor;
|
||||
}
|
||||
|
||||
@@ -971,5 +971,4 @@ public class ClassDescriptorResolver {
|
||||
previousInstruction.accept(visitor);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package org.jetbrains.jet.lang.resolve;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.CollectingErrorHandler;
|
||||
import org.jetbrains.jet.lang.ErrorHandler;
|
||||
import org.jetbrains.jet.lang.JetDiagnostic;
|
||||
import org.jetbrains.jet.util.*;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class TemporaryBindingTrace implements BindingTrace {
|
||||
private final BindingContext parentContext;
|
||||
private final MutableManyMap map = ManyMapImpl.create();
|
||||
private final List<JetDiagnostic> diagnostics = Lists.newArrayList();
|
||||
private final ErrorHandler errorHandler = new CollectingErrorHandler(diagnostics);
|
||||
|
||||
private final BindingContext bindingContext = new BindingContext() {
|
||||
@Override
|
||||
public Collection<JetDiagnostic> getDiagnostics() {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> V get(ReadOnlySlice<K, V> slice, K key) {
|
||||
return TemporaryBindingTrace.this.get(slice, key);
|
||||
}
|
||||
};
|
||||
|
||||
public TemporaryBindingTrace(BindingContext parentContext) {
|
||||
this.parentContext = parentContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public ErrorHandler getErrorHandler() {
|
||||
return errorHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BindingContext getBindingContext() {
|
||||
return bindingContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> void record(WritableSlice<K, V> slice, K key, V value) {
|
||||
map.put(slice, key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K> void record(WritableSlice<K, Boolean> slice, K key) {
|
||||
record(slice, key, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> V get(ReadOnlySlice<K, V> slice, K key) {
|
||||
if (map.containsKey(slice, key)) {
|
||||
return map.get(slice, key);
|
||||
}
|
||||
return parentContext.get(slice, key);
|
||||
}
|
||||
|
||||
public void addAllMyDataTo(BindingTrace trace) {
|
||||
for (Map.Entry<ManyMapKey<?, ?>, ?> entry : map) {
|
||||
ManyMapKey manyMapKey = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
|
||||
//noinspection unchecked
|
||||
trace.record(manyMapKey.getSlice(), manyMapKey.getKey(), value);
|
||||
}
|
||||
|
||||
AnalyzingUtils.applyHandler(trace.getErrorHandler(), diagnostics);
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import org.jetbrains.jet.lang.types.JetStandardClasses;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.lang.types.JetTypeInferrer;
|
||||
import org.jetbrains.jet.lexer.JetTokens;
|
||||
import org.jetbrains.jet.util.WritableSlice;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -47,34 +48,32 @@ public class TopDownAnalyzer {
|
||||
this.trace = bindingTrace;
|
||||
|
||||
// This allows access to backing fields
|
||||
this.traceForConstructors = new BindingTraceAdapter(bindingTrace) {
|
||||
this.traceForConstructors = new BindingTraceAdapter(bindingTrace).addHandler(BindingContext.REFERENCE_TARGET, new BindingTraceAdapter.RecordHandler<JetReferenceExpression, DeclarationDescriptor>() {
|
||||
@Override
|
||||
public void recordReferenceResolution(@NotNull JetReferenceExpression expression, @NotNull DeclarationDescriptor descriptor) {
|
||||
super.recordReferenceResolution(expression, descriptor);
|
||||
public void handleRecord(WritableSlice<JetReferenceExpression, DeclarationDescriptor> slice, JetReferenceExpression expression, DeclarationDescriptor descriptor) {
|
||||
if (expression instanceof JetSimpleNameExpression) {
|
||||
JetSimpleNameExpression simpleNameExpression = (JetSimpleNameExpression) expression;
|
||||
if (simpleNameExpression.getReferencedNameElementType() == JetTokens.FIELD_IDENTIFIER) {
|
||||
if (!trace.getBindingContext().hasBackingField((PropertyDescriptor) descriptor)) {
|
||||
if (!trace.getBindingContext().get(BindingContext.BACKING_FIELD_REQUIRED, (PropertyDescriptor) descriptor)) {
|
||||
TopDownAnalyzer.this.trace.getErrorHandler().genericError(expression.getNode(), "This property does not have a backing field");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
// This tracks access to properties in order to register primary constructor parameters that yield real fields (JET-9)
|
||||
this.traceForMembers = new BindingTraceAdapter(bindingTrace) {
|
||||
this.traceForMembers = new BindingTraceAdapter(bindingTrace).addHandler(BindingContext.REFERENCE_TARGET, new BindingTraceAdapter.RecordHandler<JetReferenceExpression, DeclarationDescriptor>() {
|
||||
@Override
|
||||
public void recordReferenceResolution(@NotNull JetReferenceExpression expression, @NotNull DeclarationDescriptor descriptor) {
|
||||
super.recordReferenceResolution(expression, descriptor);
|
||||
public void handleRecord(WritableSlice<JetReferenceExpression, DeclarationDescriptor> slice, JetReferenceExpression expression, DeclarationDescriptor descriptor) {
|
||||
if (descriptor instanceof PropertyDescriptor) {
|
||||
PropertyDescriptor propertyDescriptor = (PropertyDescriptor) descriptor;
|
||||
if (primaryConstructorParameterProperties.contains(propertyDescriptor)) {
|
||||
requireBackingField(propertyDescriptor);
|
||||
traceForMembers.record(BindingContext.BACKING_FIELD_REQUIRED, propertyDescriptor);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@Deprecated // For JetStandardLibraryOnly
|
||||
@@ -129,8 +128,6 @@ public class TopDownAnalyzer {
|
||||
resolveFunctionAndPropertyHeaders(); // Constructor headers are resolved as well
|
||||
|
||||
resolveBehaviorDeclarationBodies();
|
||||
|
||||
trace.getErrorHandler().close();
|
||||
}
|
||||
|
||||
private void collectNamespacesAndClassifiers(
|
||||
@@ -155,7 +152,7 @@ public class TopDownAnalyzer {
|
||||
);
|
||||
namespaceDescriptor.initialize(new WritableScopeImpl(JetScope.EMPTY, namespaceDescriptor, trace.getErrorHandler()).setDebugName("Namespace member scope"));
|
||||
owner.addNamespace(namespaceDescriptor);
|
||||
trace.recordDeclarationResolution(namespace, namespaceDescriptor);
|
||||
trace.record(BindingContext.NAMESPACE, namespace, namespaceDescriptor);
|
||||
}
|
||||
namespaceDescriptors.put(namespace, namespaceDescriptor);
|
||||
|
||||
@@ -222,7 +219,7 @@ public class TopDownAnalyzer {
|
||||
};
|
||||
visitClassOrObject(declaration, (Map) objects, owner, outerScope, mutableClassDescriptor);
|
||||
createPrimaryConstructor(mutableClassDescriptor);
|
||||
trace.recordDeclarationResolution((PsiElement) declaration, mutableClassDescriptor);
|
||||
trace.record(BindingContext.CLASS, declaration, mutableClassDescriptor);
|
||||
return mutableClassDescriptor;
|
||||
}
|
||||
|
||||
@@ -312,7 +309,7 @@ public class TopDownAnalyzer {
|
||||
}
|
||||
|
||||
if (classifierDescriptor != null) {
|
||||
trace.recordReferenceResolution(referenceExpression, classifierDescriptor);
|
||||
trace.record(BindingContext.REFERENCE_TARGET, referenceExpression, classifierDescriptor);
|
||||
|
||||
String aliasName = importDirective.getAliasName();
|
||||
String importedClassifierName = aliasName != null ? aliasName : classifierDescriptor.getName();
|
||||
@@ -356,7 +353,7 @@ public class TopDownAnalyzer {
|
||||
for (JetDelegationSpecifier delegationSpecifier : jetClass.getDelegationSpecifiers()) {
|
||||
JetTypeReference typeReference = delegationSpecifier.getTypeReference();
|
||||
if (typeReference != null) {
|
||||
JetType type = trace.getBindingContext().resolveTypeReference(typeReference);
|
||||
JetType type = trace.getBindingContext().get(BindingContext.TYPE, typeReference);
|
||||
classDescriptorResolver.checkBounds(typeReference, type);
|
||||
}
|
||||
}
|
||||
@@ -364,7 +361,7 @@ public class TopDownAnalyzer {
|
||||
for (JetTypeParameter jetTypeParameter : jetClass.getTypeParameters()) {
|
||||
JetTypeReference extendsBound = jetTypeParameter.getExtendsBound();
|
||||
if (extendsBound != null) {
|
||||
JetType type = trace.getBindingContext().resolveTypeReference(extendsBound);
|
||||
JetType type = trace.getBindingContext().get(BindingContext.TYPE, extendsBound);
|
||||
if (type != null) {
|
||||
classDescriptorResolver.checkBounds(extendsBound, type);
|
||||
}
|
||||
@@ -374,7 +371,7 @@ public class TopDownAnalyzer {
|
||||
for (JetTypeConstraint constraint : jetClass.getTypeConstaints()) {
|
||||
JetTypeReference extendsBound = constraint.getBoundTypeReference();
|
||||
if (extendsBound != null) {
|
||||
JetType type = trace.getBindingContext().resolveTypeReference(extendsBound);
|
||||
JetType type = trace.getBindingContext().get(BindingContext.TYPE, extendsBound);
|
||||
if (type != null) {
|
||||
classDescriptorResolver.checkBounds(extendsBound, type);
|
||||
}
|
||||
@@ -534,7 +531,7 @@ public class TopDownAnalyzer {
|
||||
JetClass jetClass = entry.getKey();
|
||||
if (classDescriptor.getUnsubstitutedPrimaryConstructor() == null) {
|
||||
for (PropertyDescriptor propertyDescriptor : classDescriptor.getProperties()) {
|
||||
if (trace.getBindingContext().hasBackingField(propertyDescriptor)) {
|
||||
if ((boolean) trace.getBindingContext().get(BindingContext.BACKING_FIELD_REQUIRED, propertyDescriptor)) {
|
||||
PsiElement nameIdentifier = jetClass.getNameIdentifier();
|
||||
if (nameIdentifier != null) {
|
||||
trace.getErrorHandler().genericError(nameIdentifier.getNode(),
|
||||
@@ -572,7 +569,7 @@ public class TopDownAnalyzer {
|
||||
if (delegateExpression != null) {
|
||||
JetScope scope = scopeForConstructor == null ? descriptor.getScopeForMemberResolution() : scopeForConstructor;
|
||||
JetType type = typeInferrer.getType(scope, delegateExpression, false, JetTypeInferrer.NO_EXPECTED_TYPE);
|
||||
JetType supertype = trace.getBindingContext().resolveTypeReference(specifier.getTypeReference());
|
||||
JetType supertype = trace.getBindingContext().get(BindingContext.TYPE, specifier.getTypeReference());
|
||||
if (type != null && !semanticServices.getTypeChecker().isSubtypeOf(type, supertype)) { // TODO : Convertible?
|
||||
trace.getErrorHandler().typeMismatch(delegateExpression, supertype, type);
|
||||
}
|
||||
@@ -597,7 +594,7 @@ public class TopDownAnalyzer {
|
||||
|
||||
@Override
|
||||
public void visitDelegationToSuperClassSpecifier(JetDelegatorToSuperClass specifier) {
|
||||
JetType supertype = trace.getBindingContext().resolveTypeReference(specifier.getTypeReference());
|
||||
JetType supertype = trace.getBindingContext().get(BindingContext.TYPE, specifier.getTypeReference());
|
||||
if (supertype != null) {
|
||||
DeclarationDescriptor declarationDescriptor = supertype.getConstructor().getDeclarationDescriptor();
|
||||
if (declarationDescriptor instanceof ClassDescriptor) {
|
||||
@@ -747,7 +744,7 @@ public class TopDownAnalyzer {
|
||||
constructorScope.setThisType(descriptor.getContainingDeclaration().getDefaultType());
|
||||
|
||||
for (ValueParameterDescriptor valueParameterDescriptor : descriptor.getValueParameters()) {
|
||||
JetParameter parameter = (JetParameter) trace.getBindingContext().getDeclarationPsiElement(valueParameterDescriptor);
|
||||
JetParameter parameter = (JetParameter) trace.getBindingContext().get(BindingContext.DESCRIPTOR_TO_DECLARATION, valueParameterDescriptor);
|
||||
if (parameter.getValOrVarNode() == null || !primary) {
|
||||
constructorScope.addVariableDescriptor(valueParameterDescriptor);
|
||||
}
|
||||
@@ -837,27 +834,26 @@ public class TopDownAnalyzer {
|
||||
}
|
||||
|
||||
JetExpression initializer = property.getInitializer();
|
||||
if (!property.isVar() && initializer != null && !trace.getBindingContext().hasBackingField(propertyDescriptor)) {
|
||||
if (!property.isVar() && initializer != null && !trace.getBindingContext().get(BindingContext.BACKING_FIELD_REQUIRED, propertyDescriptor)) {
|
||||
trace.getErrorHandler().genericError(initializer.getNode(), "Initializer is not allowed here because this property has no setter and no backing field either");
|
||||
}
|
||||
}
|
||||
|
||||
private BindingTraceAdapter createFieldTrackingTrace(final PropertyDescriptor propertyDescriptor) {
|
||||
return new BindingTraceAdapter(traceForMembers) {
|
||||
return new BindingTraceAdapter(traceForMembers).addHandler(BindingContext.REFERENCE_TARGET, new BindingTraceAdapter.RecordHandler<JetReferenceExpression, DeclarationDescriptor>() {
|
||||
@Override
|
||||
public void recordReferenceResolution(@NotNull JetReferenceExpression expression, @NotNull DeclarationDescriptor descriptor) {
|
||||
super.recordReferenceResolution(expression, descriptor);
|
||||
public void handleRecord(WritableSlice<JetReferenceExpression, DeclarationDescriptor> slice, JetReferenceExpression expression, DeclarationDescriptor descriptor) {
|
||||
if (expression instanceof JetSimpleNameExpression) {
|
||||
JetSimpleNameExpression simpleNameExpression = (JetSimpleNameExpression) expression;
|
||||
if (simpleNameExpression.getReferencedNameElementType() == JetTokens.FIELD_IDENTIFIER) {
|
||||
// This check may be considered redundant as long as $x is only accessible from accessors to $x
|
||||
if (descriptor == propertyDescriptor) { // TODO : original?
|
||||
requireBackingField(propertyDescriptor);
|
||||
traceForMembers.record(BindingContext.BACKING_FIELD_REQUIRED, propertyDescriptor); // TODO: this trace?
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
private void resolvePropertyInitializer(JetProperty property, PropertyDescriptor propertyDescriptor, JetExpression initializer, JetScope scope) {
|
||||
|
||||
@@ -31,14 +31,14 @@ public class TypeResolver {
|
||||
|
||||
@NotNull
|
||||
public JetType resolveType(@NotNull final JetScope scope, @NotNull final JetTypeReference typeReference) {
|
||||
JetType cachedType = trace.getBindingContext().resolveTypeReference(typeReference);
|
||||
JetType cachedType = trace.getBindingContext().get(BindingContext.TYPE, typeReference);
|
||||
if (cachedType != null) return cachedType;
|
||||
|
||||
final List<AnnotationDescriptor> annotations = annotationResolver.createAnnotationStubs(typeReference.getAnnotations());
|
||||
|
||||
JetTypeElement typeElement = typeReference.getTypeElement();
|
||||
JetType type = resolveTypeElement(scope, annotations, typeElement, false);
|
||||
trace.recordTypeResolution(typeReference, type);
|
||||
trace.record(BindingContext.TYPE, typeReference, type);
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class TypeResolver {
|
||||
if (classifierDescriptor instanceof TypeParameterDescriptor) {
|
||||
TypeParameterDescriptor typeParameterDescriptor = (TypeParameterDescriptor) classifierDescriptor;
|
||||
|
||||
trace.recordReferenceResolution(referenceExpression, typeParameterDescriptor);
|
||||
trace.record(BindingContext.REFERENCE_TARGET, referenceExpression, typeParameterDescriptor);
|
||||
|
||||
result[0] = new JetTypeImpl(
|
||||
annotations,
|
||||
@@ -72,8 +72,8 @@ public class TypeResolver {
|
||||
}
|
||||
else if (classifierDescriptor instanceof ClassDescriptor) {
|
||||
ClassDescriptor classDescriptor = (ClassDescriptor) classifierDescriptor;
|
||||
|
||||
trace.recordReferenceResolution(referenceExpression, classifierDescriptor);
|
||||
|
||||
trace.record(BindingContext.REFERENCE_TARGET, referenceExpression, classifierDescriptor);
|
||||
TypeConstructor typeConstructor = classifierDescriptor.getTypeConstructor();
|
||||
List<TypeProjection> arguments = resolveTypeProjections(scope, typeConstructor, type.getTypeArguments());
|
||||
List<TypeParameterDescriptor> parameters = typeConstructor.getParameters();
|
||||
@@ -289,7 +289,7 @@ public class TypeResolver {
|
||||
|
||||
NamespaceDescriptor namespace = scope.getNamespace(userType.getReferencedName());
|
||||
if (namespace != null) {
|
||||
trace.recordReferenceResolution(userType.getReferenceExpression(), namespace);
|
||||
trace.record(BindingContext.REFERENCE_TARGET, userType.getReferenceExpression(), namespace);
|
||||
}
|
||||
return namespace;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.types.*;
|
||||
|
||||
import java.util.*;
|
||||
@@ -122,7 +123,7 @@ public class JavaDescriptorResolver {
|
||||
constructorDescriptor.initialize(typeParameters, Collections.<ValueParameterDescriptor>emptyList());
|
||||
constructorDescriptor.setReturnType(classDescriptor.getDefaultType());
|
||||
classDescriptor.addConstructor(constructorDescriptor);
|
||||
semanticServices.getTrace().recordDeclarationResolution(psiClass, constructorDescriptor);
|
||||
semanticServices.getTrace().record(BindingContext.CONSTRUCTOR, psiClass, constructorDescriptor);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -134,11 +135,11 @@ public class JavaDescriptorResolver {
|
||||
constructorDescriptor.initialize(typeParameters, resolveParameterDescriptors(constructorDescriptor, constructor.getParameterList().getParameters()));
|
||||
constructorDescriptor.setReturnType(classDescriptor.getDefaultType());
|
||||
classDescriptor.addConstructor(constructorDescriptor);
|
||||
semanticServices.getTrace().recordDeclarationResolution(constructor, constructorDescriptor);
|
||||
semanticServices.getTrace().record(BindingContext.CONSTRUCTOR, constructor, constructorDescriptor);
|
||||
}
|
||||
}
|
||||
|
||||
semanticServices.getTrace().recordDeclarationResolution(psiClass, classDescriptor);
|
||||
semanticServices.getTrace().record(BindingContext.CLASS, psiClass, classDescriptor);
|
||||
|
||||
return classDescriptor;
|
||||
}
|
||||
@@ -230,7 +231,7 @@ public class JavaDescriptorResolver {
|
||||
psiPackage.getName()
|
||||
);
|
||||
namespaceDescriptor.setMemberScope(new JavaPackageScope(psiPackage.getQualifiedName(), namespaceDescriptor, semanticServices));
|
||||
semanticServices.getTrace().recordDeclarationResolution(psiPackage, namespaceDescriptor);
|
||||
semanticServices.getTrace().record(BindingContext.NAMESPACE, psiPackage, namespaceDescriptor);
|
||||
return namespaceDescriptor;
|
||||
}
|
||||
|
||||
@@ -241,7 +242,7 @@ public class JavaDescriptorResolver {
|
||||
psiClass.getName()
|
||||
);
|
||||
namespaceDescriptor.setMemberScope(new JavaClassMembersScope(namespaceDescriptor, psiClass, semanticServices, true));
|
||||
semanticServices.getTrace().recordDeclarationResolution(psiClass, namespaceDescriptor);
|
||||
semanticServices.getTrace().record(BindingContext.NAMESPACE, psiClass, namespaceDescriptor);
|
||||
return namespaceDescriptor;
|
||||
}
|
||||
|
||||
@@ -280,7 +281,7 @@ public class JavaDescriptorResolver {
|
||||
field.getName(),
|
||||
isFinal ? null : type,
|
||||
type);
|
||||
semanticServices.getTrace().recordDeclarationResolution(field, propertyDescriptor);
|
||||
semanticServices.getTrace().record(BindingContext.VARIABLE, field, propertyDescriptor);
|
||||
fieldDescriptorCache.put(field, propertyDescriptor);
|
||||
return propertyDescriptor;
|
||||
}
|
||||
@@ -344,7 +345,7 @@ public class JavaDescriptorResolver {
|
||||
semanticServices.getDescriptorResolver().resolveParameterDescriptors(functionDescriptorImpl, parameters),
|
||||
semanticServices.getTypeTransformer().transformToType(returnType)
|
||||
);
|
||||
semanticServices.getTrace().recordDeclarationResolution(method, functionDescriptorImpl);
|
||||
semanticServices.getTrace().record(BindingContext.FUNCTION, method, functionDescriptorImpl);
|
||||
FunctionDescriptor substitutedFunctionDescriptor = functionDescriptorImpl;
|
||||
if (method.getContainingClass() != psiClass) {
|
||||
substitutedFunctionDescriptor = functionDescriptorImpl.substitute(typeSubstitutorForGenericSuperclasses);
|
||||
|
||||
@@ -144,7 +144,7 @@ public class ErrorUtils {
|
||||
);
|
||||
}
|
||||
|
||||
private static final JetType ERROR_PARAMETER_TYPE = createErrorType("<ERROR PARAMETER TYPE>");
|
||||
private static final JetType ERROR_PARAMETER_TYPE = createErrorType("<ERROR VALUE_PARAMETER TYPE>");
|
||||
private static List<ValueParameterDescriptor> getValueParameters(FunctionDescriptor functionDescriptor, List<JetType> argumentTypes) {
|
||||
List<ValueParameterDescriptor> result = new ArrayList<ValueParameterDescriptor>();
|
||||
for (int i = 0, argumentTypesSize = argumentTypes.size(); i < argumentTypesSize; i++) {
|
||||
@@ -152,7 +152,7 @@ public class ErrorUtils {
|
||||
functionDescriptor,
|
||||
i,
|
||||
Collections.<AnnotationDescriptor>emptyList(),
|
||||
"<ERROR PARAMETER>",
|
||||
"<ERROR VALUE_PARAMETER>",
|
||||
ERROR_PARAMETER_TYPE,
|
||||
ERROR_PARAMETER_TYPE,
|
||||
false,
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.JetNodeTypes;
|
||||
import org.jetbrains.jet.lang.ErrorHandlerWithRegions;
|
||||
import org.jetbrains.jet.lang.JetSemanticServices;
|
||||
import org.jetbrains.jet.lang.cfg.JetFlowInformationProvider;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
@@ -20,13 +19,16 @@ import org.jetbrains.jet.lang.resolve.*;
|
||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstantResolver;
|
||||
import org.jetbrains.jet.lang.resolve.constants.ErrorValue;
|
||||
import org.jetbrains.jet.lang.resolve.constants.StringValue;
|
||||
import org.jetbrains.jet.lang.types.inference.ConstraintSystem;
|
||||
import org.jetbrains.jet.lexer.JetTokens;
|
||||
import org.jetbrains.jet.resolve.DescriptorRenderer;
|
||||
import org.jetbrains.jet.lang.resolve.constants.StringValue;
|
||||
import org.jetbrains.jet.util.WritableSlice;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.jet.lang.resolve.BindingContext.STATEMENT;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
@@ -177,11 +179,11 @@ public class JetTypeInferrer {
|
||||
|
||||
@Nullable
|
||||
public JetType getType(@NotNull final JetScope scope, @NotNull JetExpression expression, boolean preferBlock, @NotNull JetType expectedType) {
|
||||
return typeInferrerVisitor.getType(expression, new TypeInferenceContext(trace, scope, this, preferBlock, DataFlowInfo.getEmpty(), expectedType, FORBIDDEN));
|
||||
return typeInferrerVisitor.getType(expression, new TypeInferenceContext(trace, scope, preferBlock, DataFlowInfo.getEmpty(), expectedType, FORBIDDEN));
|
||||
}
|
||||
|
||||
public JetType getTypeWithNamespaces(@NotNull final JetScope scope, @NotNull JetExpression expression, boolean preferBlock) {
|
||||
return typeInferrerVisitorWithNamespaces.getType(expression, new TypeInferenceContext(trace, scope, this, preferBlock, DataFlowInfo.getEmpty(), NO_EXPECTED_TYPE, NO_EXPECTED_TYPE));
|
||||
return typeInferrerVisitorWithNamespaces.getType(expression, new TypeInferenceContext(trace, scope, preferBlock, DataFlowInfo.getEmpty(), NO_EXPECTED_TYPE, NO_EXPECTED_TYPE));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -322,7 +324,7 @@ public class JetTypeInferrer {
|
||||
|
||||
private void report(OverloadResolutionResult resolutionResult) {
|
||||
if (resolutionResult.isSuccess() || resolutionResult.singleFunction()) {
|
||||
trace.recordReferenceResolution(referenceExpression, resolutionResult.getFunctionDescriptor());
|
||||
trace.record(BindingContext.REFERENCE_TARGET, referenceExpression, resolutionResult.getFunctionDescriptor());
|
||||
}
|
||||
if (reportErrors) {
|
||||
switch (resolutionResult.getResultCode()) {
|
||||
@@ -376,7 +378,7 @@ public class JetTypeInferrer {
|
||||
// return; // The function returns Nothing
|
||||
// }
|
||||
// for (Map.Entry<JetElement, JetType> entry : typeMap.entrySet()) {
|
||||
// JetType actualType = entry.getValue();
|
||||
// JetType actualType = entry.castValue();
|
||||
// JetElement element = entry.getKey();
|
||||
// JetTypeChecker typeChecker = semanticServices.getTypeChecker();
|
||||
// if (!typeChecker.isSubtypeOf(actualType, expectedReturnType)) {
|
||||
@@ -415,8 +417,8 @@ public class JetTypeInferrer {
|
||||
final boolean blockBody = function.hasBlockBody();
|
||||
final TypeInferenceContext context =
|
||||
blockBody
|
||||
? new TypeInferenceContext(trace, functionInnerScope, this, function.hasBlockBody(), dataFlowInfo, NO_EXPECTED_TYPE, expectedReturnType)
|
||||
: new TypeInferenceContext(trace, functionInnerScope, this, function.hasBlockBody(), dataFlowInfo, expectedReturnType, FORBIDDEN);
|
||||
? new TypeInferenceContext(trace, functionInnerScope, function.hasBlockBody(), dataFlowInfo, NO_EXPECTED_TYPE, expectedReturnType)
|
||||
: new TypeInferenceContext(trace, functionInnerScope, function.hasBlockBody(), dataFlowInfo, expectedReturnType, FORBIDDEN);
|
||||
|
||||
typeInferrerVisitor.getType(bodyExpression, context);
|
||||
|
||||
@@ -485,14 +487,14 @@ public class JetTypeInferrer {
|
||||
JetExpression bodyExpression = function.getBodyExpression();
|
||||
assert bodyExpression != null;
|
||||
JetScope functionInnerScope = FunctionDescriptorUtil.getFunctionInnerScope(outerScope, functionDescriptor, trace);
|
||||
typeInferrerVisitor.getType(bodyExpression, new TypeInferenceContext(trace, functionInnerScope, this, function.hasBlockBody(), DataFlowInfo.getEmpty(), NO_EXPECTED_TYPE, FORBIDDEN));
|
||||
typeInferrerVisitor.getType(bodyExpression, new TypeInferenceContext(trace, functionInnerScope, function.hasBlockBody(), DataFlowInfo.getEmpty(), NO_EXPECTED_TYPE, FORBIDDEN));
|
||||
Collection<JetExpression> returnedExpressions = new ArrayList<JetExpression>();
|
||||
Collection<JetElement> elementsReturningUnit = new ArrayList<JetElement>();
|
||||
flowInformationProvider.collectReturnedInformation(function.asElement(), returnedExpressions, elementsReturningUnit);
|
||||
Map<JetElement,JetType> typeMap = new HashMap<JetElement, JetType>();
|
||||
for (JetExpression returnedExpression : returnedExpressions) {
|
||||
JetType cachedType = trace.getBindingContext().getExpressionType(returnedExpression);
|
||||
trace.removeStatementRecord(returnedExpression);
|
||||
JetType cachedType = trace.getBindingContext().get(BindingContext.EXPRESSION_TYPE, returnedExpression);
|
||||
trace.record(STATEMENT, returnedExpression, false);
|
||||
if (cachedType != null) {
|
||||
typeMap.put(returnedExpression, cachedType);
|
||||
}
|
||||
@@ -509,16 +511,16 @@ public class JetTypeInferrer {
|
||||
}
|
||||
|
||||
TypeInferrerVisitorWithWritableScope blockLevelVisitor = newTypeInferrerVisitorWithWritableScope(scope);
|
||||
TypeInferenceContext newContext = new TypeInferenceContext(trace, scope, this, true, context.dataFlowInfo, NO_EXPECTED_TYPE, context.expectedReturnType);
|
||||
TypeInferenceContext newContext = new TypeInferenceContext(trace, scope, true, context.dataFlowInfo, NO_EXPECTED_TYPE, context.expectedReturnType);
|
||||
|
||||
JetType result = null;
|
||||
for (Iterator<? extends JetElement> iterator = block.iterator(); iterator.hasNext(); ) {
|
||||
JetElement statement = iterator.next();
|
||||
trace.recordStatement(statement);
|
||||
trace.record(STATEMENT, statement);
|
||||
JetExpression statementExpression = (JetExpression) statement;
|
||||
//TODO constructor assert context.expectedType != FORBIDDEN : ""
|
||||
if (!iterator.hasNext() && context.expectedType != NO_EXPECTED_TYPE) {
|
||||
newContext = new TypeInferenceContext(trace, scope, this, true, newContext.dataFlowInfo, context.expectedType, context.expectedReturnType);
|
||||
newContext = new TypeInferenceContext(trace, scope, true, newContext.dataFlowInfo, context.expectedType, context.expectedReturnType);
|
||||
}
|
||||
|
||||
result = blockLevelVisitor.getType(statementExpression, newContext);
|
||||
@@ -527,7 +529,7 @@ public class JetTypeInferrer {
|
||||
newDataFlowInfo = context.dataFlowInfo;
|
||||
}
|
||||
if (newDataFlowInfo != context.dataFlowInfo) {
|
||||
newContext = new TypeInferenceContext(trace, scope, this, true, newDataFlowInfo, NO_EXPECTED_TYPE, context.expectedReturnType);
|
||||
newContext = new TypeInferenceContext(trace, scope, true, newDataFlowInfo, NO_EXPECTED_TYPE, context.expectedReturnType);
|
||||
}
|
||||
blockLevelVisitor.resetResult(); // TODO : maybe it's better to recreate the visitors with the same scope?
|
||||
}
|
||||
@@ -784,7 +786,7 @@ public class JetTypeInferrer {
|
||||
if (constructorReturnedType == null && !ErrorUtils.isErrorType(receiverType)) {
|
||||
DeclarationDescriptor declarationDescriptor = receiverType.getConstructor().getDeclarationDescriptor();
|
||||
assert declarationDescriptor != null;
|
||||
trace.recordReferenceResolution(referenceExpression, declarationDescriptor);
|
||||
trace.record(BindingContext.REFERENCE_TARGET, referenceExpression, declarationDescriptor);
|
||||
// TODO : more helpful message
|
||||
JetValueArgumentList argumentList = call.getValueArgumentList();
|
||||
final String errorMessage = "Cannot find a constructor overload for class " + classDescriptor.getName() + " with these arguments";
|
||||
@@ -851,7 +853,7 @@ public class JetTypeInferrer {
|
||||
if (!semanticServices.getTypeChecker().isSubtypeOf(enrichedType, context.expectedType)) {
|
||||
context.trace.getErrorHandler().typeMismatch(expression, context.expectedType, expressionType);
|
||||
} else {
|
||||
context.trace.recordAutoCast(expression, context.expectedType);
|
||||
context.trace.record(BindingContext.AUTOCAST, expression, context.expectedType);
|
||||
}
|
||||
return enrichedType;
|
||||
}
|
||||
@@ -879,7 +881,7 @@ public class JetTypeInferrer {
|
||||
VariableDescriptor variableDescriptor = null;
|
||||
if (receiverExpression instanceof JetSimpleNameExpression) {
|
||||
JetSimpleNameExpression nameExpression = (JetSimpleNameExpression) receiverExpression;
|
||||
DeclarationDescriptor declarationDescriptor = context.trace.getBindingContext().resolveReferenceExpression(nameExpression);
|
||||
DeclarationDescriptor declarationDescriptor = context.trace.getBindingContext().get(BindingContext.REFERENCE_TARGET, nameExpression);
|
||||
if (declarationDescriptor instanceof VariableDescriptor) {
|
||||
variableDescriptor = (VariableDescriptor) declarationDescriptor;
|
||||
}
|
||||
@@ -907,7 +909,6 @@ public class JetTypeInferrer {
|
||||
private TypeInferenceContext(
|
||||
@NotNull BindingTrace trace,
|
||||
@NotNull JetScope scope,
|
||||
@NotNull Services services,
|
||||
boolean preferBlock,
|
||||
@NotNull DataFlowInfo dataFlowInfo,
|
||||
@NotNull JetType expectedType,
|
||||
@@ -916,7 +917,7 @@ public class JetTypeInferrer {
|
||||
this.typeResolver = new TypeResolver(semanticServices, trace, true);
|
||||
this.classDescriptorResolver = semanticServices.getClassDescriptorResolver(trace);
|
||||
this.scope = scope;
|
||||
this.services = services;
|
||||
this.services = getServices(trace);
|
||||
this.preferBlock = preferBlock;
|
||||
this.dataFlowInfo = dataFlowInfo;
|
||||
this.expectedType = expectedType;
|
||||
@@ -925,19 +926,24 @@ public class JetTypeInferrer {
|
||||
}
|
||||
|
||||
public TypeInferenceContext replaceDataFlowInfo(DataFlowInfo newDataFlowInfo) {
|
||||
return new TypeInferenceContext(trace, scope, services, preferBlock, newDataFlowInfo, expectedType, expectedReturnType);
|
||||
return new TypeInferenceContext(trace, scope, preferBlock, newDataFlowInfo, expectedType, expectedReturnType);
|
||||
}
|
||||
|
||||
public TypeInferenceContext replaceExpectedType(@Nullable JetType newExpectedType) {
|
||||
if (newExpectedType == null) return replaceExpectedType(NO_EXPECTED_TYPE);
|
||||
if (expectedType == newExpectedType) return this;
|
||||
return new TypeInferenceContext(trace, scope, services, preferBlock, dataFlowInfo, newExpectedType, expectedReturnType);
|
||||
return new TypeInferenceContext(trace, scope, preferBlock, dataFlowInfo, newExpectedType, expectedReturnType);
|
||||
}
|
||||
|
||||
public TypeInferenceContext replaceExpectedReturnType(@Nullable JetType newExpectedReturnType) {
|
||||
if (newExpectedReturnType == null) return replaceExpectedReturnType(NO_EXPECTED_TYPE);
|
||||
if (expectedReturnType == newExpectedReturnType) return this;
|
||||
return new TypeInferenceContext(trace, scope, services, preferBlock, dataFlowInfo, expectedType, newExpectedReturnType);
|
||||
return new TypeInferenceContext(trace, scope, preferBlock, dataFlowInfo, expectedType, newExpectedReturnType);
|
||||
}
|
||||
|
||||
public TypeInferenceContext replaceBindingTrace(@NotNull BindingTrace newTrace) {
|
||||
if (newTrace == trace) return this;
|
||||
return new TypeInferenceContext(newTrace, scope, preferBlock, dataFlowInfo, expectedType, expectedReturnType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -952,31 +958,31 @@ public class JetTypeInferrer {
|
||||
|
||||
@Nullable
|
||||
public JetType getType(@NotNull JetScope scope, @NotNull JetExpression expression, boolean preferBlock, TypeInferenceContext context) {
|
||||
return getType(expression, new TypeInferenceContext(context.trace, scope, context.services, preferBlock, context.dataFlowInfo, context.expectedType, context.expectedReturnType));
|
||||
return getType(expression, new TypeInferenceContext(context.trace, scope, preferBlock, context.dataFlowInfo, context.expectedType, context.expectedReturnType));
|
||||
}
|
||||
|
||||
private JetType getTypeWithNewDataFlowInfo(JetScope scope, JetExpression expression, boolean preferBlock, @NotNull DataFlowInfo newDataFlowInfo, TypeInferenceContext context) {
|
||||
return getType(expression, new TypeInferenceContext(context.trace, scope, context.services, preferBlock, newDataFlowInfo, context.expectedType, context.expectedReturnType));
|
||||
return getType(expression, new TypeInferenceContext(context.trace, scope, preferBlock, newDataFlowInfo, context.expectedType, context.expectedReturnType));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final JetType getType(@NotNull JetExpression expression, TypeInferenceContext context) {
|
||||
if (context.trace.isProcessed(expression)) {
|
||||
return context.trace.getBindingContext().getExpressionType(expression);
|
||||
if (context.trace.get(BindingContext.PROCESSED, expression)) {
|
||||
return context.trace.getBindingContext().get(BindingContext.EXPRESSION_TYPE, expression);
|
||||
}
|
||||
JetType result;
|
||||
try {
|
||||
result = expression.visit(this, context);
|
||||
// Some recursive definitions (object expressions) must put their types in the cache manually:
|
||||
if (context.trace.isProcessed(expression)) {
|
||||
return context.trace.getBindingContext().getExpressionType(expression);
|
||||
if ((boolean) context.trace.get(BindingContext.PROCESSED, expression)) {
|
||||
return context.trace.getBindingContext().get(BindingContext.EXPRESSION_TYPE, expression);
|
||||
}
|
||||
|
||||
if (result instanceof DeferredType) {
|
||||
result = ((DeferredType) result).getActualType();
|
||||
}
|
||||
if (result != null) {
|
||||
context.trace.recordExpressionType(expression, result);
|
||||
context.trace.record(BindingContext.EXPRESSION_TYPE, expression, result);
|
||||
if (JetStandardClasses.isNothing(result) && !result.isNullable()) {
|
||||
markDominatedExpressionsAsUnreachable(expression, context);
|
||||
}
|
||||
@@ -987,10 +993,10 @@ public class JetTypeInferrer {
|
||||
result = null;
|
||||
}
|
||||
|
||||
if (!context.trace.isProcessed(expression)) {
|
||||
context.trace.recordResolutionScope(expression, context.scope);
|
||||
if (!(boolean) context.trace.get(BindingContext.PROCESSED, expression)) {
|
||||
context.trace.record(BindingContext.RESOLUTION_SCOPE, expression, context.scope);
|
||||
}
|
||||
context.trace.markAsProcessed(expression);
|
||||
context.trace.record(BindingContext.PROCESSED, expression);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1038,7 +1044,7 @@ public class JetTypeInferrer {
|
||||
context.trace.getErrorHandler().unresolvedReference(expression);
|
||||
}
|
||||
else {
|
||||
context.trace.recordReferenceResolution(expression, property);
|
||||
context.trace.record(BindingContext.REFERENCE_TARGET, expression, property);
|
||||
return context.services.checkEnrichedType(property.getOutType(), expression, context);
|
||||
}
|
||||
}
|
||||
@@ -1047,7 +1053,7 @@ public class JetTypeInferrer {
|
||||
if (referencedName != null) {
|
||||
VariableDescriptor variable = context.scope.getVariable(referencedName);
|
||||
if (variable != null) {
|
||||
context.trace.recordReferenceResolution(expression, variable);
|
||||
context.trace.record(BindingContext.REFERENCE_TARGET, expression, variable);
|
||||
JetType result = variable.getOutType();
|
||||
if (result == null) {
|
||||
context.trace.getErrorHandler().genericError(expression.getNode(), "This variable is not readable in this context");
|
||||
@@ -1065,7 +1071,7 @@ public class JetTypeInferrer {
|
||||
else {
|
||||
context.trace.getErrorHandler().genericError(expression.getNode(), "Classifier " + classifier.getName() + " does not have a class object");
|
||||
}
|
||||
context.trace.recordReferenceResolution(expression, classifier);
|
||||
context.trace.record(BindingContext.REFERENCE_TARGET, expression, classifier);
|
||||
return context.services.checkEnrichedType(result, expression, context);
|
||||
}
|
||||
else {
|
||||
@@ -1101,16 +1107,17 @@ public class JetTypeInferrer {
|
||||
if (namespace == null) {
|
||||
return null;
|
||||
}
|
||||
context.trace.recordReferenceResolution(expression, namespace);
|
||||
context.trace.record(BindingContext.REFERENCE_TARGET, expression, namespace);
|
||||
return namespace.getNamespaceType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetType visitObjectLiteralExpression(final JetObjectLiteralExpression expression, final TypeInferenceContext context) {
|
||||
final JetType[] result = new JetType[1];
|
||||
TopDownAnalyzer topDownAnalyzer = new TopDownAnalyzer(semanticServices, new BindingTraceAdapter(context.trace) {
|
||||
BindingTraceAdapter.RecordHandler<PsiElement, DeclarationDescriptor> handler = new BindingTraceAdapter.RecordHandler<PsiElement, DeclarationDescriptor>() {
|
||||
|
||||
@Override
|
||||
public void recordDeclarationResolution(@NotNull PsiElement declaration, @NotNull final DeclarationDescriptor descriptor) {
|
||||
public void handleRecord(WritableSlice<PsiElement, DeclarationDescriptor> slice, PsiElement declaration, final DeclarationDescriptor descriptor) {
|
||||
if (declaration == expression.getObjectDeclaration()) {
|
||||
JetType defaultType = new DeferredType(new LazyValue<JetType>() {
|
||||
@Override
|
||||
@@ -1119,14 +1126,19 @@ public class JetTypeInferrer {
|
||||
}
|
||||
});
|
||||
result[0] = defaultType;
|
||||
if (!context.trace.isProcessed(expression)) {
|
||||
recordExpressionType(expression, defaultType);
|
||||
markAsProcessed(expression);
|
||||
if (!context.trace.get(BindingContext.PROCESSED, expression)) {
|
||||
context.trace.record(BindingContext.EXPRESSION_TYPE, expression, defaultType);
|
||||
context.trace.record(BindingContext.PROCESSED, expression);
|
||||
}
|
||||
}
|
||||
super.recordDeclarationResolution(declaration, descriptor);
|
||||
}
|
||||
});
|
||||
};
|
||||
BindingTraceAdapter traceAdapter = new BindingTraceAdapter(context.trace);
|
||||
for (WritableSlice slice : BindingContext.DECLARATIONS_TO_DESCRIPTORS) {
|
||||
//noinspection unchecked
|
||||
traceAdapter.addHandler(slice, handler);
|
||||
}
|
||||
TopDownAnalyzer topDownAnalyzer = new TopDownAnalyzer(semanticServices, traceAdapter);
|
||||
topDownAnalyzer.processObject(context.scope, context.scope.getContainingDeclaration(), expression.getObjectDeclaration());
|
||||
return context.services.checkType(result[0], expression, context);
|
||||
}
|
||||
@@ -1135,7 +1147,7 @@ public class JetTypeInferrer {
|
||||
public JetType visitFunctionLiteralExpression(JetFunctionLiteralExpression expression, TypeInferenceContext context) {
|
||||
JetFunctionLiteral functionLiteral = expression.getFunctionLiteral();
|
||||
if (context.preferBlock && !functionLiteral.hasParameterSpecification()) {
|
||||
context.trace.recordBlock(expression);
|
||||
context.trace.record(BindingContext.BLOCK, expression);
|
||||
return context.services.checkType(getBlockReturnedType(context.scope, functionLiteral.getBodyExpression(), context), expression, context);
|
||||
}
|
||||
|
||||
@@ -1172,7 +1184,7 @@ public class JetTypeInferrer {
|
||||
|
||||
JetType effectiveReceiverType = receiverTypeRef == null ? null : receiverType;
|
||||
functionDescriptor.initialize(effectiveReceiverType, Collections.<TypeParameterDescriptor>emptyList(), valueParameterDescriptors, null);
|
||||
context.trace.recordDeclarationResolution(expression, functionDescriptor);
|
||||
context.trace.record(BindingContext.FUNCTION, expression, functionDescriptor);
|
||||
|
||||
JetType returnType = NO_EXPECTED_TYPE;
|
||||
JetScope functionInnerScope = FunctionDescriptorUtil.getFunctionInnerScope(context.scope, functionDescriptor, context.trace);
|
||||
@@ -1235,7 +1247,7 @@ public class JetTypeInferrer {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
context.trace.recordCompileTimeValue(expression, value);
|
||||
context.trace.record(BindingContext.COMPILE_TIME_VALUE, expression, value);
|
||||
return context.services.checkType(value.getType(standardLibrary), expression, context);
|
||||
}
|
||||
}
|
||||
@@ -1369,22 +1381,22 @@ public class JetTypeInferrer {
|
||||
else {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
context.trace.recordReferenceResolution(targetLabel, declarationDescriptor);
|
||||
context.trace.recordReferenceResolution(expression.getThisReference(), declarationDescriptor);
|
||||
context.trace.record(BindingContext.REFERENCE_TARGET, targetLabel, declarationDescriptor);
|
||||
context.trace.record(BindingContext.REFERENCE_TARGET, expression.getThisReference(), declarationDescriptor);
|
||||
}
|
||||
else if (size == 0) {
|
||||
// This uses the info written by the control flow processor
|
||||
PsiElement psiElement = context.trace.getBindingContext().resolveToDeclarationPsiElement(targetLabel);
|
||||
PsiElement psiElement = BindingContextUtils.resolveToDeclarationPsiElement(context.trace.getBindingContext(), targetLabel);
|
||||
if (psiElement instanceof JetFunctionLiteralExpression) {
|
||||
DeclarationDescriptor declarationDescriptor = context.trace.getBindingContext().getDeclarationDescriptor(psiElement);
|
||||
DeclarationDescriptor declarationDescriptor = context.trace.getBindingContext().get(BindingContext.DECLARATION_TO_DESCRIPTOR, psiElement);
|
||||
if (declarationDescriptor instanceof FunctionDescriptor) {
|
||||
thisType = ((FunctionDescriptor) declarationDescriptor).getReceiverType();
|
||||
if (thisType == null) {
|
||||
thisType = JetStandardClasses.getNothingType();
|
||||
}
|
||||
else {
|
||||
context.trace.recordReferenceResolution(targetLabel, declarationDescriptor);
|
||||
context.trace.recordReferenceResolution(expression.getThisReference(), declarationDescriptor);
|
||||
context.trace.record(BindingContext.REFERENCE_TARGET, targetLabel, declarationDescriptor);
|
||||
context.trace.record(BindingContext.REFERENCE_TARGET, expression.getThisReference(), declarationDescriptor);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1404,7 +1416,7 @@ public class JetTypeInferrer {
|
||||
|
||||
DeclarationDescriptor declarationDescriptorForUnqualifiedThis = context.scope.getDeclarationDescriptorForUnqualifiedThis();
|
||||
if (declarationDescriptorForUnqualifiedThis != null) {
|
||||
context.trace.recordReferenceResolution(expression.getThisReference(), declarationDescriptorForUnqualifiedThis);
|
||||
context.trace.record(BindingContext.REFERENCE_TARGET, expression.getThisReference(), declarationDescriptorForUnqualifiedThis);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1441,7 +1453,7 @@ public class JetTypeInferrer {
|
||||
result = thisType;
|
||||
}
|
||||
if (result != null) {
|
||||
context.trace.recordExpressionType(expression.getThisReference(), result);
|
||||
context.trace.record(BindingContext.EXPRESSION_TYPE, expression.getThisReference(), result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1828,7 +1840,7 @@ public class JetTypeInferrer {
|
||||
// TODO : validate that DF makes sense for this variable: local, val, internal w/backing field, etc
|
||||
|
||||
// Comparison to a non-null expression
|
||||
JetType rhsType = context.trace.getBindingContext().getExpressionType(right);
|
||||
JetType rhsType = context.trace.getBindingContext().get(BindingContext.EXPRESSION_TYPE, right);
|
||||
if (rhsType != null && !rhsType.isNullable()) {
|
||||
extendDataFlowWithNullComparison(operationToken, variableDescriptor, !conditionValue);
|
||||
return;
|
||||
@@ -1836,7 +1848,7 @@ public class JetTypeInferrer {
|
||||
|
||||
VariableDescriptor rightVariable = context.services.getVariableDescriptorFromSimpleName(right, context);
|
||||
if (rightVariable != null) {
|
||||
JetType lhsType = context.trace.getBindingContext().getExpressionType(left);
|
||||
JetType lhsType = context.trace.getBindingContext().get(BindingContext.EXPRESSION_TYPE, left);
|
||||
if (lhsType != null && !lhsType.isNullable()) {
|
||||
extendDataFlowWithNullComparison(operationToken, rightVariable, !conditionValue);
|
||||
return;
|
||||
@@ -1929,7 +1941,7 @@ public class JetTypeInferrer {
|
||||
WritableScope writableScope = newWritableScopeImpl(context.scope, context.trace).setDebugName("do..while body scope");
|
||||
conditionScope = writableScope;
|
||||
context.services.getBlockReturnedTypeWithWritableScope(writableScope, function.getFunctionLiteral().getBodyExpression().getStatements(), context);
|
||||
context.trace.recordBlock(function);
|
||||
context.trace.record(BindingContext.BLOCK, function);
|
||||
} else {
|
||||
getType(context.scope, body, true, context);
|
||||
}
|
||||
@@ -2159,11 +2171,15 @@ public class JetTypeInferrer {
|
||||
// TODO : functions as values
|
||||
JetExpression selectorExpression = expression.getSelectorExpression();
|
||||
JetExpression receiverExpression = expression.getReceiverExpression();
|
||||
JetType receiverType = context.services.typeInferrerVisitorWithNamespaces.getType(receiverExpression, new TypeInferenceContext(context.trace, context.scope, context.services, false, context.dataFlowInfo, NO_EXPECTED_TYPE, NO_EXPECTED_TYPE));
|
||||
JetType receiverType = context.services.typeInferrerVisitorWithNamespaces.getType(receiverExpression, new TypeInferenceContext(context.trace, context.scope, false, context.dataFlowInfo, NO_EXPECTED_TYPE, NO_EXPECTED_TYPE));
|
||||
if (receiverType == null) return null;
|
||||
ErrorHandlerWithRegions errorHandler = context.trace.getErrorHandler();
|
||||
errorHandler.openRegion();
|
||||
JetType selectorReturnType = getSelectorReturnType(receiverType, selectorExpression, context);
|
||||
|
||||
// Clean resolution: no autocasts
|
||||
TemporaryBindingTrace cleanResolutionTrace = new TemporaryBindingTrace(context.trace.getBindingContext());
|
||||
TypeInferenceContext cleanResolutionContext = context.replaceBindingTrace(cleanResolutionTrace);
|
||||
// ErrorHandler errorHandler = context.trace.getErrorHandler();
|
||||
// errorHandler.openRegion();
|
||||
JetType selectorReturnType = getSelectorReturnType(receiverType, selectorExpression, cleanResolutionContext);
|
||||
|
||||
//TODO move further
|
||||
if (expression.getOperationSign() == JetTokens.SAFE_ACCESS) {
|
||||
@@ -2172,37 +2188,41 @@ public class JetTypeInferrer {
|
||||
}
|
||||
}
|
||||
if (selectorReturnType != null) {
|
||||
errorHandler.closeAndCommitCurrentRegion();
|
||||
cleanResolutionTrace.addAllMyDataTo(context.trace);
|
||||
}
|
||||
else {
|
||||
ErrorHandlerWithRegions.DiagnosticsRegion regionToCommit = errorHandler.closeAndReturnCurrentRegion();
|
||||
|
||||
VariableDescriptor variableDescriptor = context.services.getVariableDescriptorFromSimpleName(receiverExpression, context);
|
||||
VariableDescriptor variableDescriptor = cleanResolutionContext.services.getVariableDescriptorFromSimpleName(receiverExpression, context);
|
||||
boolean somethingFound = false;
|
||||
if (variableDescriptor != null) {
|
||||
List<JetType> possibleTypes = Lists.newArrayList(context.dataFlowInfo.getPossibleTypes(variableDescriptor));
|
||||
Collections.reverse(possibleTypes);
|
||||
|
||||
TemporaryBindingTrace autocastResolutionTrace = new TemporaryBindingTrace(context.trace.getBindingContext());
|
||||
TypeInferenceContext autocastResolutionContext = context.replaceBindingTrace(autocastResolutionTrace);
|
||||
for (JetType possibleType : possibleTypes) {
|
||||
errorHandler.openRegion();
|
||||
selectorReturnType = getSelectorReturnType(possibleType, selectorExpression, context);
|
||||
selectorReturnType = getSelectorReturnType(possibleType, selectorExpression, autocastResolutionContext);
|
||||
if (selectorReturnType != null) {
|
||||
regionToCommit = errorHandler.closeAndReturnCurrentRegion();
|
||||
context.trace.recordAutoCast(receiverExpression, possibleType);
|
||||
autocastResolutionTrace.record(BindingContext.AUTOCAST, receiverExpression, possibleType);
|
||||
autocastResolutionTrace.addAllMyDataTo(context.trace);
|
||||
somethingFound = true;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
errorHandler.closeAndReturnCurrentRegion();
|
||||
autocastResolutionTrace = new TemporaryBindingTrace(context.trace.getBindingContext());
|
||||
autocastResolutionContext = context.replaceBindingTrace(autocastResolutionTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
regionToCommit.commit();
|
||||
if (!somethingFound) {
|
||||
cleanResolutionTrace.addAllMyDataTo(context.trace);
|
||||
}
|
||||
}
|
||||
|
||||
JetType result;
|
||||
if (expression.getOperationSign() == JetTokens.QUEST) {
|
||||
if (selectorReturnType != null && !isBoolean(selectorReturnType) && selectorExpression != null) {
|
||||
// TODO : more comprehensible error message
|
||||
errorHandler.typeMismatch(selectorExpression, semanticServices.getStandardLibrary().getBooleanType(), selectorReturnType);
|
||||
context.trace.getErrorHandler().typeMismatch(selectorExpression, semanticServices.getStandardLibrary().getBooleanType(), selectorReturnType);
|
||||
}
|
||||
result = TypeUtils.makeNullable(receiverType);
|
||||
}
|
||||
@@ -2210,7 +2230,7 @@ public class JetTypeInferrer {
|
||||
result = selectorReturnType;
|
||||
}
|
||||
if (selectorExpression != null && result != null) {
|
||||
context.trace.recordExpressionType(selectorExpression, result);
|
||||
context.trace.record(BindingContext.EXPRESSION_TYPE, selectorExpression, result);
|
||||
}
|
||||
if (selectorReturnType != null) {
|
||||
// TODO : extensions to 'Any?'
|
||||
@@ -2238,7 +2258,7 @@ public class JetTypeInferrer {
|
||||
|
||||
@Override
|
||||
public void visitReferenceExpression(JetReferenceExpression referenceExpression) {
|
||||
DeclarationDescriptor declarationDescriptor = context.trace.getBindingContext().resolveReferenceExpression(referenceExpression);
|
||||
DeclarationDescriptor declarationDescriptor = context.trace.getBindingContext().get(BindingContext.REFERENCE_TARGET, referenceExpression);
|
||||
if (declarationDescriptor instanceof FunctionDescriptor) {
|
||||
result[0] = (FunctionDescriptor) declarationDescriptor;
|
||||
}
|
||||
@@ -2344,7 +2364,7 @@ public class JetTypeInferrer {
|
||||
context.trace.getErrorHandler().genericError(operationSign.getNode(), name + " must return " + receiverType + " but returns " + returnType);
|
||||
}
|
||||
else {
|
||||
context.trace.recordVariableReassignment(expression);
|
||||
context.trace.record(BindingContext.VARIABLE_REASSIGNMENT, expression);
|
||||
}
|
||||
// TODO : Maybe returnType?
|
||||
result = receiverType;
|
||||
@@ -2524,7 +2544,7 @@ public class JetTypeInferrer {
|
||||
@Nullable
|
||||
protected List<JetType> getTypes(JetScope scope, List<JetExpression> indexExpressions, TypeInferenceContext context) {
|
||||
List<JetType> argumentTypes = new ArrayList<JetType>();
|
||||
TypeInferenceContext newContext = new TypeInferenceContext(context.trace, scope, context.services, false, context.dataFlowInfo, NO_EXPECTED_TYPE, NO_EXPECTED_TYPE);
|
||||
TypeInferenceContext newContext = new TypeInferenceContext(context.trace, scope, false, context.dataFlowInfo, NO_EXPECTED_TYPE, NO_EXPECTED_TYPE);
|
||||
for (JetExpression indexExpression : indexExpressions) {
|
||||
JetType type = context.services.typeInferrerVisitor.getType(indexExpression, newContext);
|
||||
if (type == null) {
|
||||
@@ -2655,7 +2675,7 @@ public class JetTypeInferrer {
|
||||
});
|
||||
}
|
||||
if (value[0] != CompileTimeConstantResolver.OUT_OF_RANGE) {
|
||||
context.trace.recordCompileTimeValue(expression, new StringValue(builder.toString()));
|
||||
context.trace.record(BindingContext.COMPILE_TIME_VALUE, expression, new StringValue(builder.toString()));
|
||||
}
|
||||
return context.services.checkType(semanticServices.getStandardLibrary().getStringType(), expression, contextWithExpectedType);
|
||||
}
|
||||
@@ -2703,7 +2723,7 @@ public class JetTypeInferrer {
|
||||
public JetType visitObjectDeclaration(JetObjectDeclaration declaration, TypeInferenceContext context) {
|
||||
TopDownAnalyzer topDownAnalyzer = new TopDownAnalyzer(semanticServices, context.trace);
|
||||
topDownAnalyzer.processObject(scope, scope.getContainingDeclaration(), declaration);
|
||||
ClassDescriptor classDescriptor = context.trace.getBindingContext().getClassDescriptor(declaration);
|
||||
ClassDescriptor classDescriptor = context.trace.getBindingContext().get(BindingContext.CLASS, declaration);
|
||||
if (classDescriptor != null) {
|
||||
PropertyDescriptor propertyDescriptor = context.classDescriptorResolver.resolveObjectDeclarationAsPropertyDescriptor(scope.getContainingDeclaration(), declaration, classDescriptor);
|
||||
scope.addVariableDescriptor(propertyDescriptor);
|
||||
@@ -2777,7 +2797,7 @@ public class JetTypeInferrer {
|
||||
String counterpartName = binaryOperationNames.get(assignmentOperationCounterparts.get(operationType));
|
||||
JetType typeForBinaryCall = getTypeForBinaryCall(expression, counterpartName, scope, true, context);
|
||||
if (typeForBinaryCall != null) {
|
||||
context.trace.recordVariableReassignment(expression);
|
||||
context.trace.record(BindingContext.VARIABLE_REASSIGNMENT, expression);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.psi.JetReferenceExpression;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContextUtils;
|
||||
import org.jetbrains.jet.resolve.DescriptorRenderer;
|
||||
|
||||
/**
|
||||
@@ -26,13 +27,13 @@ public class JetQuickDocumentationProvider extends AbstractDocumentationProvider
|
||||
}
|
||||
if (ref != null) {
|
||||
BindingContext bindingContext = AnalyzingUtils.analyzeFileWithCache((JetFile) element.getContainingFile());
|
||||
DeclarationDescriptor declarationDescriptor = bindingContext.resolveReferenceExpression(ref);
|
||||
DeclarationDescriptor declarationDescriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, ref);
|
||||
if (declarationDescriptor != null) {
|
||||
return render(declarationDescriptor);
|
||||
}
|
||||
PsiElement psiElement = bindingContext.resolveToDeclarationPsiElement(ref);
|
||||
PsiElement psiElement = BindingContextUtils.resolveToDeclarationPsiElement(bindingContext, ref);
|
||||
if (psiElement != null) {
|
||||
declarationDescriptor = bindingContext.getDeclarationDescriptor(psiElement);
|
||||
declarationDescriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, psiElement);
|
||||
if (declarationDescriptor != null) {
|
||||
return render(declarationDescriptor);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ShowExpressionTypeAction extends AnAction {
|
||||
else {
|
||||
int offset = editor.getCaretModel().getOffset();
|
||||
expression = PsiTreeUtil.getParentOfType(psiFile.findElementAt(offset), JetExpression.class);
|
||||
while (expression != null && bindingContext.getExpressionType(expression) == null) {
|
||||
while (expression != null && bindingContext.get(BindingContext.EXPRESSION_TYPE, expression) == null) {
|
||||
expression = PsiTreeUtil.getParentOfType(expression, JetExpression.class);
|
||||
}
|
||||
if (expression != null) {
|
||||
@@ -45,7 +45,7 @@ public class ShowExpressionTypeAction extends AnAction {
|
||||
}
|
||||
}
|
||||
if (expression != null) {
|
||||
JetType type = bindingContext.getExpressionType(expression);
|
||||
JetType type = bindingContext.get(BindingContext.EXPRESSION_TYPE, expression);
|
||||
if (type != null) {
|
||||
HintManager.getInstance().showInformationHint(editor, type.toString());
|
||||
}
|
||||
|
||||
@@ -16,10 +16,7 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtilBase;
|
||||
import com.intellij.ui.awt.RelativePoint;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.Icons;
|
||||
import com.intellij.util.PsiIconUtil;
|
||||
import com.intellij.util.PsiNavigateUtil;
|
||||
import com.intellij.util.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
@@ -49,14 +46,14 @@ public class JetLineMarkerProvider implements LineMarkerProvider {
|
||||
|
||||
if (element instanceof JetClass) {
|
||||
JetClass jetClass = (JetClass) element;
|
||||
ClassDescriptor classDescriptor = bindingContext.getClassDescriptor(jetClass);
|
||||
ClassDescriptor classDescriptor = bindingContext.get(BindingContext.CLASS, jetClass);
|
||||
String text = classDescriptor == null ? "<i>Unresolved</i>" : DescriptorRenderer.HTML.render(classDescriptor);
|
||||
return createLineMarkerInfo(jetClass, text);
|
||||
}
|
||||
|
||||
if (element instanceof JetProperty) {
|
||||
JetProperty jetProperty = (JetProperty) element;
|
||||
final VariableDescriptor variableDescriptor = bindingContext.getVariableDescriptor(jetProperty);
|
||||
final VariableDescriptor variableDescriptor = bindingContext.get(BindingContext.VARIABLE, jetProperty);
|
||||
if (variableDescriptor instanceof PropertyDescriptor) {
|
||||
return createLineMarkerInfo(element, DescriptorRenderer.HTML.render(variableDescriptor));
|
||||
}
|
||||
@@ -65,10 +62,10 @@ public class JetLineMarkerProvider implements LineMarkerProvider {
|
||||
if (element instanceof JetNamedFunction) {
|
||||
JetNamedFunction jetFunction = (JetNamedFunction) element;
|
||||
|
||||
final FunctionDescriptor functionDescriptor = bindingContext.getFunctionDescriptor(jetFunction);
|
||||
final FunctionDescriptor functionDescriptor = bindingContext.get(BindingContext.FUNCTION, jetFunction);
|
||||
if (functionDescriptor == null) return null;
|
||||
final Set<? extends FunctionDescriptor> overriddenFunctions = functionDescriptor.getOverriddenFunctions();
|
||||
Icon icon = isMember(functionDescriptor) ? (overriddenFunctions.isEmpty() ? Icons.METHOD_ICON : OVERRIDING_FUNCTION) : Icons.FUNCTION_ICON;
|
||||
Icon icon = isMember(functionDescriptor) ? (overriddenFunctions.isEmpty() ? PlatformIcons.METHOD_ICON : OVERRIDING_FUNCTION) : PlatformIcons.FUNCTION_ICON;
|
||||
return new LineMarkerInfo<JetNamedFunction>(
|
||||
jetFunction, jetFunction.getTextOffset(), icon, Pass.UPDATE_ALL,
|
||||
new Function<JetNamedFunction, String>() {
|
||||
@@ -97,7 +94,7 @@ public class JetLineMarkerProvider implements LineMarkerProvider {
|
||||
if (overriddenFunctions.isEmpty()) return;
|
||||
final List<PsiElement> list = Lists.newArrayList();
|
||||
for (FunctionDescriptor overriddenFunction : overriddenFunctions) {
|
||||
PsiElement declarationPsiElement = bindingContext.getDeclarationPsiElement(overriddenFunction);
|
||||
PsiElement declarationPsiElement = bindingContext.get(BindingContext.DESCRIPTOR_TO_DECLARATION, overriddenFunction);
|
||||
list.add(declarationPsiElement);
|
||||
}
|
||||
if (list.isEmpty()) {
|
||||
@@ -118,7 +115,7 @@ public class JetLineMarkerProvider implements LineMarkerProvider {
|
||||
public String getElementText(PsiElement element) {
|
||||
if (element instanceof JetNamedFunction) {
|
||||
JetNamedFunction function = (JetNamedFunction) element;
|
||||
return DescriptorRenderer.HTML.render(bindingContext.getFunctionDescriptor(function));
|
||||
return DescriptorRenderer.HTML.render(bindingContext.get(BindingContext.FUNCTION, function));
|
||||
}
|
||||
return super.getElementText(element);
|
||||
}
|
||||
@@ -134,18 +131,18 @@ public class JetLineMarkerProvider implements LineMarkerProvider {
|
||||
|
||||
if (element instanceof JetNamespace) {
|
||||
return createLineMarkerInfo((JetNamespace) element,
|
||||
DescriptorRenderer.HTML.render(bindingContext.getNamespaceDescriptor((JetNamespace) element)));
|
||||
DescriptorRenderer.HTML.render(bindingContext.get(BindingContext.NAMESPACE, element)));
|
||||
}
|
||||
|
||||
if (element instanceof JetObjectDeclaration && !(element.getParent() instanceof JetExpression)) {
|
||||
JetObjectDeclaration jetObjectDeclaration = (JetObjectDeclaration) element;
|
||||
|
||||
return new LineMarkerInfo<JetObjectDeclaration>(
|
||||
jetObjectDeclaration, jetObjectDeclaration.getTextOffset(), Icons.ANONYMOUS_CLASS_ICON, Pass.UPDATE_ALL,
|
||||
jetObjectDeclaration, jetObjectDeclaration.getTextOffset(), PlatformIcons.ANONYMOUS_CLASS_ICON, Pass.UPDATE_ALL,
|
||||
new Function<JetObjectDeclaration, String>() {
|
||||
@Override
|
||||
public String fun(JetObjectDeclaration jetObjectDeclaration) {
|
||||
ClassDescriptor classDescriptor = bindingContext.getClassDescriptor(jetObjectDeclaration);
|
||||
ClassDescriptor classDescriptor = bindingContext.get(BindingContext.CLASS, jetObjectDeclaration);
|
||||
if (classDescriptor != null) {
|
||||
return DescriptorRenderer.HTML.renderAsObject(classDescriptor);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class JetPsiChecker implements Annotator {
|
||||
|
||||
private void markRedeclaration(DeclarationDescriptor redeclaration) {
|
||||
if (!redeclarations.add(redeclaration)) return;
|
||||
PsiElement declarationPsiElement = bindingContext.getDeclarationPsiElement(redeclaration);
|
||||
PsiElement declarationPsiElement = bindingContext.get(BindingContext.DESCRIPTOR_TO_DECLARATION, redeclaration);
|
||||
if (declarationPsiElement instanceof JetNamedDeclaration) {
|
||||
PsiElement nameIdentifier = ((JetNamedDeclaration) declarationPsiElement).getNameIdentifier();
|
||||
assert nameIdentifier != null : declarationPsiElement.getText() + " has nameIdentifier 'null'";
|
||||
@@ -106,7 +106,7 @@ public class JetPsiChecker implements Annotator {
|
||||
file.acceptChildren(new JetVisitorVoid() {
|
||||
@Override
|
||||
public void visitExpression(JetExpression expression) {
|
||||
JetType autoCast = bindingContext.getAutoCastType(expression);
|
||||
JetType autoCast = bindingContext.get(BindingContext.AUTOCAST, expression);
|
||||
if (autoCast != null) {
|
||||
holder.createInfoAnnotation(expression, "Automatically cast to " + autoCast).setTextAttributes(JetHighlighter.JET_AUTO_CAST_EXPRESSION);
|
||||
}
|
||||
@@ -135,9 +135,9 @@ public class JetPsiChecker implements Annotator {
|
||||
file.acceptChildren(new JetVisitorVoid() {
|
||||
@Override
|
||||
public void visitProperty(JetProperty property) {
|
||||
VariableDescriptor propertyDescriptor = bindingContext.getVariableDescriptor(property);
|
||||
VariableDescriptor propertyDescriptor = bindingContext.get(BindingContext.VARIABLE, property);
|
||||
if (propertyDescriptor instanceof PropertyDescriptor) {
|
||||
if (bindingContext.hasBackingField((PropertyDescriptor) propertyDescriptor)) {
|
||||
if ((boolean) bindingContext.get(BindingContext.BACKING_FIELD_REQUIRED, (PropertyDescriptor) propertyDescriptor)) {
|
||||
putBackingfieldAnnotation(holder, property);
|
||||
}
|
||||
}
|
||||
@@ -145,8 +145,8 @@ public class JetPsiChecker implements Annotator {
|
||||
|
||||
@Override
|
||||
public void visitParameter(JetParameter parameter) {
|
||||
PropertyDescriptor propertyDescriptor = bindingContext.getPropertyDescriptor(parameter);
|
||||
if (propertyDescriptor != null && bindingContext.hasBackingField(propertyDescriptor)) {
|
||||
PropertyDescriptor propertyDescriptor = bindingContext.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, parameter);
|
||||
if (propertyDescriptor != null && bindingContext.get(BindingContext.BACKING_FIELD_REQUIRED, propertyDescriptor)) {
|
||||
putBackingfieldAnnotation(holder, parameter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.jetbrains.jet.util;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class BasicWritableSlice<K, V> implements WritableSlice<K,V> {
|
||||
|
||||
private final String debugName;
|
||||
private final RewritePolicy rewritePolicy;
|
||||
|
||||
public BasicWritableSlice(String debugName, RewritePolicy rewritePolicy) {
|
||||
this.debugName = debugName;
|
||||
this.rewritePolicy = rewritePolicy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManyMapKey<K, V> makeKey(K key) {
|
||||
return new ManyMapKey<K, V>(this, key);
|
||||
}
|
||||
|
||||
// True to put, false to skip
|
||||
@Override
|
||||
public boolean check(K key, V value) {
|
||||
assert key != null;
|
||||
assert value != null;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPut(MutableManyMap manyMap, K key, V value) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public V computeValue(ManyMap map, K key, V value, boolean valueNotFound) {
|
||||
if (valueNotFound) assert value == null;
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RewritePolicy getRewritePolicy() {
|
||||
return rewritePolicy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return debugName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.jetbrains.jet.util;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public interface ManyMap extends Iterable<Map.Entry<ManyMapKey<?, ?>, ?>> {
|
||||
<K, V> V get(ReadOnlySlice<K, V> slice, K key);
|
||||
|
||||
<K, V> boolean containsKey(ReadOnlySlice<K, V> slice, K key);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package org.jetbrains.jet.util;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class ManyMapImpl implements MutableManyMap {
|
||||
|
||||
public static ManyMapImpl create() {
|
||||
return new ManyMapImpl(Maps.<ManyMapKey<?, ?>, Object>newLinkedHashMap());
|
||||
}
|
||||
|
||||
public static ManyMapImpl create(Map<ManyMapKey<?, ?>, Object> map) {
|
||||
return new ManyMapImpl(map);
|
||||
}
|
||||
|
||||
public static ManyMapImpl create(MapSupplier mapSupplier) {
|
||||
return new ManyMapImpl(mapSupplier.<ManyMapKey<?, ?>, Object>get());
|
||||
}
|
||||
|
||||
private final Map<ManyMapKey<?, ?>, Object> map;
|
||||
|
||||
private ManyMapImpl(Map<ManyMapKey<?, ?>, Object> map) {
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> void put(WritableSlice<K, V> slice, K key, V value) {
|
||||
if (!slice.check(key, value)) {
|
||||
return;
|
||||
}
|
||||
ManyMapKey<K, V> manyMapKey = slice.makeKey(key);
|
||||
if (slice.getRewritePolicy().rewriteProcessingNeeded(key)) {
|
||||
if (map.containsKey(manyMapKey)) {
|
||||
//noinspection unchecked
|
||||
if (!slice.getRewritePolicy().processRewrite(slice, key, (V) map.get(manyMapKey), value)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
map.put(manyMapKey, value);
|
||||
slice.afterPut(this, key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> V get(ReadOnlySlice<K, V> slice, K key) {
|
||||
ManyMapKey<K, V> manyMapKey = slice.makeKey(key);
|
||||
//noinspection unchecked
|
||||
V value = (V) map.get(manyMapKey);
|
||||
return slice.computeValue(this, key, value, value == null && !map.containsKey(manyMapKey));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> boolean containsKey(ReadOnlySlice<K, V> slice, K key) {
|
||||
return map.containsKey(slice.makeKey(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> V remove(RemovableSlice<K, V> slice, K key) {
|
||||
//noinspection unchecked
|
||||
return (V) map.remove(slice.makeKey(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Map.Entry<ManyMapKey<?, ?>, ?>> iterator() {
|
||||
//noinspection unchecked
|
||||
return (Iterator) map.entrySet().iterator();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package org.jetbrains.jet.util;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public final class ManyMapKey<K, V> {
|
||||
|
||||
private final WritableSlice<K, V> slice;
|
||||
private final K key;
|
||||
|
||||
public ManyMapKey(@NotNull WritableSlice<K, V> slice, K key) {
|
||||
this.slice = slice;
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public WritableSlice<K, V> getSlice() {
|
||||
return slice;
|
||||
}
|
||||
|
||||
public K getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
ManyMapKey that = (ManyMapKey) o;
|
||||
|
||||
if (key != null ? !key.equals(that.key) : that.key != null) return false;
|
||||
if (!slice.equals(that.slice)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = slice.hashCode();
|
||||
result = 31 * result + (key != null ? key.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
package org.jetbrains.jet.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class ManyMapSlices {
|
||||
|
||||
public static final RewritePolicy ONLY_REWRITE_TO_EQUAL = new RewritePolicy() {
|
||||
@Override
|
||||
public <K> boolean rewriteProcessingNeeded(K key) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> boolean processRewrite(WritableSlice<K, V> slice, K key, V oldValue, V newValue) {
|
||||
assert (oldValue == null && newValue == null) || (oldValue != null && oldValue.equals(newValue))
|
||||
: "Rewrite at slice " + slice + " key: " + key + " old value: " + oldValue + " new value: " + newValue;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
public interface KeyNormalizer<K> {
|
||||
|
||||
KeyNormalizer DO_NOTHING = new KeyNormalizer<Object>() {
|
||||
@Override
|
||||
public Object normalize(Object key) {
|
||||
return key;
|
||||
}
|
||||
};
|
||||
K normalize(K key);
|
||||
|
||||
}
|
||||
|
||||
public static <K, V> SliceBuilder<K, V> sliceBuilder(String debugName) {
|
||||
return new SliceBuilder<K, V>(debugName, ONLY_REWRITE_TO_EQUAL);
|
||||
}
|
||||
|
||||
public static <K, V> WritableSlice<K, V> createSimpleSlice(String debugName) {
|
||||
return new BasicWritableSlice<K, V>(debugName, ONLY_REWRITE_TO_EQUAL);
|
||||
}
|
||||
|
||||
public static <K> WritableSlice<K, Boolean> createSimpleSetSlice(String debugName) {
|
||||
return createRemovableSetSlice(debugName);
|
||||
}
|
||||
public static <K> RemovableSlice<K, Boolean> createRemovableSetSlice(String debugName) {
|
||||
return new SetSlice<K>(debugName, RewritePolicy.DO_NOTHING);
|
||||
}
|
||||
|
||||
public static class SliceBuilder<K, V> {
|
||||
private V defaultValue = null;
|
||||
private List<ReadOnlySlice<K, V>> furtherLookupSlices = null;
|
||||
private WritableSlice<? super V, ? super K> opposite = null;
|
||||
private KeyNormalizer<K> keyNormalizer = null;
|
||||
|
||||
private RewritePolicy rewritePolicy;
|
||||
|
||||
private String debugName;
|
||||
|
||||
private SliceBuilder(String debugName, RewritePolicy rewritePolicy) {
|
||||
this.rewritePolicy = rewritePolicy;
|
||||
this.debugName = debugName;
|
||||
}
|
||||
|
||||
public SliceBuilder<K, V> setDefaultValue(V defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SliceBuilder<K, V> setFurtherLookupSlices(ReadOnlySlice<K, V>... furtherLookupSlices) {
|
||||
this.furtherLookupSlices = Arrays.asList(furtherLookupSlices);
|
||||
return this;
|
||||
}
|
||||
|
||||
public SliceBuilder<K, V> setOpposite(WritableSlice<? super V, ? super K> opposite) {
|
||||
this.opposite = opposite;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SliceBuilder<K, V> setKeyNormalizer(KeyNormalizer<K> keyNormalizer) {
|
||||
this.keyNormalizer = keyNormalizer;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RemovableSlice<K, V> build() {
|
||||
if (defaultValue != null) {
|
||||
return new SliceWithOpposite<K, V>(debugName, rewritePolicy, opposite, keyNormalizer) {
|
||||
@Override
|
||||
public V computeValue(ManyMap map, K key, V value, boolean valueNotFound) {
|
||||
if (valueNotFound) return defaultValue;
|
||||
return super.computeValue(map, key, value, valueNotFound);
|
||||
}
|
||||
};
|
||||
}
|
||||
if (furtherLookupSlices != null) {
|
||||
return new SliceWithOpposite<K, V>(debugName, rewritePolicy, opposite, keyNormalizer) {
|
||||
@Override
|
||||
public V computeValue(ManyMap map, K key, V value, boolean valueNotFound) {
|
||||
if (valueNotFound) {
|
||||
for (ReadOnlySlice<K, V> slice : furtherLookupSlices) {
|
||||
if (map.containsKey(slice, key)) {
|
||||
return map.get(slice, key);
|
||||
}
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
return super.computeValue(map, key, value, valueNotFound);
|
||||
}
|
||||
};
|
||||
}
|
||||
return new SliceWithOpposite<K, V>(debugName, rewritePolicy, opposite, keyNormalizer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class BasicRemovableSlice<K, V> extends BasicWritableSlice<K, V> implements RemovableSlice<K, V> {
|
||||
protected BasicRemovableSlice(String debugName, RewritePolicy rewritePolicy) {
|
||||
super(debugName, rewritePolicy);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class SliceWithOpposite<K, V> extends BasicRemovableSlice<K, V> {
|
||||
private final WritableSlice<? super V, ? super K> opposite;
|
||||
|
||||
|
||||
private final KeyNormalizer<K> keyNormalizer;
|
||||
|
||||
public SliceWithOpposite(String debugName, RewritePolicy rewritePolicy) {
|
||||
this(debugName, rewritePolicy, KeyNormalizer.DO_NOTHING);
|
||||
}
|
||||
|
||||
public SliceWithOpposite(String debugName, RewritePolicy rewritePolicy, KeyNormalizer<K> keyNormalizer) {
|
||||
this(debugName, rewritePolicy, null, keyNormalizer);
|
||||
}
|
||||
|
||||
public SliceWithOpposite(String debugName, RewritePolicy rewritePolicy, WritableSlice<? super V, ? super K> opposite, KeyNormalizer<K> keyNormalizer) {
|
||||
super(debugName, rewritePolicy);
|
||||
this.opposite = opposite;
|
||||
this.keyNormalizer = keyNormalizer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPut(MutableManyMap manyMap, K key, V value) {
|
||||
if (opposite != null) {
|
||||
manyMap.put(opposite, value, key);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public ManyMapKey<K, V> makeKey(K key) {
|
||||
if (keyNormalizer == null) {
|
||||
return super.makeKey(key);
|
||||
}
|
||||
return super.makeKey(keyNormalizer.normalize(key));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class SetSlice<K> extends BasicRemovableSlice<K, Boolean> {
|
||||
|
||||
|
||||
protected SetSlice(String debugName, RewritePolicy rewritePolicy) {
|
||||
super(debugName, rewritePolicy);
|
||||
}
|
||||
@Override
|
||||
public Boolean computeValue(ManyMap map, K key, Boolean value, boolean valueNotFound) {
|
||||
if (valueNotFound) return false;
|
||||
return super.computeValue(map, key, value, valueNotFound);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.jetbrains.jet.util;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public interface MapSupplier {
|
||||
|
||||
MapSupplier HASH_MAP_SUPPLIER = new MapSupplier() {
|
||||
@Override
|
||||
public <K, V> Map<K, V> get() {
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
};
|
||||
|
||||
MapSupplier LINKED_HASH_MAP_SUPPLIER = new MapSupplier() {
|
||||
@Override
|
||||
public <K, V> Map<K, V> get() {
|
||||
return Maps.newLinkedHashMap();
|
||||
}
|
||||
};
|
||||
|
||||
<K, V> Map<K, V> get();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.jetbrains.jet.util;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public interface MutableManyMap extends ManyMap {
|
||||
|
||||
<K, V> void put(WritableSlice<K, V> slice, K key, V value);
|
||||
|
||||
<K, V> V remove(RemovableSlice<K, V> slice, K key);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.jetbrains.jet.util;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public interface ReadOnlySlice<K, V> {
|
||||
ManyMapKey<K, V> makeKey(K key);
|
||||
|
||||
V computeValue(ManyMap map, K key, V value, boolean valueNotFound);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.jetbrains.jet.util;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public interface RemovableSlice<K, V> extends WritableSlice<K, V> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.jetbrains.jet.util;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public interface RewritePolicy {
|
||||
|
||||
RewritePolicy DO_NOTHING = new RewritePolicy() {
|
||||
@Override
|
||||
public <K> boolean rewriteProcessingNeeded(K key) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> boolean processRewrite(WritableSlice<K, V> slice, K key, V oldValue, V newValue) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
};
|
||||
|
||||
<K> boolean rewriteProcessingNeeded(K key);
|
||||
|
||||
// True to put, false to skip
|
||||
<K, V> boolean processRewrite(WritableSlice<K, V> slice, K key, V oldValue, V newValue);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package org.jetbrains.jet.util;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public interface WritableSlice<K, V> extends ReadOnlySlice<K, V> {
|
||||
// True to put, false to skip
|
||||
boolean check(K key, V value);
|
||||
|
||||
void afterPut(MutableManyMap manyMap, K key, V value);
|
||||
|
||||
RewritePolicy getRewritePolicy();
|
||||
}
|
||||
@@ -15,10 +15,11 @@ JetFile: AnnotatedExpressions.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
REFERENCE_EXPRESSION
|
||||
@@ -31,10 +32,11 @@ JetFile: AnnotatedExpressions.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
THIS_EXPRESSION
|
||||
|
||||
@@ -38,25 +38,26 @@ JetFile: Attributes.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('A')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('B')
|
||||
PsiElement(GT)('>')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('A')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('B')
|
||||
PsiElement(GT)('>')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
@@ -70,68 +71,71 @@ JetFile: Attributes.jet
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('ina')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('ina')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiElement(IDENTIFIER)('goo')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('goo')
|
||||
PsiElement(IDENTIFIER)('doo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('f')
|
||||
PsiElement(GT)('>')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('doo')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('f')
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('goo')
|
||||
PsiElement(GT)('>')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('goo')
|
||||
PsiElement(GT)('>')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace('\n')
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('df')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('df')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(in)('in')
|
||||
@@ -139,10 +143,11 @@ JetFile: Attributes.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('sdfsdf')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('sdfsdf')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(out)('out')
|
||||
@@ -163,10 +168,11 @@ JetFile: Attributes.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('sdfsdf')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('sdfsdf')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
@@ -180,19 +186,21 @@ JetFile: Attributes.jet
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace('\n')
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('sdfsdf')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('sdfsdf')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
@@ -209,19 +217,21 @@ JetFile: Attributes.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('sdfsdf')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('sdfsdf')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
@@ -250,34 +260,37 @@ JetFile: Attributes.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('sdfsd')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('sdfsd')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('sdfsd')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('sdfsd')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiElement(IDENTIFIER)('f')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('f')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('c')
|
||||
PsiElement(IDENTIFIER)('c')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(private)('private')
|
||||
|
||||
@@ -29,10 +29,11 @@ JetFile: AttributesOnPatterns.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PROPERTY
|
||||
@@ -53,10 +54,11 @@ JetFile: AttributesOnPatterns.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PROPERTY
|
||||
@@ -86,10 +88,11 @@ JetFile: AttributesOnPatterns.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(MUL)('*')
|
||||
@@ -107,10 +110,11 @@ JetFile: AttributesOnPatterns.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
@@ -129,10 +133,11 @@ JetFile: AttributesOnPatterns.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
@@ -153,10 +158,11 @@ JetFile: AttributesOnPatterns.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
REFERENCE_EXPRESSION
|
||||
|
||||
@@ -44,25 +44,26 @@ JetFile: Attributes_ERR.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('A')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('B')
|
||||
PsiElement(GT)('>')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('A')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('B')
|
||||
PsiElement(GT)('>')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
@@ -78,68 +79,71 @@ JetFile: Attributes_ERR.jet
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('ina')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('ina')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiElement(IDENTIFIER)('goo')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('goo')
|
||||
PsiElement(IDENTIFIER)('doo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('f')
|
||||
PsiElement(GT)('>')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('doo')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('f')
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('goo')
|
||||
PsiElement(GT)('>')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('goo')
|
||||
PsiElement(GT)('>')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace('\n')
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('df')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('df')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(in)('in')
|
||||
@@ -147,32 +151,36 @@ JetFile: Attributes_ERR.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('sdfsdf')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('sdfsdf')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace('\n')
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('s')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('s')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('fd')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('fd')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('d')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('d')
|
||||
PsiErrorElement:No commas needed to separate attributes
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -208,34 +216,37 @@ JetFile: Attributes_ERR.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('sdfsd')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('sdfsd')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('sdfsd')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('sdfsd')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiElement(IDENTIFIER)('f')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('f')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('c')
|
||||
PsiElement(IDENTIFIER)('c')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(private)('private')
|
||||
|
||||
@@ -39,10 +39,11 @@ JetFile: BabySteps.jet
|
||||
PsiWhiteSpace(' ')
|
||||
DELEGATION_SPECIFIER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
|
||||
@@ -39,10 +39,11 @@ JetFile: BabySteps_ERR.jet
|
||||
PsiWhiteSpace(' ')
|
||||
DELEGATION_SPECIFIER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
|
||||
@@ -41,18 +41,19 @@ JetFile: Constructors.jet
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
@@ -100,18 +101,19 @@ JetFile: Constructors.jet
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
|
||||
@@ -57,10 +57,11 @@ JetFile: EOLsOnRollback.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(var)('var')
|
||||
@@ -80,10 +81,11 @@ JetFile: EOLsOnRollback.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(val)('val')
|
||||
|
||||
+41
-36
@@ -37,10 +37,11 @@ JetFile: Enums.jet
|
||||
PsiWhiteSpace(' ')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Color')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Color')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
@@ -58,10 +59,11 @@ JetFile: Enums.jet
|
||||
PsiWhiteSpace(' ')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Color')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Color')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
@@ -79,10 +81,11 @@ JetFile: Enums.jet
|
||||
PsiWhiteSpace(' ')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Color')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Color')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
@@ -135,18 +138,19 @@ JetFile: Enums.jet
|
||||
PsiWhiteSpace(' ')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('List')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Nothing')
|
||||
PsiElement(GT)('>')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('List')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Nothing')
|
||||
PsiElement(GT)('>')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
@@ -202,18 +206,19 @@ JetFile: Enums.jet
|
||||
PsiWhiteSpace(' ')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('List')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('List')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiComment(BLOCK_COMMENT)('/*tail.size + 1*/')
|
||||
|
||||
@@ -463,10 +463,11 @@ JetFile: FunctionLiterals.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
@@ -477,10 +478,11 @@ JetFile: FunctionLiterals.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('y')
|
||||
@@ -491,10 +493,11 @@ JetFile: FunctionLiterals.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('c')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('c')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('z')
|
||||
|
||||
@@ -20,10 +20,11 @@ JetFile: FunctionTypes.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
@@ -91,10 +92,11 @@ JetFile: FunctionTypes.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
USER_TYPE
|
||||
@@ -149,10 +151,11 @@ JetFile: FunctionTypes.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
USER_TYPE
|
||||
@@ -272,10 +275,11 @@ JetFile: FunctionTypes.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
USER_TYPE
|
||||
@@ -673,10 +677,11 @@ JetFile: FunctionTypes.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
FUNCTION_TYPE
|
||||
@@ -711,10 +716,11 @@ JetFile: FunctionTypes.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
FUNCTION_TYPE
|
||||
@@ -753,10 +759,11 @@ JetFile: FunctionTypes.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
FUNCTION_TYPE
|
||||
|
||||
@@ -14,10 +14,11 @@ JetFile: Functions.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
@@ -32,10 +33,11 @@ JetFile: Functions.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
USER_TYPE
|
||||
@@ -54,10 +56,11 @@ JetFile: Functions.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
USER_TYPE
|
||||
@@ -92,10 +95,11 @@ JetFile: Functions.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
@@ -168,10 +172,11 @@ JetFile: Functions.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
@@ -187,10 +192,11 @@ JetFile: Functions.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
USER_TYPE
|
||||
@@ -210,10 +216,11 @@ JetFile: Functions.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
USER_TYPE
|
||||
@@ -249,10 +256,11 @@ JetFile: Functions.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
@@ -329,10 +337,11 @@ JetFile: Functions.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
@@ -351,10 +360,11 @@ JetFile: Functions.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
USER_TYPE
|
||||
@@ -377,10 +387,11 @@ JetFile: Functions.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
USER_TYPE
|
||||
@@ -419,10 +430,11 @@ JetFile: Functions.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
@@ -491,10 +503,11 @@ JetFile: Functions.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
@@ -516,10 +529,11 @@ JetFile: Functions.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
FUNCTION_TYPE
|
||||
|
||||
@@ -15,10 +15,11 @@ JetFile: Functions_ERR.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('f')
|
||||
@@ -40,10 +41,11 @@ JetFile: Functions_ERR.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
USER_TYPE
|
||||
@@ -77,10 +79,11 @@ JetFile: Functions_ERR.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
@@ -123,10 +126,11 @@ JetFile: Functions_ERR.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
@@ -176,10 +180,11 @@ JetFile: Functions_ERR.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
@@ -232,10 +237,11 @@ JetFile: Functions_ERR.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
|
||||
@@ -51,100 +51,109 @@ JetFile: Imports_ERR.jet
|
||||
PsiWhiteSpace(' ')
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(DOT)('.')
|
||||
PsiWhiteSpace('\n')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('import')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(DOT)('.')
|
||||
PsiWhiteSpace('\n')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiElement(DOT)('.')
|
||||
PsiWhiteSpace('\n')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('import')
|
||||
PsiElement(IDENTIFIER)('import')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiElement(DOT)('.')
|
||||
PsiWhiteSpace('\n')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('import')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(DOT)('.')
|
||||
PsiWhiteSpace(' ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiErrorElement:Type name expected
|
||||
PsiElement(as)('as')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(DOT)('.')
|
||||
PsiWhiteSpace(' ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiErrorElement:Type name expected
|
||||
PsiElement(as)('as')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiWhiteSpace('\n')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('import')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('import')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiErrorElement:Type name expected
|
||||
PsiElement(MUL)('*')
|
||||
PsiErrorElement:Type name expected
|
||||
PsiElement(MUL)('*')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expecting namespace or top level declaration
|
||||
PsiElement(as)('as')
|
||||
PsiWhiteSpace(' ')
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiWhiteSpace('\n')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('import')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiErrorElement:Type name expected
|
||||
PsiElement(MUL)('*')
|
||||
PsiWhiteSpace('\n')
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('import')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiErrorElement:Type name expected
|
||||
PsiElement(MUL)('*')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expecting namespace or top level declaration
|
||||
PsiElement(as)('as')
|
||||
|
||||
@@ -22,10 +22,11 @@ JetFile: LocalDeclarations.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(abstract)('abstract')
|
||||
@@ -47,10 +48,11 @@ JetFile: LocalDeclarations.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(class)('class')
|
||||
@@ -81,10 +83,11 @@ JetFile: LocalDeclarations.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(var)('var')
|
||||
|
||||
@@ -22,48 +22,52 @@ JetFile: NamespaceBlock_ERR.jet
|
||||
NAMESPACE
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(DOT)('.')
|
||||
PsiWhiteSpace('\n')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('import')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(DOT)('.')
|
||||
PsiWhiteSpace('\n')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiElement(DOT)('.')
|
||||
PsiWhiteSpace('\n')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('import')
|
||||
PsiElement(IDENTIFIER)('import')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiElement(DOT)('.')
|
||||
PsiWhiteSpace('\n')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('import')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(DOT)('.')
|
||||
PsiWhiteSpace(' ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiErrorElement:Type name expected
|
||||
PsiElement(as)('as')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiElement(DOT)('.')
|
||||
PsiWhiteSpace(' ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiErrorElement:Type name expected
|
||||
PsiElement(as)('as')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiElement(IDENTIFIER)('bar')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PsiElement(namespace)('namespace')
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -255,10 +259,11 @@ JetFile: NamespaceBlock_ERR.jet
|
||||
CLASS
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('dsfgd')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('dsfgd')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
|
||||
@@ -6,10 +6,11 @@ JetFile: NamespaceModifiers.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(namespace)('namespace')
|
||||
@@ -23,10 +24,11 @@ JetFile: NamespaceModifiers.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(namespace)('namespace')
|
||||
|
||||
@@ -29,10 +29,11 @@ JetFile: Properties.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
@@ -65,10 +66,11 @@ JetFile: Properties.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
|
||||
@@ -223,10 +223,11 @@ JetFile: PropertiesFollowedByInitializers.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(abstract)('abstract')
|
||||
|
||||
@@ -45,16 +45,18 @@ JetFile: Properties_ERR.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiErrorElement:Expecting ']' to close an attribute annotation
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -81,10 +83,11 @@ JetFile: Properties_ERR.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
@@ -133,10 +136,11 @@ JetFile: Properties_ERR.jet
|
||||
PROPERTY
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
|
||||
@@ -5,10 +5,11 @@ JetFile: QuotedIdentifiers.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('`return`')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('`return`')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(fun)('fun')
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -105,18 +105,19 @@ JetFile: SimpleClassMembers.jet
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
@@ -260,10 +261,11 @@ JetFile: SimpleClassMembers.jet
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Goo')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Goo')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
@@ -344,18 +346,19 @@ JetFile: SimpleClassMembers.jet
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
@@ -428,18 +431,19 @@ JetFile: SimpleClassMembers.jet
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
@@ -478,18 +482,19 @@ JetFile: SimpleClassMembers.jet
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
@@ -617,10 +622,11 @@ JetFile: SimpleClassMembers.jet
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Goo')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Goo')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
|
||||
@@ -36,10 +36,11 @@ JetFile: SimpleClassMembers_ERR.jet
|
||||
PsiWhiteSpace('\n ')
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('sdfsd')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('sdfsd')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiErrorElement:Expecting member declaration
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -107,19 +108,20 @@ JetFile: SimpleClassMembers_ERR.jet
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiErrorElement:Expecting a '>'
|
||||
<empty list>
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiErrorElement:Expecting a '>'
|
||||
<empty list>
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
@@ -158,18 +160,19 @@ JetFile: SimpleClassMembers_ERR.jet
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Foo')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
|
||||
@@ -96,10 +96,11 @@ JetFile: TupleTypes.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
TUPLE_TYPE
|
||||
@@ -116,10 +117,11 @@ JetFile: TupleTypes.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiElement(RBRACKET)(']')
|
||||
TUPLE_TYPE
|
||||
PsiElement(LPAR)('(')
|
||||
@@ -127,10 +129,11 @@ JetFile: TupleTypes.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
USER_TYPE
|
||||
@@ -148,10 +151,11 @@ JetFile: TupleTypes.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
TUPLE_TYPE
|
||||
@@ -160,10 +164,11 @@ JetFile: TupleTypes.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
USER_TYPE
|
||||
@@ -175,10 +180,11 @@ JetFile: TupleTypes.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiElement(RBRACKET)(']')
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
@@ -195,10 +201,11 @@ JetFile: TupleTypes.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
TUPLE_TYPE
|
||||
@@ -212,10 +219,11 @@ JetFile: TupleTypes.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
USER_TYPE
|
||||
@@ -232,10 +240,11 @@ JetFile: TupleTypes.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
USER_TYPE
|
||||
|
||||
@@ -91,10 +91,11 @@ JetFile: TupleTypes_ERR.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
TUPLE_TYPE
|
||||
@@ -111,10 +112,11 @@ JetFile: TupleTypes_ERR.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiElement(RBRACKET)(']')
|
||||
TUPLE_TYPE
|
||||
PsiElement(LPAR)('(')
|
||||
@@ -122,16 +124,18 @@ JetFile: TupleTypes_ERR.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('X')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('X')
|
||||
PsiErrorElement:Expecting ']' to close an attribute annotation
|
||||
<empty list>
|
||||
PsiElement(RPAR)(')')
|
||||
@@ -146,10 +150,11 @@ JetFile: TupleTypes_ERR.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
TUPLE_TYPE
|
||||
@@ -158,10 +163,11 @@ JetFile: TupleTypes_ERR.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
USER_TYPE
|
||||
@@ -173,10 +179,11 @@ JetFile: TupleTypes_ERR.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiElement(RBRACKET)(']')
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
@@ -193,10 +200,11 @@ JetFile: TupleTypes_ERR.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
TUPLE_TYPE
|
||||
@@ -210,10 +218,11 @@ JetFile: TupleTypes_ERR.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
USER_TYPE
|
||||
@@ -230,10 +239,11 @@ JetFile: TupleTypes_ERR.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
USER_TYPE
|
||||
|
||||
@@ -17,19 +17,21 @@ JetFile: TypeAnnotations.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
USER_TYPE
|
||||
@@ -50,19 +52,21 @@ JetFile: TypeAnnotations.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
USER_TYPE
|
||||
@@ -75,10 +79,11 @@ JetFile: TypeAnnotations.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('x')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
|
||||
@@ -34,10 +34,11 @@ JetFile: TypeParametersBeforeName.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
@@ -62,10 +63,11 @@ JetFile: TypeParametersBeforeName.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
USER_TYPE
|
||||
|
||||
@@ -25,10 +25,11 @@ JetFile: AnonymousObjects.jet
|
||||
PsiWhiteSpace(' ')
|
||||
DELEGATION_SPECIFIER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('MouseAdapter')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('MouseAdapter')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
|
||||
@@ -244,10 +244,11 @@ JetFile: BinaryTree.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('operator')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('operator')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(fun)('fun')
|
||||
|
||||
@@ -561,10 +561,11 @@ JetFile: BitArith.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('operator')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('operator')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(fun)('fun')
|
||||
@@ -593,10 +594,11 @@ JetFile: BitArith.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('operator')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('operator')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(fun)('fun')
|
||||
|
||||
@@ -16,10 +16,11 @@ JetFile: Builder.jet
|
||||
PsiWhiteSpace(' ')
|
||||
DELEGATION_SPECIFIER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('AntBuilder')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('AntBuilder')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
@@ -32,10 +33,11 @@ JetFile: Builder.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('lazy')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('lazy')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(val)('val')
|
||||
@@ -77,10 +79,11 @@ JetFile: Builder.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('lazy')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('lazy')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(val)('val')
|
||||
@@ -148,10 +151,11 @@ JetFile: Builder.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('lazy')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('lazy')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(val)('val')
|
||||
|
||||
@@ -63,10 +63,11 @@ JetFile: Color.jet
|
||||
PsiWhiteSpace(' ')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Color')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Color')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
@@ -94,10 +95,11 @@ JetFile: Color.jet
|
||||
PsiWhiteSpace(' ')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Color')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Color')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
@@ -125,10 +127,11 @@ JetFile: Color.jet
|
||||
PsiWhiteSpace(' ')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Color')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Color')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
|
||||
@@ -25,10 +25,11 @@ JetFile: PolymorphicClassObjects.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('operator')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('operator')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(fun)('fun')
|
||||
|
||||
@@ -5,10 +5,11 @@ JetFile: With.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('inline')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('inline')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(fun)('fun')
|
||||
|
||||
@@ -35,10 +35,11 @@ JetFile: MutableArray.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('operator')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('operator')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(fun)('fun')
|
||||
@@ -101,10 +102,11 @@ JetFile: MutableArray.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('operator')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('operator')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(fun)('fun')
|
||||
|
||||
@@ -147,10 +147,11 @@ JetFile: ArrayList.jet
|
||||
PsiWhiteSpace(' ')
|
||||
DELEGATION_SPECIFIER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('IMutableIterator')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('IMutableIterator')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
|
||||
@@ -337,10 +337,11 @@ JetFile: HashMap.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('inline')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('inline')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(fun)('fun')
|
||||
@@ -770,10 +771,11 @@ JetFile: HashMap.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('inline')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('inline')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(fun)('fun')
|
||||
@@ -816,10 +818,11 @@ JetFile: HashMap.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('inline')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('inline')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(fun)('fun')
|
||||
|
||||
@@ -48,10 +48,11 @@ JetFile: IList.jet
|
||||
ANNOTATION
|
||||
PsiElement(LBRACKET)('[')
|
||||
ANNOTATION_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('operator')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('operator')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(fun)('fun')
|
||||
|
||||
@@ -58,18 +58,19 @@ JetFile: List.jet
|
||||
PsiWhiteSpace(' ')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('List')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Nothing')
|
||||
PsiElement(GT)('>')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('List')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Nothing')
|
||||
PsiElement(GT)('>')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
@@ -125,18 +126,19 @@ JetFile: List.jet
|
||||
PsiWhiteSpace(' ')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('List')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('List')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
@@ -234,10 +236,11 @@ JetFile: List.jet
|
||||
PsiWhiteSpace(' ')
|
||||
DELEGATION_SPECIFIER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('IIterator')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('IIterator')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
|
||||
@@ -102,10 +102,11 @@ JetFile: IOSamples.jet
|
||||
PsiWhiteSpace(' ')
|
||||
DELEGATION_SPECIFIER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('ICloseable')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('ICloseable')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
@@ -292,10 +293,11 @@ JetFile: IOSamples.jet
|
||||
PsiWhiteSpace(' ')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('JavaCloseableWrapper')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('JavaCloseableWrapper')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
@@ -563,10 +565,11 @@ JetFile: IOSamples.jet
|
||||
PsiWhiteSpace(' ')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('JavaCloseableWrapper')
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('JavaCloseableWrapper')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
package org.jetbrains.jet;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.ErrorHandler;
|
||||
import org.jetbrains.jet.lang.ErrorHandlerWithRegions;
|
||||
import org.jetbrains.jet.lang.JetDiagnostic;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.psi.JetReferenceExpression;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||
import org.jetbrains.jet.lang.resolve.JetScope;
|
||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.util.ReadOnlySlice;
|
||||
import org.jetbrains.jet.util.WritableSlice;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -22,222 +17,46 @@ import java.util.Collection;
|
||||
public class JetTestUtils {
|
||||
public static final BindingTrace DUMMY_TRACE = new BindingTrace() {
|
||||
|
||||
@Override
|
||||
public void recordExpressionType(@NotNull JetExpression expression, @NotNull JetType type) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordReferenceResolution(@NotNull JetReferenceExpression expression, @NotNull DeclarationDescriptor descriptor) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordLabelResolution(@NotNull JetReferenceExpression expression, @NotNull PsiElement element) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordDeclarationResolution(@NotNull PsiElement declaration, @NotNull DeclarationDescriptor descriptor) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordValueParameterAsPropertyResolution(@NotNull JetParameter declaration, @NotNull PropertyDescriptor descriptor) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordTypeResolution(@NotNull JetTypeReference typeReference, @NotNull JetType type) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordAnnotationResolution(@NotNull JetAnnotationEntry annotationEntry, @NotNull AnnotationDescriptor annotationDescriptor) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordCompileTimeValue(@NotNull JetExpression expression, @NotNull CompileTimeConstant<?> value) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordBlock(JetFunctionLiteralExpression expression) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordStatement(@NotNull JetElement statement) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordVariableReassignment(@NotNull JetExpression expression) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordResolutionScope(@NotNull JetExpression expression, @NotNull JetScope scope) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeStatementRecord(@NotNull JetElement statement) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requireBackingField(@NotNull PropertyDescriptor propertyDescriptor) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordAutoCast(@NotNull JetExpression expression, @NotNull JetType type) {
|
||||
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ErrorHandlerWithRegions getErrorHandler() {
|
||||
return new ErrorHandlerWithRegions(new ErrorHandler() {
|
||||
public ErrorHandler getErrorHandler() {
|
||||
return new ErrorHandler() {
|
||||
@Override
|
||||
public void unresolvedReference(@NotNull JetReferenceExpression referenceExpression) {
|
||||
throw new IllegalStateException("Unresolved: " + referenceExpression.getText());
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isProcessed(@NotNull JetExpression expression) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markAsProcessed(@NotNull JetExpression expression) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public BindingContext getBindingContext() {
|
||||
return new BindingContext() {
|
||||
|
||||
@Override
|
||||
public DeclarationDescriptor getDeclarationDescriptor(PsiElement declaration) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamespaceDescriptor getNamespaceDescriptor(JetNamespace declaration) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassDescriptor getClassDescriptor(JetClassOrObject declaration) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypeParameterDescriptor getTypeParameterDescriptor(JetTypeParameter declaration) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public FunctionDescriptor getFunctionDescriptor(JetNamedFunction declaration) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstructorDescriptor getConstructorDescriptor(JetElement declaration) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnnotationDescriptor getAnnotationDescriptor(JetAnnotationEntry annotationEntry) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompileTimeConstant<?> getCompileTimeValue(JetExpression expression) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public VariableDescriptor getVariableDescriptor(JetProperty declaration) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public VariableDescriptor getVariableDescriptor(JetParameter declaration) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyDescriptor getPropertyDescriptor(JetParameter primaryConstructorParameter) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyDescriptor getPropertyDescriptor(JetObjectDeclarationName objectDeclarationName) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetType getExpressionType(JetExpression expression) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeclarationDescriptor resolveReferenceExpression(JetReferenceExpression referenceExpression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetType resolveTypeReference(JetTypeReference typeReference) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement resolveToDeclarationPsiElement(JetReferenceExpression referenceExpression) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement getDeclarationPsiElement(DeclarationDescriptor descriptor) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlock(JetFunctionLiteralExpression expression) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStatement(JetExpression expression) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBackingField(PropertyDescriptor propertyDescriptor) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVariableReassignment(JetExpression expression) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstructorDescriptor resolveSuperConstructor(JetDelegatorToSuperCall superCall) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetType getAutoCastType(@NotNull JetExpression expression) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetScope getResolutionScope(@NotNull JetExpression expression) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<JetDiagnostic> getDiagnostics() {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> V get(ReadOnlySlice<K, V> slice, K key) {
|
||||
return DUMMY_TRACE.get(slice, key);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> void record(WritableSlice<K, V> slice, K key, V value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K> void record(WritableSlice<K, Boolean> slice, K key) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> V get(ReadOnlySlice<K, V> slice, K key) {
|
||||
if (slice == BindingContext.PROCESSED) return (V) Boolean.FALSE;
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -12,9 +12,15 @@ import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.types.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContextUtils;
|
||||
import org.jetbrains.jet.lang.types.JetStandardLibrary;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.lang.types.TypeConstructor;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -78,7 +84,7 @@ public class ExpectedResolveData {
|
||||
text = document.getText();
|
||||
}
|
||||
|
||||
System.out.println("text = " + text);
|
||||
System.out.println(text);
|
||||
}
|
||||
|
||||
public void checkResult(JetFile file) {
|
||||
@@ -117,7 +123,7 @@ public class ExpectedResolveData {
|
||||
assertTrue(
|
||||
"Must have been unresolved: " +
|
||||
renderReferenceInContext(referenceExpression) +
|
||||
" but was resolved to " + DescriptorRenderer.TEXT.render(bindingContext.resolveReferenceExpression(referenceExpression)),
|
||||
" but was resolved to " + DescriptorRenderer.TEXT.render(bindingContext.get(BindingContext.REFERENCE_TARGET, referenceExpression)),
|
||||
unresolvedReferences.contains(referenceExpression));
|
||||
continue;
|
||||
}
|
||||
@@ -125,8 +131,8 @@ public class ExpectedResolveData {
|
||||
assertTrue(
|
||||
"Must have been resolved to null: " +
|
||||
renderReferenceInContext(referenceExpression) +
|
||||
" but was resolved to " + DescriptorRenderer.TEXT.render(bindingContext.resolveReferenceExpression(referenceExpression)),
|
||||
bindingContext.getExpressionType(referenceExpression) == null
|
||||
" but was resolved to " + DescriptorRenderer.TEXT.render(bindingContext.get(BindingContext.REFERENCE_TARGET, referenceExpression)),
|
||||
bindingContext.get(BindingContext.EXPRESSION_TYPE, referenceExpression) == null
|
||||
);
|
||||
continue;
|
||||
}
|
||||
@@ -144,12 +150,12 @@ public class ExpectedResolveData {
|
||||
DeclarationDescriptor expectedDescriptor = nameToDescriptor.get(name);
|
||||
JetTypeReference typeReference = getAncestorOfType(JetTypeReference.class, element);
|
||||
if (expectedDescriptor != null) {
|
||||
DeclarationDescriptor actual = bindingContext.resolveReferenceExpression(reference);
|
||||
DeclarationDescriptor actual = bindingContext.get(BindingContext.REFERENCE_TARGET, reference);
|
||||
assertSame("Expected: " + name, expectedDescriptor.getOriginal(), actual == null ? null : actual.getOriginal());
|
||||
continue;
|
||||
}
|
||||
|
||||
JetType actualType = bindingContext.resolveTypeReference(typeReference);
|
||||
JetType actualType = bindingContext.get(BindingContext.TYPE, typeReference);
|
||||
assertNotNull("Type " + name + " not resolved for reference " + name, actualType);
|
||||
ClassifierDescriptor expectedClass = lib.getLibraryScope().getClassifier(name.substring(5));
|
||||
assertNotNull("Expected class not found: " + name);
|
||||
@@ -158,7 +164,7 @@ public class ExpectedResolveData {
|
||||
}
|
||||
assert expected != null : "No declaration for " + name;
|
||||
|
||||
PsiElement actual = bindingContext.resolveToDeclarationPsiElement(reference);
|
||||
PsiElement actual = BindingContextUtils.resolveToDeclarationPsiElement(bindingContext, reference);
|
||||
|
||||
String actualName = null;
|
||||
if (actual != null) {
|
||||
@@ -172,17 +178,17 @@ public class ExpectedResolveData {
|
||||
if (expected instanceof JetParameter || actual instanceof JetParameter) {
|
||||
DeclarationDescriptor expectedDescriptor;
|
||||
if (name.startsWith("$")) {
|
||||
expectedDescriptor = bindingContext.getPropertyDescriptor((JetParameter) expected);
|
||||
expectedDescriptor = bindingContext.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, (JetParameter) expected);
|
||||
}
|
||||
else {
|
||||
expectedDescriptor = bindingContext.getDeclarationDescriptor(expected);
|
||||
expectedDescriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, expected);
|
||||
if (expectedDescriptor == null) {
|
||||
expectedDescriptor = bindingContext.getConstructorDescriptor((JetElement) expected);
|
||||
expectedDescriptor = bindingContext.get(BindingContext.CONSTRUCTOR, (JetElement) expected);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DeclarationDescriptor actualDescriptor = bindingContext.resolveReferenceExpression(reference);
|
||||
DeclarationDescriptor actualDescriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, reference);
|
||||
if (actualDescriptor instanceof VariableAsFunctionDescriptor) {
|
||||
VariableAsFunctionDescriptor descriptor = (VariableAsFunctionDescriptor) actualDescriptor;
|
||||
actualDescriptor = descriptor.getVariableDescriptor();
|
||||
@@ -206,7 +212,7 @@ public class ExpectedResolveData {
|
||||
PsiElement element = file.findElementAt(position);
|
||||
JetExpression expression = getAncestorOfType(JetExpression.class, element);
|
||||
|
||||
JetType expressionType = bindingContext.getExpressionType(expression);
|
||||
JetType expressionType = bindingContext.get(BindingContext.EXPRESSION_TYPE, expression);
|
||||
TypeConstructor expectedTypeConstructor;
|
||||
if (typeName.startsWith("std::")) {
|
||||
ClassifierDescriptor expectedClass = lib.getLibraryScope().getClassifier(typeName.substring(5));
|
||||
@@ -221,11 +227,11 @@ public class ExpectedResolveData {
|
||||
JetDeclaration declaration = getAncestorOfType(JetDeclaration.class, declElement);
|
||||
assertNotNull(declaration);
|
||||
if (declaration instanceof JetClass) {
|
||||
ClassDescriptor classDescriptor = bindingContext.getClassDescriptor((JetClass) declaration);
|
||||
ClassDescriptor classDescriptor = bindingContext.get(BindingContext.CLASS, (JetClass) declaration);
|
||||
expectedTypeConstructor = classDescriptor.getTypeConstructor();
|
||||
}
|
||||
else if (declaration instanceof JetTypeParameter) {
|
||||
TypeParameterDescriptor typeParameterDescriptor = bindingContext.getTypeParameterDescriptor((JetTypeParameter) declaration);
|
||||
TypeParameterDescriptor typeParameterDescriptor = bindingContext.get(BindingContext.TYPE_PARAMETER, (JetTypeParameter) declaration);
|
||||
expectedTypeConstructor = typeParameterDescriptor.getTypeConstructor();
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user