KT-2363 Drop secondary constructors

#KT-2363 Fixed
This commit is contained in:
Andrey Breslav
2012-07-19 19:52:56 +04:00
parent fd96e9b9c0
commit bf503e9a4b
64 changed files with 240 additions and 1695 deletions
@@ -884,10 +884,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
@Override @Override
protected void generateDeclaration(PropertyCodegen propertyCodegen, JetDeclaration declaration, FunctionCodegen functionCodegen) { protected void generateDeclaration(PropertyCodegen propertyCodegen, JetDeclaration declaration, FunctionCodegen functionCodegen) {
if (declaration instanceof JetSecondaryConstructor) { if (declaration instanceof JetClassObject) {
generateSecondaryConstructor((JetSecondaryConstructor) declaration);
}
else if (declaration instanceof JetClassObject) {
// done earlier in order to have accessors // done earlier in order to have accessors
} }
else if (declaration instanceof JetEnumEntry && !((JetEnumEntry) declaration).hasPrimaryConstructor()) { else if (declaration instanceof JetEnumEntry && !((JetEnumEntry) declaration).hasPrimaryConstructor()) {
@@ -944,57 +941,6 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
} }
} }
private void generateSecondaryConstructor(JetSecondaryConstructor constructor) {
ConstructorDescriptor constructorDescriptor = bindingContext.get(BindingContext.CONSTRUCTOR, constructor);
if (constructorDescriptor == null) {
throw new UnsupportedOperationException("failed to get descriptor for secondary constructor");
}
CallableMethod method = typeMapper.mapToCallableMethod(constructorDescriptor, kind, typeMapper.hasThis0(constructorDescriptor.getContainingDeclaration()));
int flags = JetTypeMapper.getAccessModifiers(constructorDescriptor, 0);
final MethodVisitor mv = v.newMethod(constructor, flags, "<init>", method.getSignature().getAsmMethod().getDescriptor(), null, null);
AnnotationVisitor jetConstructorVisitor = mv.visitAnnotation(JvmStdlibNames.JET_CONSTRUCTOR.getDescriptor(), true);
int flagsValue = BitSetUtils.toInt(CodegenUtil.getFlagsForVisibility(constructorDescriptor.getVisibility()));
if (JvmStdlibNames.FLAGS_DEFAULT_VALUE != flagsValue) {
jetConstructorVisitor.visit(JvmStdlibNames.JET_CLASS_FLAGS_FIELD, flagsValue);
}
jetConstructorVisitor.visitEnd();
if (state.getClassBuilderMode() == ClassBuilderMode.STUBS) {
StubCodegen.generateStubCode(mv);
}
else if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
mv.visitCode();
ConstructorFrameMap frameMap = new ConstructorFrameMap(method, constructorDescriptor, typeMapper.hasThis0(constructorDescriptor.getContainingDeclaration()));
final InstructionAdapter iv = new InstructionAdapter(mv);
ExpressionCodegen codegen = new ExpressionCodegen(mv, frameMap, Type.VOID_TYPE, context, state);
for (JetDelegationSpecifier initializer : constructor.getInitializers()) {
if (initializer instanceof JetDelegatorToThisCall) {
JetDelegatorToThisCall thisCall = (JetDelegatorToThisCall) initializer;
DeclarationDescriptor thisDescriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, thisCall.getThisReference());
if (!(thisDescriptor instanceof ConstructorDescriptor)) {
throw new UnsupportedOperationException("expected 'this' delegator to resolve to constructor");
}
generateDelegatorToConstructorCall(iv, codegen, thisCall, (ConstructorDescriptor) thisDescriptor, frameMap, flags);
}
else {
throw new UnsupportedOperationException("unknown initializer type");
}
}
JetExpression bodyExpression = constructor.getBodyExpression();
if (bodyExpression != null) {
codegen.gen(bodyExpression, Type.VOID_TYPE);
}
mv.visitInsn(RETURN);
FunctionCodegen.endVisit(mv, "constructor", null);
}
}
public static void generateInitializers(@NotNull ExpressionCodegen codegen, @NotNull InstructionAdapter iv, @NotNull List<JetDeclaration> declarations, public static void generateInitializers(@NotNull ExpressionCodegen codegen, @NotNull InstructionAdapter iv, @NotNull List<JetDeclaration> declarations,
@NotNull BindingContext bindingContext, @NotNull JetTypeMapper typeMapper) { @NotNull BindingContext bindingContext, @NotNull JetTypeMapper typeMapper) {
for (JetDeclaration declaration : declarations) { for (JetDeclaration declaration : declarations) {
@@ -37,7 +37,6 @@ public interface JetNodeTypes {
JetNodeType OBJECT_DECLARATION_NAME = new JetNodeType("OBJECT_DECLARATION_NAME", JetObjectDeclarationName.class); JetNodeType OBJECT_DECLARATION_NAME = new JetNodeType("OBJECT_DECLARATION_NAME", JetObjectDeclarationName.class);
JetNodeType CLASS_OBJECT = new JetNodeType("CLASS_OBJECT", JetClassObject.class); JetNodeType CLASS_OBJECT = new JetNodeType("CLASS_OBJECT", JetClassObject.class);
JetNodeType CONSTRUCTOR = new JetNodeType("CONSTRUCTOR", JetSecondaryConstructor.class);
IElementType ENUM_ENTRY = JetStubElementTypes.ENUM_ENTRY; IElementType ENUM_ENTRY = JetStubElementTypes.ENUM_ENTRY;
JetNodeType ANONYMOUS_INITIALIZER = new JetNodeType("ANONYMOUS_INITIALIZER", JetClassInitializer.class); JetNodeType ANONYMOUS_INITIALIZER = new JetNodeType("ANONYMOUS_INITIALIZER", JetClassInitializer.class);
@@ -620,7 +620,7 @@ public class JetControlFlowProcessor {
if (subroutine instanceof JetFunctionLiteralExpression) { if (subroutine instanceof JetFunctionLiteralExpression) {
subroutine = ((JetFunctionLiteralExpression) subroutine).getFunctionLiteral(); subroutine = ((JetFunctionLiteralExpression) subroutine).getFunctionLiteral();
} }
if (subroutine instanceof JetFunction || subroutine instanceof JetPropertyAccessor || subroutine instanceof JetSecondaryConstructor) { if (subroutine instanceof JetFunction || subroutine instanceof JetPropertyAccessor) {
if (returnedExpression == null) { if (returnedExpression == null) {
builder.returnNoValue(expression, subroutine); builder.returnNoValue(expression, subroutine);
} }
@@ -245,7 +245,6 @@ public interface Errors {
SimpleDiagnosticFactory<JetTypeReference> SUPERTYPE_NOT_A_CLASS_OR_TRAIT = SimpleDiagnosticFactory.create(ERROR); SimpleDiagnosticFactory<JetTypeReference> SUPERTYPE_NOT_A_CLASS_OR_TRAIT = SimpleDiagnosticFactory.create(ERROR);
SimpleDiagnosticFactory<PsiElement> SUPERTYPE_INITIALIZED_IN_TRAIT = SimpleDiagnosticFactory.create(ERROR); SimpleDiagnosticFactory<PsiElement> SUPERTYPE_INITIALIZED_IN_TRAIT = SimpleDiagnosticFactory.create(ERROR);
SimpleDiagnosticFactory<PsiElement> CONSTRUCTOR_IN_TRAIT = SimpleDiagnosticFactory.create(ERROR); SimpleDiagnosticFactory<PsiElement> CONSTRUCTOR_IN_TRAIT = SimpleDiagnosticFactory.create(ERROR);
SimpleDiagnosticFactory<JetSecondaryConstructor> SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED = SimpleDiagnosticFactory.create(WARNING);
SimpleDiagnosticFactory<JetTypeReference> SUPERTYPE_APPEARS_TWICE = SimpleDiagnosticFactory.create(ERROR); SimpleDiagnosticFactory<JetTypeReference> SUPERTYPE_APPEARS_TWICE = SimpleDiagnosticFactory.create(ERROR);
SimpleDiagnosticFactory<JetTypeReference> FINAL_SUPERTYPE = SimpleDiagnosticFactory.create(ERROR); SimpleDiagnosticFactory<JetTypeReference> FINAL_SUPERTYPE = SimpleDiagnosticFactory.create(ERROR);
@@ -279,7 +279,6 @@ public class DefaultErrorMessages {
MAP.put(SUPERTYPE_NOT_A_CLASS_OR_TRAIT, "Only classes and traits may serve as supertypes"); MAP.put(SUPERTYPE_NOT_A_CLASS_OR_TRAIT, "Only classes and traits may serve as supertypes");
MAP.put(SUPERTYPE_INITIALIZED_IN_TRAIT, "Traits cannot initialize supertypes"); MAP.put(SUPERTYPE_INITIALIZED_IN_TRAIT, "Traits cannot initialize supertypes");
MAP.put(CONSTRUCTOR_IN_TRAIT, "A trait may not have a constructor"); MAP.put(CONSTRUCTOR_IN_TRAIT, "A trait may not have a constructor");
MAP.put(SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED, "Secondary constructors are not supported");
MAP.put(SUPERTYPE_APPEARS_TWICE, "A supertype appears twice"); MAP.put(SUPERTYPE_APPEARS_TWICE, "A supertype appears twice");
MAP.put(FINAL_SUPERTYPE, "This type is final, so it cannot be inherited from"); MAP.put(FINAL_SUPERTYPE, "This type is final, so it cannot be inherited from");
@@ -651,9 +651,6 @@ public class JetParsing extends AbstractJetParsing {
else if (keywordToken == TYPE_KEYWORD) { else if (keywordToken == TYPE_KEYWORD) {
declType = parseTypeDef(); declType = parseTypeDef();
} }
else if (keywordToken == THIS_KEYWORD) {
declType = parseConstructor();
}
else if (keywordToken == OBJECT_KEYWORD) { else if (keywordToken == OBJECT_KEYWORD) {
parseObject(true, true); parseObject(true, true);
declType = OBJECT_DECLARATION; declType = OBJECT_DECLARATION;
@@ -709,34 +706,6 @@ public class JetParsing extends AbstractJetParsing {
} }
} }
/*
* constructor
* : modifiers "this" functionParameters (":" initializer{","}) block?
* ;
*/
private JetNodeType parseConstructor() {
assert _at(THIS_KEYWORD);
advance(); // THIS_KEYWORD
parseValueParameterList(false, TokenSet.create(COLON, LBRACE, SEMICOLON));
if (at(COLON)) {
advance(); // COLON
parseInitializerList();
}
if (at(LBRACE)) {
parseBlock();
}
else {
consumeIf(SEMICOLON);
}
return CONSTRUCTOR;
}
/* /*
* initializer{","} * initializer{","}
*/ */
@@ -58,14 +58,6 @@ public class JetClass extends JetTypeParameterListOwnerStub<PsiJetClassStub> imp
return body.getDeclarations(); return body.getDeclarations();
} }
@NotNull
public List<JetSecondaryConstructor> getSecondaryConstructors() {
JetClassBody body = (JetClassBody) findChildByType(JetNodeTypes.CLASS_BODY);
if (body == null) return Collections.emptyList();
return body.getSecondaryConstructors();
}
@Override @Override
public void accept(@NotNull JetVisitorVoid visitor) { public void accept(@NotNull JetVisitorVoid visitor) {
visitor.visitClass(this); visitor.visitClass(this);
@@ -41,10 +41,6 @@ public class JetClassBody extends JetElementImpl implements JetDeclarationContai
return PsiTreeUtil.getChildrenOfTypeAsList(this, JetDeclaration.class); return PsiTreeUtil.getChildrenOfTypeAsList(this, JetDeclaration.class);
} }
public List<JetSecondaryConstructor> getSecondaryConstructors() {
return PsiTreeUtil.getChildrenOfTypeAsList(this, JetSecondaryConstructor.class);
}
@Override @Override
public void accept(@NotNull JetVisitorVoid visitor) { public void accept(@NotNull JetVisitorVoid visitor) {
visitor.visitClassBody(this); visitor.visitClassBody(this);
@@ -1,93 +0,0 @@
/*
* Copyright 2010-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.jet.lang.psi;
import com.intellij.lang.ASTNode;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.JetNodeTypes;
import org.jetbrains.jet.lexer.JetTokens;
import java.util.Collections;
import java.util.List;
/**
* @author max
*/
public class JetSecondaryConstructor extends JetDeclarationImpl implements JetDeclarationWithBody, JetStatementExpression {
public JetSecondaryConstructor(@NotNull ASTNode node) {
super(node);
}
@Override
public void accept(@NotNull JetVisitorVoid visitor) {
visitor.visitConstructor(this);
}
@Override
public <R, D> R accept(@NotNull JetVisitor<R, D> visitor, D data) {
return visitor.visitConstructor(this, data);
}
@Nullable @IfNotParsed
public JetParameterList getParameterList() {
return (JetParameterList) findChildByType(JetNodeTypes.VALUE_PARAMETER_LIST);
}
@Override
@NotNull
public List<JetParameter> getValueParameters() {
JetParameterList list = getParameterList();
return list != null ? list.getParameters() : Collections.<JetParameter>emptyList();
}
@Nullable
public JetInitializerList getInitializerList() {
return (JetInitializerList) findChildByType(JetNodeTypes.INITIALIZER_LIST);
}
@NotNull
public List<JetDelegationSpecifier> getInitializers() {
JetInitializerList list = getInitializerList();
return list != null ? list.getInitializers() : Collections.<JetDelegationSpecifier>emptyList();
}
@Override
public JetExpression getBodyExpression() {
return findChildByClass(JetExpression.class);
}
@Override
public boolean hasBlockBody() {
return findChildByType(JetTokens.EQ) == null;
}
@Override
public boolean hasDeclaredReturnType() {
return true;
}
@NotNull
@Override
public JetElement asElement() {
return this;
}
public ASTNode getNameNode() {
return getNode().findChildByType(JetTokens.THIS_KEYWORD);
}
}
@@ -39,10 +39,6 @@ public class JetVisitor<R, D> extends PsiElementVisitor {
return visitDeclaration(classObject, data); return visitDeclaration(classObject, data);
} }
public R visitConstructor(JetSecondaryConstructor constructor, D data) {
return visitDeclaration(constructor, data);
}
public R visitNamedFunction(JetNamedFunction function, D data) { public R visitNamedFunction(JetNamedFunction function, D data) {
return visitNamedDeclaration(function, data); return visitNamedDeclaration(function, data);
} }
@@ -38,10 +38,6 @@ public class JetVisitorVoid extends PsiElementVisitor {
visitDeclaration(classObject); visitDeclaration(classObject);
} }
public void visitConstructor(JetSecondaryConstructor constructor) {
visitDeclaration(constructor);
}
public void visitNamedFunction(JetNamedFunction function) { public void visitNamedFunction(JetNamedFunction function) {
visitNamedDeclaration(function); visitNamedDeclaration(function);
} }
@@ -31,7 +31,6 @@ import java.util.Map;
public interface BodiesResolveContext { public interface BodiesResolveContext {
Map<JetClass, MutableClassDescriptor> getClasses(); Map<JetClass, MutableClassDescriptor> getClasses();
Map<JetObjectDeclaration, MutableClassDescriptor> getObjects(); Map<JetObjectDeclaration, MutableClassDescriptor> getObjects();
Map<JetSecondaryConstructor, ConstructorDescriptor> getConstructors();
Map<JetProperty, PropertyDescriptor> getProperties(); Map<JetProperty, PropertyDescriptor> getProperties();
Map<JetNamedFunction, SimpleFunctionDescriptor> getFunctions(); Map<JetNamedFunction, SimpleFunctionDescriptor> getFunctions();
Map<JetDeclaration, JetScope> getDeclaringScopes(); Map<JetDeclaration, JetScope> getDeclaringScopes();
@@ -21,41 +21,8 @@ import com.google.common.collect.Sets;
import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElement;
import com.intellij.util.containers.Queue; import com.intellij.util.containers.Queue;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.descriptors.ClassDescriptor; import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.descriptors.ClassKind; import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.descriptors.ConstructorDescriptor;
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
import org.jetbrains.jet.lang.descriptors.FunctionDescriptorUtil;
import org.jetbrains.jet.lang.descriptors.MutableClassDescriptor;
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
import org.jetbrains.jet.lang.descriptors.PropertyGetterDescriptor;
import org.jetbrains.jet.lang.descriptors.PropertySetterDescriptor;
import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor;
import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor;
import org.jetbrains.jet.lang.psi.JetClass;
import org.jetbrains.jet.lang.psi.JetClassInitializer;
import org.jetbrains.jet.lang.psi.JetClassOrObject;
import org.jetbrains.jet.lang.psi.JetDeclarationWithBody;
import org.jetbrains.jet.lang.psi.JetDelegationSpecifier;
import org.jetbrains.jet.lang.psi.JetDelegatorByExpressionSpecifier;
import org.jetbrains.jet.lang.psi.JetDelegatorToSuperCall;
import org.jetbrains.jet.lang.psi.JetDelegatorToSuperClass;
import org.jetbrains.jet.lang.psi.JetDelegatorToThisCall;
import org.jetbrains.jet.lang.psi.JetElement;
import org.jetbrains.jet.lang.psi.JetEnumEntry;
import org.jetbrains.jet.lang.psi.JetExpression;
import org.jetbrains.jet.lang.psi.JetNamedFunction;
import org.jetbrains.jet.lang.psi.JetObjectDeclaration;
import org.jetbrains.jet.lang.psi.JetParameter;
import org.jetbrains.jet.lang.psi.JetProperty;
import org.jetbrains.jet.lang.psi.JetPropertyAccessor;
import org.jetbrains.jet.lang.psi.JetReferenceExpression;
import org.jetbrains.jet.lang.psi.JetSecondaryConstructor;
import org.jetbrains.jet.lang.psi.JetSimpleNameExpression;
import org.jetbrains.jet.lang.psi.JetTypeReference;
import org.jetbrains.jet.lang.psi.JetValueArgumentList;
import org.jetbrains.jet.lang.psi.JetVisitorVoid;
import org.jetbrains.jet.lang.resolve.calls.CallMaker; import org.jetbrains.jet.lang.resolve.calls.CallMaker;
import org.jetbrains.jet.lang.resolve.calls.CallResolver; import org.jetbrains.jet.lang.resolve.calls.CallResolver;
import org.jetbrains.jet.lang.resolve.calls.OverloadResolutionResults; import org.jetbrains.jet.lang.resolve.calls.OverloadResolutionResults;
@@ -65,43 +32,18 @@ import org.jetbrains.jet.lang.resolve.scopes.RedeclarationHandler;
import org.jetbrains.jet.lang.resolve.scopes.WritableScope; import org.jetbrains.jet.lang.resolve.scopes.WritableScope;
import org.jetbrains.jet.lang.resolve.scopes.WritableScopeImpl; import org.jetbrains.jet.lang.resolve.scopes.WritableScopeImpl;
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor; import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor;
import org.jetbrains.jet.lang.types.DeferredType; import org.jetbrains.jet.lang.types.*;
import org.jetbrains.jet.lang.types.ErrorUtils;
import org.jetbrains.jet.lang.types.JetType;
import org.jetbrains.jet.lang.types.TypeConstructor;
import org.jetbrains.jet.lang.types.TypeUtils;
import org.jetbrains.jet.lang.types.checker.JetTypeChecker; import org.jetbrains.jet.lang.types.checker.JetTypeChecker;
import org.jetbrains.jet.lang.types.expressions.ExpressionTypingServices; import org.jetbrains.jet.lang.types.expressions.ExpressionTypingServices;
import org.jetbrains.jet.lang.types.lang.JetStandardClasses;
import org.jetbrains.jet.lexer.JetTokens; import org.jetbrains.jet.lexer.JetTokens;
import org.jetbrains.jet.util.Box; import org.jetbrains.jet.util.Box;
import org.jetbrains.jet.util.lazy.ReenteringLazyValueComputationException; import org.jetbrains.jet.util.lazy.ReenteringLazyValueComputationException;
import org.jetbrains.jet.util.slicedmap.WritableSlice; import org.jetbrains.jet.util.slicedmap.WritableSlice;
import javax.inject.Inject; import javax.inject.Inject;
import java.util.Collection; import java.util.*;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import static org.jetbrains.jet.lang.diagnostics.Errors.ANONYMOUS_INITIALIZER_WITHOUT_CONSTRUCTOR; import static org.jetbrains.jet.lang.diagnostics.Errors.*;
import static org.jetbrains.jet.lang.diagnostics.Errors.BY_IN_SECONDARY_CONSTRUCTOR;
import static org.jetbrains.jet.lang.diagnostics.Errors.CONSTRUCTOR_IN_TRAIT;
import static org.jetbrains.jet.lang.diagnostics.Errors.DELEGATION_IN_TRAIT;
import static org.jetbrains.jet.lang.diagnostics.Errors.DELEGATION_NOT_TO_TRAIT;
import static org.jetbrains.jet.lang.diagnostics.Errors.FINAL_SUPERTYPE;
import static org.jetbrains.jet.lang.diagnostics.Errors.INITIALIZER_WITH_NO_ARGUMENTS;
import static org.jetbrains.jet.lang.diagnostics.Errors.MANY_CALLS_TO_THIS;
import static org.jetbrains.jet.lang.diagnostics.Errors.MANY_CLASSES_IN_SUPERTYPE_LIST;
import static org.jetbrains.jet.lang.diagnostics.Errors.SECONDARY_CONSTRUCTOR_BUT_NO_PRIMARY;
import static org.jetbrains.jet.lang.diagnostics.Errors.SECONDARY_CONSTRUCTOR_NO_INITIALIZER_LIST;
import static org.jetbrains.jet.lang.diagnostics.Errors.SUPERTYPE_APPEARS_TWICE;
import static org.jetbrains.jet.lang.diagnostics.Errors.SUPERTYPE_INITIALIZED_IN_TRAIT;
import static org.jetbrains.jet.lang.diagnostics.Errors.SUPERTYPE_NOT_A_CLASS_OR_TRAIT;
import static org.jetbrains.jet.lang.diagnostics.Errors.SUPERTYPE_NOT_INITIALIZED;
import static org.jetbrains.jet.lang.diagnostics.Errors.SUPERTYPE_NOT_INITIALIZED_DEFAULT;
import static org.jetbrains.jet.lang.diagnostics.Errors.TYPE_MISMATCH;
import static org.jetbrains.jet.lang.resolve.BindingContext.DEFERRED_TYPE; import static org.jetbrains.jet.lang.resolve.BindingContext.DEFERRED_TYPE;
import static org.jetbrains.jet.lang.types.TypeUtils.NO_EXPECTED_TYPE; import static org.jetbrains.jet.lang.types.TypeUtils.NO_EXPECTED_TYPE;
@@ -180,7 +122,6 @@ public class BodyResolver {
resolveAnonymousInitializers(); resolveAnonymousInitializers();
resolvePrimaryConstructorParameters(); resolvePrimaryConstructorParameters();
resolveSecondaryConstructorBodies();
resolveFunctionBodies(); resolveFunctionBodies();
scriptBodyResolverResolver.resolveScriptBodies(); scriptBodyResolverResolver.resolveScriptBodies();
@@ -411,95 +352,6 @@ public class BodyResolver {
} }
} }
private void resolveSecondaryConstructorBodies() {
for (Map.Entry<JetSecondaryConstructor, ConstructorDescriptor> entry : this.context.getConstructors().entrySet()) {
JetSecondaryConstructor constructor = entry.getKey();
ConstructorDescriptor descriptor = entry.getValue();
resolveSecondaryConstructorBody(constructor, descriptor);
assert descriptor.getReturnType() != null;
}
}
private void resolveSecondaryConstructorBody(JetSecondaryConstructor declaration, final ConstructorDescriptor descriptor) {
if (!context.completeAnalysisNeeded(declaration)) return;
MutableClassDescriptor classDescriptor = (MutableClassDescriptor) descriptor.getContainingDeclaration();
final JetScope scopeForSupertypeInitializers = FunctionDescriptorUtil.getFunctionInnerScope(classDescriptor.getScopeForSupertypeResolution(), descriptor, trace);
//contains only constructor parameters
final JetScope scopeForConstructorBody = FunctionDescriptorUtil.getFunctionInnerScope(classDescriptor.getScopeForInitializers(), descriptor, trace);
//contains members & backing fields
final DataFlowInfo dataFlowInfo = DataFlowInfo.EMPTY; // TODO: dataFlowInfo
PsiElement nameElement = declaration.getNameNode().getPsi();
if (classDescriptor.getUnsubstitutedPrimaryConstructor() == null) {
trace.report(SECONDARY_CONSTRUCTOR_BUT_NO_PRIMARY.on(nameElement));
}
else {
List<JetDelegationSpecifier> initializers = declaration.getInitializers();
if (initializers.isEmpty()) {
trace.report(SECONDARY_CONSTRUCTOR_NO_INITIALIZER_LIST.on(nameElement));
}
else {
initializers.get(0).accept(new JetVisitorVoid() {
@Override
public void visitDelegationToSuperCallSpecifier(JetDelegatorToSuperCall call) {
JetTypeReference typeReference = call.getTypeReference();
if (typeReference != null) {
callResolver.resolveFunctionCall(trace, scopeForSupertypeInitializers,
CallMaker.makeCall(ReceiverDescriptor.NO_RECEIVER, null, call),
NO_EXPECTED_TYPE, dataFlowInfo);
}
}
@Override
public void visitDelegationToThisCall(JetDelegatorToThisCall call) {
// TODO : check that there's no recursion in this() calls
// TODO : check: if a this() call is present, no other initializers are allowed
ClassDescriptor classDescriptor = descriptor.getContainingDeclaration();
callResolver.resolveFunctionCall(trace,
scopeForSupertypeInitializers,
CallMaker.makeCall(ReceiverDescriptor.NO_RECEIVER, null, call), NO_EXPECTED_TYPE, dataFlowInfo);
// call.getThisReference(),
// classDescriptor,
// classDescriptor.getDefaultType(),
// call);
// trace.getErrorHandler().genericError(call.getNode(), "this-calls are not supported");
}
@Override
public void visitDelegationByExpressionSpecifier(JetDelegatorByExpressionSpecifier specifier) {
trace.report(BY_IN_SECONDARY_CONSTRUCTOR.on(specifier));
}
@Override
public void visitDelegationToSuperClassSpecifier(JetDelegatorToSuperClass specifier) {
trace.report(INITIALIZER_WITH_NO_ARGUMENTS.on(specifier));
}
@Override
public void visitDelegationSpecifier(JetDelegationSpecifier specifier) {
throw new IllegalStateException();
}
});
for (int i = 1, initializersSize = initializers.size(); i < initializersSize; i++) {
JetDelegationSpecifier initializer = initializers.get(i);
trace.report(MANY_CALLS_TO_THIS.on(initializer));
}
}
}
JetExpression bodyExpression = declaration.getBodyExpression();
if (bodyExpression != null) {
expressionTypingServices.checkFunctionReturnType(scopeForConstructorBody, declaration, descriptor, DataFlowInfo.EMPTY,
JetStandardClasses.getUnitType(), trace);
}
checkDefaultParameterValues(declaration.getValueParameters(), descriptor.getValueParameters(), scopeForConstructorBody);
}
private void resolvePropertyDeclarationBodies() { private void resolvePropertyDeclarationBodies() {
// Member properties // Member properties
@@ -36,7 +36,6 @@ import java.util.Map;
public class CachedBodiesResolveContext implements BodiesResolveContext { public class CachedBodiesResolveContext implements BodiesResolveContext {
private final Map<JetClass, MutableClassDescriptor> classes; private final Map<JetClass, MutableClassDescriptor> classes;
private final Map<JetObjectDeclaration, MutableClassDescriptor> objects; private final Map<JetObjectDeclaration, MutableClassDescriptor> objects;
private final Map<JetSecondaryConstructor, ConstructorDescriptor> constructors;
private final Map<JetProperty, PropertyDescriptor> properties; private final Map<JetProperty, PropertyDescriptor> properties;
private final Map<JetNamedFunction, SimpleFunctionDescriptor> functions; private final Map<JetNamedFunction, SimpleFunctionDescriptor> functions;
private final Map<JetDeclaration, JetScope> declaringScopes; private final Map<JetDeclaration, JetScope> declaringScopes;
@@ -48,7 +47,6 @@ public class CachedBodiesResolveContext implements BodiesResolveContext {
public CachedBodiesResolveContext(TopDownAnalysisContext context) { public CachedBodiesResolveContext(TopDownAnalysisContext context) {
classes = Collections.unmodifiableMap(context.getClasses()); classes = Collections.unmodifiableMap(context.getClasses());
objects = Collections.unmodifiableMap(context.getObjects()); objects = Collections.unmodifiableMap(context.getObjects());
constructors = Collections.unmodifiableMap(context.getConstructors());
properties = Collections.unmodifiableMap(context.getProperties()); properties = Collections.unmodifiableMap(context.getProperties());
functions = Collections.unmodifiableMap(context.getFunctions()); functions = Collections.unmodifiableMap(context.getFunctions());
declaringScopes = Collections.unmodifiableMap(context.getDeclaringScopes()); declaringScopes = Collections.unmodifiableMap(context.getDeclaringScopes());
@@ -68,11 +66,6 @@ public class CachedBodiesResolveContext implements BodiesResolveContext {
return objects; return objects;
} }
@Override
public Map<JetSecondaryConstructor, ConstructorDescriptor> getConstructors() {
return constructors;
}
@Override @Override
public Map<JetProperty, PropertyDescriptor> getProperties() { public Map<JetProperty, PropertyDescriptor> getProperties() {
return properties; return properties;
@@ -23,7 +23,6 @@ import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor; import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor;
import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.types.JetType; import org.jetbrains.jet.lang.types.JetType;
import org.jetbrains.jet.lang.types.lang.JetStandardClasses;
import javax.inject.Inject; import javax.inject.Inject;
import java.util.Map; import java.util.Map;
@@ -65,10 +64,6 @@ public class ControlFlowAnalyzer {
: functionDescriptor.getReturnType(); : functionDescriptor.getReturnType();
checkFunction(function, expectedReturnType); checkFunction(function, expectedReturnType);
} }
for (JetSecondaryConstructor constructor : bodiesResolveContext.getConstructors().keySet()) {
if (!bodiesResolveContext.completeAnalysisNeeded(constructor)) continue;
checkFunction(constructor, JetStandardClasses.getUnitType());
}
for (Map.Entry<JetProperty, PropertyDescriptor> entry : bodiesResolveContext.getProperties().entrySet()) { for (Map.Entry<JetProperty, PropertyDescriptor> entry : bodiesResolveContext.getProperties().entrySet()) {
JetProperty property = entry.getKey(); JetProperty property = entry.getKey();
if (!bodiesResolveContext.completeAnalysisNeeded(property)) continue; if (!bodiesResolveContext.completeAnalysisNeeded(property)) continue;
@@ -103,9 +103,6 @@ public class DeclarationResolver {
MutableClassDescriptor classDescriptor = entry.getValue(); MutableClassDescriptor classDescriptor = entry.getValue();
processPrimaryConstructor(classDescriptor, jetClass); processPrimaryConstructor(classDescriptor, jetClass);
for (JetSecondaryConstructor jetConstructor : jetClass.getSecondaryConstructors()) {
processSecondaryConstructor(classDescriptor, jetConstructor);
}
} }
} }
@@ -250,20 +247,6 @@ public class DeclarationResolver {
} }
} }
private void processSecondaryConstructor(MutableClassDescriptor classDescriptor, JetSecondaryConstructor constructor) {
trace.report(SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED.on(constructor));
if (classDescriptor.getKind() == ClassKind.TRAIT) {
trace.report(CONSTRUCTOR_IN_TRAIT.on(constructor.getNameNode().getPsi()));
}
ConstructorDescriptor constructorDescriptor = descriptorResolver.resolveSecondaryConstructorDescriptor(
classDescriptor.getScopeForMemberResolution(),
classDescriptor,
constructor, trace);
classDescriptor.addConstructor(constructorDescriptor, trace);
context.getConstructors().put(constructor, constructorDescriptor);
context.getDeclaringScopes().put(constructor, classDescriptor.getScopeForMemberLookup());
}
private void checkRedeclarationsInNamespaces() { private void checkRedeclarationsInNamespaces() {
for (NamespaceDescriptorImpl descriptor : context.getNamespaceDescriptors().values()) { for (NamespaceDescriptorImpl descriptor : context.getNamespaceDescriptors().values()) {
Multimap<Name, DeclarationDescriptor> simpleNameDescriptors = descriptor.getMemberScope().getDeclaredDescriptorsAccessibleBySimpleName(); Multimap<Name, DeclarationDescriptor> simpleNameDescriptors = descriptor.getMemberScope().getDeclaredDescriptorsAccessibleBySimpleName();
@@ -884,11 +884,6 @@ public class DescriptorResolver {
return getterDescriptor; return getterDescriptor;
} }
@NotNull
public ConstructorDescriptorImpl resolveSecondaryConstructorDescriptor(@NotNull JetScope scope, @NotNull ClassDescriptor classDescriptor, @NotNull JetSecondaryConstructor constructor, BindingTrace trace) {
return createConstructorDescriptor(scope, classDescriptor, false, constructor.getModifierList(), constructor, classDescriptor.getTypeConstructor().getParameters(), constructor.getValueParameters(), trace);
}
@NotNull @NotNull
private ConstructorDescriptorImpl createConstructorDescriptor( private ConstructorDescriptorImpl createConstructorDescriptor(
@NotNull JetScope scope, @NotNull JetScope scope,
@@ -23,7 +23,6 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.psi.JetElement; import org.jetbrains.jet.lang.psi.JetElement;
import org.jetbrains.jet.lang.psi.JetFunction; import org.jetbrains.jet.lang.psi.JetFunction;
import org.jetbrains.jet.lang.psi.JetSecondaryConstructor;
import org.jetbrains.jet.lang.resolve.name.FqName; import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.name.FqNameUnsafe; import org.jetbrains.jet.lang.resolve.name.FqNameUnsafe;
import org.jetbrains.jet.lang.resolve.name.Name; import org.jetbrains.jet.lang.resolve.name.Name;
@@ -224,9 +223,6 @@ public class DescriptorUtils {
expectedType = TypeUtils.NO_EXPECTED_TYPE; expectedType = TypeUtils.NO_EXPECTED_TYPE;
} }
} }
else if (function instanceof JetSecondaryConstructor) {
expectedType = JetStandardClasses.getUnitType();
}
else { else {
expectedType = descriptor.getReturnType(); expectedType = descriptor.getReturnType();
} }
@@ -40,7 +40,6 @@ public class TopDownAnalysisContext implements BodiesResolveContext {
private final Map<JetDeclaration, JetScope> declaringScopes = Maps.newHashMap(); private final Map<JetDeclaration, JetScope> declaringScopes = Maps.newHashMap();
private final Map<JetNamedFunction, SimpleFunctionDescriptor> functions = Maps.newLinkedHashMap(); private final Map<JetNamedFunction, SimpleFunctionDescriptor> functions = Maps.newLinkedHashMap();
private final Map<JetSecondaryConstructor, ConstructorDescriptor> constructors = Maps.newLinkedHashMap();
private final Map<JetProperty, PropertyDescriptor> properties = Maps.newLinkedHashMap(); private final Map<JetProperty, PropertyDescriptor> properties = Maps.newLinkedHashMap();
private final Map<JetParameter, PropertyDescriptor> primaryConstructorParameterProperties = Maps.newHashMap(); private final Map<JetParameter, PropertyDescriptor> primaryConstructorParameterProperties = Maps.newHashMap();
private Map<JetDeclaration, CallableMemberDescriptor> members = null; private Map<JetDeclaration, CallableMemberDescriptor> members = null;
@@ -133,11 +132,6 @@ public class TopDownAnalysisContext implements BodiesResolveContext {
return primaryConstructorParameterProperties; return primaryConstructorParameterProperties;
} }
@Override
public Map<JetSecondaryConstructor, ConstructorDescriptor> getConstructors() {
return constructors;
}
@Override @Override
public Map<JetProperty, PropertyDescriptor> getProperties() { public Map<JetProperty, PropertyDescriptor> getProperties() {
return properties; return properties;
@@ -1,8 +0,0 @@
class C(val n: Int, val s: String) {
this(n: Int): this(n, "foo") { }
}
fun box(): String {
val c = C(10)
return if (c.s == "foo") "OK" else "fail"
}
@@ -53,10 +53,9 @@ abstract class B1(
class B2() : B1(1, "r") {} class B2() : B1(1, "r") {}
abstract class B3(i: Int) { abstract class B3(i: Int) {
<!SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED!>this(): this(1)<!>
} }
fun foo(<!UNUSED_PARAMETER!>c<!>: B3) { fun foo(<!UNUSED_PARAMETER!>c<!>: B3) {
val <!UNUSED_VARIABLE!>a<!> = <!CREATING_AN_INSTANCE_OF_ABSTRACT_CLASS!>B3()<!> val <!UNUSED_VARIABLE!>a<!> = <!CREATING_AN_INSTANCE_OF_ABSTRACT_CLASS!>B3(1)<!>
val <!UNUSED_VARIABLE!>b<!> = <!CREATING_AN_INSTANCE_OF_ABSTRACT_CLASS!>B1(2, "s")<!> val <!UNUSED_VARIABLE!>b<!> = <!CREATING_AN_INSTANCE_OF_ABSTRACT_CLASS!>B1(2, "s")<!>
} }
@@ -26,9 +26,4 @@ class WithC() {
val zz = x val zz = x
val zzz = <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$a<!> val zzz = <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$a<!>
} }
<!SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED!>this(a : Int) : this() {
val <!UNUSED_VARIABLE!>b<!> = x
}<!>
} }
@@ -7,24 +7,10 @@ class NoC2 : <!SUPERTYPE_NOT_INITIALIZED_DEFAULT!>WithC1<!>
class NoC3 : WithC1() class NoC3 : WithC1()
class WithC2() : <!SUPERTYPE_NOT_INITIALIZED_DEFAULT!>WithC1<!> class WithC2() : <!SUPERTYPE_NOT_INITIALIZED_DEFAULT!>WithC1<!>
class <!CONFLICTING_OVERLOADS!>NoPC<!> {
<!SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED, CONFLICTING_OVERLOADS!><!SECONDARY_CONSTRUCTOR_NO_INITIALIZER_LIST!>this<!>() {}<!>
}
class WithPC0() { class WithPC0() {
<!SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED!>this(a : Int) : this() {}<!>
} }
class WithPC1(a : Int) { class WithPC1(a : Int) {
<!SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED!><!SECONDARY_CONSTRUCTOR_NO_INITIALIZER_LIST!>this<!>() {}<!>
<!SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED!>this(b : Long) : this("") {}<!>
<!SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED!>this(s : String) : this(1) {}<!>
<!SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED!>this(b : Char) : <!NONE_APPLICABLE!>this<!>("", 2) {}<!>
<!SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED!>this(b : Byte) : this(""), <!MANY_CALLS_TO_THIS!>this(1)<!> {}<!>
} }
@@ -7,7 +7,7 @@ fun bar(x : Int = <!TYPE_MISMATCH!>""<!>, y : Int = x, <!UNUSED_PARAMETER!>z<!>
// KT-371 Resolve default parameters for constructors // KT-371 Resolve default parameters for constructors
class A(x : Int = <!UNINITIALIZED_PARAMETER!>y<!>, y : Int = x) { // None of the references is resolved, no types checked class A(x : Int = <!UNINITIALIZED_PARAMETER!>y<!>, y : Int = x) { // None of the references is resolved, no types checked
<!SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED!>this(bool: Boolean, a: Int = <!TYPE_MISMATCH, UNINITIALIZED_PARAMETER!>b<!>, b: String = <!TYPE_MISMATCH!>a<!>) : this(1) {}<!> fun foo(<!UNUSED_PARAMETER!>bool<!>: Boolean, a: Int = <!TYPE_MISMATCH, UNINITIALIZED_PARAMETER!>b<!>, <!UNUSED_PARAMETER!>b<!>: String = <!TYPE_MISMATCH!>a<!>) {}
} }
val z = 3 val z = 3
@@ -137,12 +137,6 @@ fun nonBlockNoReturnIfUnitInOneBranch(): Int = if (1 < 2) <!TYPE_MISMATCH!>{}<!>
val a = <!RETURN_NOT_ALLOWED!>return 1<!> val a = <!RETURN_NOT_ALLOWED!>return 1<!>
class A() { class A() {
<!SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED!>this(a : Int) : this() {
if (a == 1)
return
return <!TYPE_MISMATCH!>1<!>
}<!>
} }
fun illegalConstantBody(): Int = <!TYPE_MISMATCH!>"s"<!> fun illegalConstantBody(): Int = <!TYPE_MISMATCH!>"s"<!>
fun illegalConstantBlock(): String { fun illegalConstantBlock(): String {
@@ -16,11 +16,12 @@ class Test() {
var a : Int = 111 var a : Int = 111
var b : Int get() = $a; set(x) {a = x; $a = x} var b : Int get() = $a; set(x) {a = x; $a = x}
<!SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED!>this(i : Int) : this() { {
<!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$b<!> = $a <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$b<!> = $a
$a = <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$b<!> $a = <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$b<!>
a = <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$b<!> a = <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$b<!>
}<!> }
fun f() { fun f() {
<!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$b<!> = $a <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$b<!> = $a
a = <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$b<!> a = <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$b<!>
@@ -22,7 +22,6 @@ trait T1 {}
trait T2<T> {} trait T2<T> {}
trait Test<!CONSTRUCTOR_IN_TRAIT!>()<!> { trait Test<!CONSTRUCTOR_IN_TRAIT!>()<!> {
<!SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED!><!CONSTRUCTOR_IN_TRAIT, SECONDARY_CONSTRUCTOR_NO_INITIALIZER_LIST!>this<!>(x : Int) {}<!>
} }
trait Test1 : C2<!SUPERTYPE_INITIALIZED_IN_TRAIT!>()<!> {} trait Test1 : C2<!SUPERTYPE_INITIALIZED_IN_TRAIT!>()<!> {}
@@ -1,7 +1,6 @@
open class bar() open class bar()
trait Foo<!CONSTRUCTOR_IN_TRAIT!>()<!> : bar<!SUPERTYPE_INITIALIZED_IN_TRAIT!>()<!>, <!MANY_CLASSES_IN_SUPERTYPE_LIST, SUPERTYPE_APPEARS_TWICE!>bar<!>, <!MANY_CLASSES_IN_SUPERTYPE_LIST, SUPERTYPE_APPEARS_TWICE!>bar<!> { trait Foo<!CONSTRUCTOR_IN_TRAIT!>()<!> : bar<!SUPERTYPE_INITIALIZED_IN_TRAIT!>()<!>, <!MANY_CLASSES_IN_SUPERTYPE_LIST, SUPERTYPE_APPEARS_TWICE!>bar<!>, <!MANY_CLASSES_IN_SUPERTYPE_LIST, SUPERTYPE_APPEARS_TWICE!>bar<!> {
<!SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED!><!CONSTRUCTOR_IN_TRAIT, SECONDARY_CONSTRUCTOR_NO_INITIALIZER_LIST!>this<!>(x : Int) {}<!>
} }
trait Foo2 : bar, Foo { trait Foo2 : bar, Foo {
@@ -1,17 +0,0 @@
class Foo(var bar : Int, var barr : Int, var barrr : Int) {
{
bar = 1
barr = 1
barrr = 1
1 : Int
this : Foo
}
<!SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED!>this(var bar : Int) : this(1, 1, 1) {
bar = <!UNUSED_VALUE!>1<!>
this.bar
1 : Int
val <!UNUSED_VARIABLE!>a<!> : Int =1
this : Foo
}<!>
}
@@ -1,3 +0,0 @@
class Z() {
<!SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED!>this(x : Int) : this() {}<!>
}
@@ -42,7 +42,6 @@ open class X(p: Int, r: Int) {
class Y(i: Int) : X(i, <!UNRESOLVED_REFERENCE!>rrr<!>) { class Y(i: Int) : X(i, <!UNRESOLVED_REFERENCE!>rrr<!>) {
val rrr = 3 val rrr = 3
<!SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED!>this(s: Int, r: Int) : this(s, <!UNRESOLVED_REFERENCE!>rrr<!>)<!>
} }
class Z(val i: Int) : X(<!UNRESOLVED_REFERENCE!>s<!>, <!UNRESOLVED_REFERENCE!>x<!>) { class Z(val i: Int) : X(<!UNRESOLVED_REFERENCE!>s<!>, <!UNRESOLVED_REFERENCE!>x<!>) {
@@ -5,8 +5,5 @@ class Foo {
val c = f val c = f
} }
this() {
}
} }
+1 -12
View File
@@ -33,16 +33,5 @@ JetFile: AnonymousInitializer.jet
PsiElement(IDENTIFIER)('f') PsiElement(IDENTIFIER)('f')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n')
CONSTRUCTOR
PsiElement(this)('this')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
+7 -7
View File
@@ -1,23 +1,23 @@
class A : b by a { class A : b by a {
this() {} class object {}
} }
class A : b by a + b() * 5 { class A : b by a + b() * 5 {
this() {} class object {}
} }
class A : b by (a) { class A : b by (a) {
this() {} class object {}
} }
class A : b by (a {}) { class A : b by (a {}) {
this() {} class object {}
} }
class A : b by a[a {}] { class A : b by a[a {}] {
this() {} class object {}
} }
class A : b by a(a {}) { class A : b by a(a {}) {
this() {} class object {}
} }
class A : b by object { class A : b by object {
fun f() = a {} fun f() = a {}
} { } {
this() {} class object {}
} }
+56 -56
View File
@@ -25,15 +25,15 @@ JetFile: ByCaluses.jet
CLASS_BODY CLASS_BODY
PsiElement(LBRACE)('{') PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
CONSTRUCTOR CLASS_OBJECT
PsiElement(this)('this') PsiElement(class)('class')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
BLOCK OBJECT_DECLARATION
PsiElement(LBRACE)('{') PsiElement(object)('object')
PsiElement(RBRACE)('}') PsiWhiteSpace(' ')
CLASS_BODY
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n') PsiWhiteSpace('\n')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n') PsiWhiteSpace('\n')
@@ -79,15 +79,15 @@ JetFile: ByCaluses.jet
CLASS_BODY CLASS_BODY
PsiElement(LBRACE)('{') PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
CONSTRUCTOR CLASS_OBJECT
PsiElement(this)('this') PsiElement(class)('class')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
BLOCK OBJECT_DECLARATION
PsiElement(LBRACE)('{') PsiElement(object)('object')
PsiElement(RBRACE)('}') PsiWhiteSpace(' ')
CLASS_BODY
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n') PsiWhiteSpace('\n')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n') PsiWhiteSpace('\n')
@@ -118,15 +118,15 @@ JetFile: ByCaluses.jet
CLASS_BODY CLASS_BODY
PsiElement(LBRACE)('{') PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
CONSTRUCTOR CLASS_OBJECT
PsiElement(this)('this') PsiElement(class)('class')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
BLOCK OBJECT_DECLARATION
PsiElement(LBRACE)('{') PsiElement(object)('object')
PsiElement(RBRACE)('}') PsiWhiteSpace(' ')
CLASS_BODY
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n') PsiWhiteSpace('\n')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n') PsiWhiteSpace('\n')
@@ -165,15 +165,15 @@ JetFile: ByCaluses.jet
CLASS_BODY CLASS_BODY
PsiElement(LBRACE)('{') PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
CONSTRUCTOR CLASS_OBJECT
PsiElement(this)('this') PsiElement(class)('class')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
BLOCK OBJECT_DECLARATION
PsiElement(LBRACE)('{') PsiElement(object)('object')
PsiElement(RBRACE)('}') PsiWhiteSpace(' ')
CLASS_BODY
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n') PsiWhiteSpace('\n')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n') PsiWhiteSpace('\n')
@@ -215,15 +215,15 @@ JetFile: ByCaluses.jet
CLASS_BODY CLASS_BODY
PsiElement(LBRACE)('{') PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
CONSTRUCTOR CLASS_OBJECT
PsiElement(this)('this') PsiElement(class)('class')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
BLOCK OBJECT_DECLARATION
PsiElement(LBRACE)('{') PsiElement(object)('object')
PsiElement(RBRACE)('}') PsiWhiteSpace(' ')
CLASS_BODY
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n') PsiWhiteSpace('\n')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n') PsiWhiteSpace('\n')
@@ -266,15 +266,15 @@ JetFile: ByCaluses.jet
CLASS_BODY CLASS_BODY
PsiElement(LBRACE)('{') PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
CONSTRUCTOR CLASS_OBJECT
PsiElement(this)('this') PsiElement(class)('class')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
BLOCK OBJECT_DECLARATION
PsiElement(LBRACE)('{') PsiElement(object)('object')
PsiElement(RBRACE)('}') PsiWhiteSpace(' ')
CLASS_BODY
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n') PsiWhiteSpace('\n')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n') PsiWhiteSpace('\n')
@@ -329,14 +329,14 @@ JetFile: ByCaluses.jet
CLASS_BODY CLASS_BODY
PsiElement(LBRACE)('{') PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
CONSTRUCTOR CLASS_OBJECT
PsiElement(this)('this') PsiElement(class)('class')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
BLOCK OBJECT_DECLARATION
PsiElement(LBRACE)('{') PsiElement(object)('object')
PsiElement(RBRACE)('}') PsiWhiteSpace(' ')
CLASS_BODY
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n') PsiWhiteSpace('\n')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
-7
View File
@@ -1,11 +1,4 @@
class foo { class foo {
this() : this(a, b, c), Foo<T>(bar)
this(foo : bar) : this(a, b, c), Foo<T>(bar) {
}
} }
public class foo() : Bar public class foo() : Bar
+1 -117
View File
@@ -10,123 +10,7 @@ JetFile: Constructors.jet
<empty list> <empty list>
CLASS_BODY CLASS_BODY
PsiElement(LBRACE)('{') PsiElement(LBRACE)('{')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n')
CONSTRUCTOR
PsiElement(this)('this')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
INITIALIZER_LIST
THIS_CALL
THIS_CONSTRUCTOR_REFERENCE
PsiElement(this)('this')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('a')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('b')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('c')
PsiElement(RPAR)(')')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
DELEGATOR_SUPER_CALL
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
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n\n ')
CONSTRUCTOR
PsiElement(this)('this')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('foo')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
INITIALIZER_LIST
THIS_CALL
THIS_CONSTRUCTOR_REFERENCE
PsiElement(this)('this')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('a')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('b')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('c')
PsiElement(RPAR)(')')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
DELEGATOR_SUPER_CALL
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
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n') PsiWhiteSpace('\n\n')
CLASS CLASS
@@ -16,7 +16,6 @@ class Foo {
foo bar(1) buzz<T>(1) zoo val c : Int = 0 foo bar(1) buzz<T>(1) zoo val c : Int = 0
foo bar(1) buzz<T>(1) zoo var v : Int = 0 foo bar(1) buzz<T>(1) zoo var v : Int = 0
foo bar(1) buzz<T>(1) zoo type T = Int foo bar(1) buzz<T>(1) zoo type T = Int
foo bar(1) buzz<T>(1) zoo this(x : Int) : this() {}
foo bar(1) buzz<T>(1) zoo {} foo bar(1) buzz<T>(1) zoo {}
} }
@@ -856,84 +856,6 @@ JetFile: ShortAnnotations.jet
USER_TYPE USER_TYPE
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int') PsiElement(IDENTIFIER)('Int')
PsiWhiteSpace('\n ')
CONSTRUCTOR
MODIFIER_LIST
ANNOTATION_ENTRY
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
PsiWhiteSpace(' ')
ANNOTATION_ENTRY
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('1')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
ANNOTATION_ENTRY
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('buzz')
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
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('1')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
ANNOTATION_ENTRY
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('zoo')
PsiWhiteSpace(' ')
PsiElement(this)('this')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('x')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
INITIALIZER_LIST
THIS_CALL
THIS_CONSTRUCTOR_REFERENCE
PsiElement(this)('this')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
ANONYMOUS_INITIALIZER ANONYMOUS_INITIALIZER
MODIFIER_LIST MODIFIER_LIST
@@ -15,7 +15,6 @@ class foo {
type foo = bar type foo = bar
this() : this(a, b, c), Foo<T>(bar)
} }
class Bar { class Bar {
@@ -49,7 +48,6 @@ class foo {
type foo = bar type foo = bar
this() : this(a, b, c), Foo<T>(bar)
} }
fun foo() fun foo()
@@ -60,12 +58,6 @@ class foo {
type foo = bar type foo = bar
this() : this(a, b, c), Foo<T>(bar)
this() : this(a, b, c), Foo<T>(bar) {
}
class object { class object {
} }
+2 -211
View File
@@ -74,58 +74,7 @@ JetFile: SimpleClassMembers.jet
USER_TYPE USER_TYPE
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar') PsiElement(IDENTIFIER)('bar')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
CONSTRUCTOR
PsiElement(this)('this')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
INITIALIZER_LIST
THIS_CALL
THIS_CONSTRUCTOR_REFERENCE
PsiElement(this)('this')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('a')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('b')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('c')
PsiElement(RPAR)(')')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
DELEGATOR_SUPER_CALL
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
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
CLASS CLASS
@@ -315,58 +264,7 @@ JetFile: SimpleClassMembers.jet
USER_TYPE USER_TYPE
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar') PsiElement(IDENTIFIER)('bar')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
CONSTRUCTOR
PsiElement(this)('this')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
INITIALIZER_LIST
THIS_CALL
THIS_CONSTRUCTOR_REFERENCE
PsiElement(this)('this')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('a')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('b')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('c')
PsiElement(RPAR)(')')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
DELEGATOR_SUPER_CALL
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
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
FUN FUN
@@ -401,113 +299,6 @@ JetFile: SimpleClassMembers.jet
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar') PsiElement(IDENTIFIER)('bar')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
CONSTRUCTOR
PsiElement(this)('this')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
INITIALIZER_LIST
THIS_CALL
THIS_CONSTRUCTOR_REFERENCE
PsiElement(this)('this')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('a')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('b')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('c')
PsiElement(RPAR)(')')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
DELEGATOR_SUPER_CALL
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
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n\n ')
CONSTRUCTOR
PsiElement(this)('this')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
INITIALIZER_LIST
THIS_CALL
THIS_CONSTRUCTOR_REFERENCE
PsiElement(this)('this')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('a')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('b')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('c')
PsiElement(RPAR)(')')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
DELEGATOR_SUPER_CALL
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
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ')
CLASS_OBJECT CLASS_OBJECT
PsiElement(class)('class') PsiElement(class)('class')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
@@ -14,14 +14,4 @@ class foo {
type foo = ; type foo = ;
this() : this(a, b, c), Foo<T(bar)
this() : this(a, b, c), Foo<T>(bar) {
}
this() : - {
}
} }
@@ -78,130 +78,5 @@ JetFile: SimpleClassMembers_ERR.jet
PsiErrorElement:Type expected PsiErrorElement:Type expected
<empty list> <empty list>
PsiElement(SEMICOLON)(';') PsiElement(SEMICOLON)(';')
PsiWhiteSpace('\n\n ')
CONSTRUCTOR
PsiElement(this)('this')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
INITIALIZER_LIST
THIS_CALL
THIS_CONSTRUCTOR_REFERENCE
PsiElement(this)('this')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('a')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('b')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('c')
PsiElement(RPAR)(')')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
DELEGATOR_SUPER_CALL
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
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n\n ')
CONSTRUCTOR
PsiElement(this)('this')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
INITIALIZER_LIST
THIS_CALL
THIS_CONSTRUCTOR_REFERENCE
PsiElement(this)('this')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('a')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('b')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('c')
PsiElement(RPAR)(')')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
DELEGATOR_SUPER_CALL
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
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ')
CONSTRUCTOR
PsiElement(this)('this')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
INITIALIZER_LIST
PsiErrorElement:Expecting constructor call (this(...)) or supertype initializer
PsiElement(MINUS)('-')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n') PsiWhiteSpace('\n\n')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
+62 -44
View File
@@ -152,15 +152,24 @@ JetFile: BinaryTree.jet
PsiWhiteSpace('\n\n') PsiWhiteSpace('\n\n')
PsiComment(EOL_COMMENT)('// override var size : Int { get; private set; }') PsiComment(EOL_COMMENT)('// override var size : Int { get; private set; }')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
CONSTRUCTOR PsiErrorElement:Expecting member declaration
PsiElement(this)('this') PsiElement(this)('this')
VALUE_PARAMETER_LIST PsiErrorElement:Expecting member declaration
PsiElement(LPAR)('(') PsiElement(LPAR)('(')
VALUE_PARAMETER MODIFIER_LIST
PsiElement(IDENTIFIER)('compare') ANNOTATION_ENTRY
PsiWhiteSpace(' ') CONSTRUCTOR_CALLEE
PsiElement(COLON)(':') TYPE_REFERENCE
PsiWhiteSpace(' ') USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('compare')
PsiWhiteSpace(' ')
PsiErrorElement:Expecting member declaration
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
MODIFIER_LIST
ANNOTATION_ENTRY
CONSTRUCTOR_CALLEE
TYPE_REFERENCE TYPE_REFERENCE
USER_TYPE USER_TYPE
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
@@ -173,8 +182,10 @@ JetFile: BinaryTree.jet
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('T') PsiElement(IDENTIFIER)('T')
PsiElement(GT)('>') PsiElement(GT)('>')
PsiElement(RPAR)(')') PsiErrorElement:Expecting member declaration
PsiWhiteSpace(' ') PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
ANONYMOUS_INITIALIZER
BLOCK BLOCK
PsiElement(LBRACE)('{') PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
@@ -202,37 +213,42 @@ JetFile: BinaryTree.jet
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
CONSTRUCTOR PsiErrorElement:Expecting member declaration
PsiElement(this)('this') PsiElement(this)('this')
VALUE_PARAMETER_LIST PsiErrorElement:Expecting member declaration
PsiElement(LPAR)('(') PsiElement(LPAR)('(')
PsiElement(RPAR)(')') PsiErrorElement:Expecting member declaration
PsiWhiteSpace(' ') PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiErrorElement:Expecting member declaration
PsiElement(COLON)(':') PsiElement(COLON)(':')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
INITIALIZER_LIST PsiErrorElement:Expecting member declaration
THIS_CALL PsiElement(this)('this')
THIS_CONSTRUCTOR_REFERENCE PsiErrorElement:Expecting member declaration
PsiElement(this)('this') PsiElement(LPAR)('(')
VALUE_ARGUMENT_LIST MODIFIER_LIST
PsiElement(LPAR)('(') ANNOTATION_ENTRY
VALUE_ARGUMENT CONSTRUCTOR_CALLEE
CALL_EXPRESSION TYPE_REFERENCE
REFERENCE_EXPRESSION USER_TYPE
PsiElement(IDENTIFIER)('naturalOrder') REFERENCE_EXPRESSION
TYPE_ARGUMENT_LIST PsiElement(IDENTIFIER)('naturalOrder')
PsiElement(LT)('<') TYPE_ARGUMENT_LIST
TYPE_PROJECTION PsiElement(LT)('<')
TYPE_REFERENCE TYPE_PROJECTION
USER_TYPE TYPE_REFERENCE
REFERENCE_EXPRESSION USER_TYPE
PsiElement(IDENTIFIER)('T') REFERENCE_EXPRESSION
PsiElement(GT)('>') PsiElement(IDENTIFIER)('T')
VALUE_ARGUMENT_LIST PsiElement(GT)('>')
PsiElement(LPAR)('(') VALUE_ARGUMENT_LIST
PsiElement(RPAR)(')') PsiElement(LPAR)('(')
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiErrorElement:Expecting member declaration
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
ANONYMOUS_INITIALIZER
BLOCK BLOCK
PsiElement(LBRACE)('{') PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
@@ -2007,12 +2023,14 @@ JetFile: BinaryTree.jet
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('TreeNode') PsiElement(IDENTIFIER)('TreeNode')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
CONSTRUCTOR PsiErrorElement:Expecting member declaration
PsiElement(this)('this') PsiElement(this)('this')
VALUE_PARAMETER_LIST PsiErrorElement:Expecting member declaration
PsiElement(LPAR)('(') PsiElement(LPAR)('(')
PsiElement(RPAR)(')') PsiErrorElement:Expecting member declaration
PsiWhiteSpace(' ') PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
ANONYMOUS_INITIALIZER
BLOCK BLOCK
PsiElement(LBRACE)('{') PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
@@ -50,7 +50,7 @@ class StrategyHashMap<K, V>(hashingStrategy : IHashingStrategy<K>) : IMap<K, V>
// where !(K : IHashable) // where !(K : IHashable)
this() : this(JavaObjectHashingStrategy<K>()) {} //this() : this(JavaObjectHashingStrategy<K>()) {}
//this() where (K : IHashable) : this(DefaultHashingStrategy<K>()) {} //this() where (K : IHashable) : this(DefaultHashingStrategy<K>()) {}
//... //...
@@ -937,40 +937,7 @@ JetFile: HashMap.jet
PsiWhiteSpace('\n\n\n ') PsiWhiteSpace('\n\n\n ')
PsiComment(EOL_COMMENT)('// where !(K : IHashable)') PsiComment(EOL_COMMENT)('// where !(K : IHashable)')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
CONSTRUCTOR PsiComment(EOL_COMMENT)('//this() : this(JavaObjectHashingStrategy<K>()) {}')
PsiElement(this)('this')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
INITIALIZER_LIST
THIS_CALL
THIS_CONSTRUCTOR_REFERENCE
PsiElement(this)('this')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('JavaObjectHashingStrategy')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('K')
PsiElement(GT)('>')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
PsiComment(EOL_COMMENT)('//this() where (K : IHashable) : this(DefaultHashingStrategy<K>()) {}') PsiComment(EOL_COMMENT)('//this() where (K : IHashable) : this(DefaultHashingStrategy<K>()) {}')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
@@ -17,9 +17,9 @@ class FileInput : IIterator<Byte>, JavaCloseableWrapper {
private var next : Int private var next : Int
private var nextUsed = false private var nextUsed = false
this(file : File) : JavaCloseableWrapper(stream) { // implicitly throws IOException //this(file : File) : JavaCloseableWrapper(stream) { // implicitly throws IOException
stream = FileInputStream(file) // throws IOException // stream = FileInputStream(file) // throws IOException
} //}
override fun next() { override fun next() {
if (!nextUsed) { if (!nextUsed) {
@@ -43,9 +43,9 @@ class FileInput : IIterator<Byte>, JavaCloseableWrapper {
class FileOutput : IAdder<Byte>, JavaCloseableWrapper { class FileOutput : IAdder<Byte>, JavaCloseableWrapper {
private val stream : OutputStream private val stream : OutputStream
this(file : File) : JavaCloseableWrapper(stream) { //this(file : File) : JavaCloseableWrapper(stream) {
stream = FileOutputStream(file) // stream = FileOutputStream(file)
} //}
override fun add(item : Byte) { override fun add(item : Byte) {
stream.write(item) stream.write(item)
+10 -108
View File
@@ -275,62 +275,11 @@ JetFile: IOSamples.jet
BOOLEAN_CONSTANT BOOLEAN_CONSTANT
PsiElement(false)('false') PsiElement(false)('false')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
CONSTRUCTOR PsiComment(EOL_COMMENT)('//this(file : File) : JavaCloseableWrapper(stream) { // implicitly throws IOException')
PsiElement(this)('this') PsiWhiteSpace('\n ')
VALUE_PARAMETER_LIST PsiComment(EOL_COMMENT)('// stream = FileInputStream(file) // throws IOException')
PsiElement(LPAR)('(') PsiWhiteSpace('\n ')
VALUE_PARAMETER PsiComment(EOL_COMMENT)('//}')
PsiElement(IDENTIFIER)('file')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('File')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
INITIALIZER_LIST
DELEGATOR_SUPER_CALL
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('JavaCloseableWrapper')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('stream')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace(' ')
PsiComment(EOL_COMMENT)('// implicitly throws IOException')
PsiWhiteSpace('\n ')
BINARY_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('stream')
PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('FileInputStream')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('file')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiComment(EOL_COMMENT)('// throws IOException')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
FUN FUN
MODIFIER_LIST MODIFIER_LIST
@@ -543,58 +492,11 @@ JetFile: IOSamples.jet
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('OutputStream') PsiElement(IDENTIFIER)('OutputStream')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
CONSTRUCTOR PsiComment(EOL_COMMENT)('//this(file : File) : JavaCloseableWrapper(stream) {')
PsiElement(this)('this') PsiWhiteSpace('\n ')
VALUE_PARAMETER_LIST PsiComment(EOL_COMMENT)('// stream = FileOutputStream(file)')
PsiElement(LPAR)('(') PsiWhiteSpace('\n ')
VALUE_PARAMETER PsiComment(EOL_COMMENT)('//}')
PsiElement(IDENTIFIER)('file')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('File')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
INITIALIZER_LIST
DELEGATOR_SUPER_CALL
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('JavaCloseableWrapper')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('stream')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
BINARY_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('stream')
PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('FileOutputStream')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('file')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
FUN FUN
MODIFIER_LIST MODIFIER_LIST
@@ -2,27 +2,27 @@ class BinaryHeap<T> : IPriorityQueue<T> {
private val data : IMutableList<T> private val data : IMutableList<T>
private val compare : Comparison<T> private val compare : Comparison<T>
this(data : IIterable<T>, compare : Comparison<T> = naturalOrder<T>) { // this(data : IIterable<T>, compare : Comparison<T> = naturalOrder<T>) {
this.compare = compare // this.compare = compare
this.data = ArrayList(data) // this.data = ArrayList(data)
// siftDown(* this.data.size / 2 .. 0) //// siftDown(* this.data.size / 2 .. 0)
//
// for (val i in data.size / 2 .. 0) {
// siftDown(i)
// }
//
// }
for (val i in data.size / 2 .. 0) { //this(compare : Comparison<T>) {
siftDown(i) // this.compare = compare
} // this.data = ArrayList()
//}
} //
//this() {
this(compare : Comparison<T>) { // this.data = ArrayList()
this.compare = compare // Assert(T is IComparable<T>)
this.data = ArrayList() // this.comparator = naturalOrder<T>
} //}
this() {
this.data = ArrayList()
Assert(T is IComparable<T>)
this.comparator = naturalOrder<T>
}
override fun extract() : T { override fun extract() : T {
if (this.isEmpty) if (this.isEmpty)
@@ -76,300 +76,46 @@ JetFile: BinaryHeap.jet
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('T') PsiElement(IDENTIFIER)('T')
PsiElement(GT)('>') PsiElement(GT)('>')
PsiWhiteSpace('\n\n')
PsiComment(EOL_COMMENT)('// this(data : IIterable<T>, compare : Comparison<T> = naturalOrder<T>) {')
PsiWhiteSpace('\n')
PsiComment(EOL_COMMENT)('// this.compare = compare')
PsiWhiteSpace('\n')
PsiComment(EOL_COMMENT)('// this.data = ArrayList(data)')
PsiWhiteSpace('\n')
PsiComment(EOL_COMMENT)('//// siftDown(* this.data.size / 2 .. 0)')
PsiWhiteSpace('\n')
PsiComment(EOL_COMMENT)('//')
PsiWhiteSpace('\n')
PsiComment(EOL_COMMENT)('// for (val i in data.size / 2 .. 0) {')
PsiWhiteSpace('\n')
PsiComment(EOL_COMMENT)('// siftDown(i)')
PsiWhiteSpace('\n')
PsiComment(EOL_COMMENT)('// }')
PsiWhiteSpace('\n')
PsiComment(EOL_COMMENT)('//')
PsiWhiteSpace('\n')
PsiComment(EOL_COMMENT)('// }')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
CONSTRUCTOR PsiComment(EOL_COMMENT)('//this(compare : Comparison<T>) {')
PsiElement(this)('this') PsiWhiteSpace('\n ')
VALUE_PARAMETER_LIST PsiComment(EOL_COMMENT)('// this.compare = compare')
PsiElement(LPAR)('(') PsiWhiteSpace('\n ')
VALUE_PARAMETER PsiComment(EOL_COMMENT)('// this.data = ArrayList()')
PsiElement(IDENTIFIER)('data') PsiWhiteSpace('\n ')
PsiWhiteSpace(' ') PsiComment(EOL_COMMENT)('//}')
PsiElement(COLON)(':') PsiWhiteSpace('\n ')
PsiWhiteSpace(' ') PsiComment(EOL_COMMENT)('//')
TYPE_REFERENCE PsiWhiteSpace('\n ')
USER_TYPE PsiComment(EOL_COMMENT)('//this() {')
REFERENCE_EXPRESSION PsiWhiteSpace('\n ')
PsiElement(IDENTIFIER)('IIterable') PsiComment(EOL_COMMENT)('// this.data = ArrayList()')
TYPE_ARGUMENT_LIST PsiWhiteSpace('\n ')
PsiElement(LT)('<') PsiComment(EOL_COMMENT)('// Assert(T is IComparable<T>)')
TYPE_PROJECTION PsiWhiteSpace('\n ')
TYPE_REFERENCE PsiComment(EOL_COMMENT)('// this.comparator = naturalOrder<T>')
USER_TYPE PsiWhiteSpace('\n ')
REFERENCE_EXPRESSION PsiComment(EOL_COMMENT)('//}')
PsiElement(IDENTIFIER)('T')
PsiElement(GT)('>')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('compare')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Comparison')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('T')
PsiElement(GT)('>')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('naturalOrder')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('T')
PsiElement(GT)('>')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
BINARY_EXPRESSION
DOT_QUALIFIED_EXPRESSION
THIS_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(this)('this')
PsiElement(DOT)('.')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('compare')
PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('compare')
PsiWhiteSpace('\n ')
BINARY_EXPRESSION
DOT_QUALIFIED_EXPRESSION
THIS_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(this)('this')
PsiElement(DOT)('.')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('data')
PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('ArrayList')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('data')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n')
PsiComment(EOL_COMMENT)('// siftDown(* this.data.size / 2 .. 0)')
PsiWhiteSpace('\n\n ')
FOR
PsiElement(for)('for')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
LOOP_PARAMETER
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('i')
PsiWhiteSpace(' ')
PsiElement(in)('in')
PsiWhiteSpace(' ')
LOOP_RANGE
BINARY_EXPRESSION
BINARY_EXPRESSION
DOT_QUALIFIED_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('data')
PsiElement(DOT)('.')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('size')
PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(DIV)('/')
PsiWhiteSpace(' ')
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('2')
PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(RANGE)('..')
PsiWhiteSpace(' ')
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('0')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BODY
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('siftDown')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('i')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ')
CONSTRUCTOR
PsiElement(this)('this')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('compare')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Comparison')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('T')
PsiElement(GT)('>')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
BINARY_EXPRESSION
DOT_QUALIFIED_EXPRESSION
THIS_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(this)('this')
PsiElement(DOT)('.')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('compare')
PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('compare')
PsiWhiteSpace('\n ')
BINARY_EXPRESSION
DOT_QUALIFIED_EXPRESSION
THIS_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(this)('this')
PsiElement(DOT)('.')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('data')
PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('ArrayList')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ')
CONSTRUCTOR
PsiElement(this)('this')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
BINARY_EXPRESSION
DOT_QUALIFIED_EXPRESSION
THIS_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(this)('this')
PsiElement(DOT)('.')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('data')
PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('ArrayList')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Assert')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
BINARY_WITH_PATTERN
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('T')
PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(is)('is')
PsiWhiteSpace(' ')
TYPE_PATTERN
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('IComparable')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('T')
PsiElement(GT)('>')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
BINARY_EXPRESSION
DOT_QUALIFIED_EXPRESSION
THIS_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(this)('this')
PsiElement(DOT)('.')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('comparator')
PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('naturalOrder')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('T')
PsiElement(GT)('>')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
FUN FUN
MODIFIER_LIST MODIFIER_LIST
@@ -121,4 +121,4 @@ JetFile: ComplexScript.ktscript
PsiElement(IDENTIFIER)('arg') PsiElement(IDENTIFIER)('arg')
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace('\n') PsiWhiteSpace('\n')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
+1 -1
View File
@@ -34,4 +34,4 @@ JetFile: Import.ktscript
PsiElement(EQ)('=') PsiElement(EQ)('=')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
INTEGER_CONSTANT INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('1') PsiElement(INTEGER_LITERAL)('1')
+1 -1
View File
@@ -11,4 +11,4 @@ JetFile: Shebang.ktscript
VALUE_ARGUMENT VALUE_ARGUMENT
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('args') PsiElement(IDENTIFIER)('args')
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
@@ -32,4 +32,4 @@ JetFile: ShebangIncorrect.ktscript
OPERATION_REFERENCE OPERATION_REFERENCE
PsiElement(DIV)('/') PsiElement(DIV)('/')
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('hi') PsiElement(IDENTIFIER)('hi')
@@ -9,4 +9,4 @@ JetFile: SimpleScript.ktscript
VALUE_ARGUMENT VALUE_ARGUMENT
INTEGER_CONSTANT INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('1') PsiElement(INTEGER_LITERAL)('1')
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
@@ -1,12 +0,0 @@
class Z(a : Int) {
~c1~this() : `c2`this(1, true) {}
~c2~this(x : Int, y : Boolean) : `c1`this() {}
}
~Z1.c()~class Z1() : Z {
this(x : Int, y : Boolean) : `Z1.c()`this() {}
}
class Foo
@@ -1,5 +1,4 @@
class A(~a~val a : Int) { class A(~a~val a : Int) {
this() {`$a`a}
~b~val b = `$a`a ~b~val b = `$a`a
~f~fun f() = `$a`a ~f~fun f() = `$a`a
} }
@@ -11,19 +10,11 @@ fun test() {
a.`f`f()`:kotlin::Int` a.`f`f()`:kotlin::Int`
} }
package Jet65 { class Foo(~bar~var bar : Int, ~barr~barr : Int, ~barrr~val barrr : Int) {
{
class Foo(~bar~var bar : Int, ~barr~barr : Int, ~barrr~val barrr : Int) { `$bar`bar = 1
{ `barr`barr = 1
`$bar`bar = 1 `$barrr`barrr = 1
`barr`barr = 1
`$barrr`barrr = 1
}
this(~s.bar~val bar : Int) : this(1, 1, 1) {
`s.bar`bar = 1
this.`$bar`bar
}
} }
} }
@@ -108,7 +108,7 @@ public class JetControlFlowTest extends JetLiteFixture {
JetElement correspondingElement = pseudocode.getCorrespondingElement(); JetElement correspondingElement = pseudocode.getCorrespondingElement();
String label = ""; String label = "";
assert (correspondingElement instanceof JetNamedDeclaration || correspondingElement instanceof JetSecondaryConstructor || correspondingElement instanceof JetPropertyAccessor) : assert (correspondingElement instanceof JetNamedDeclaration || correspondingElement instanceof JetPropertyAccessor) :
"Unexpected element class is pseudocode: " + correspondingElement.getClass(); "Unexpected element class is pseudocode: " + correspondingElement.getClass();
if (correspondingElement instanceof JetFunctionLiteral) { if (correspondingElement instanceof JetFunctionLiteral) {
label = "anonymous_" + i++; label = "anonymous_" + i++;
@@ -121,9 +121,6 @@ public class JetControlFlowTest extends JetLiteFixture {
String propertyName = ((JetProperty) correspondingElement.getParent()).getName(); String propertyName = ((JetProperty) correspondingElement.getParent()).getName();
label = (((JetPropertyAccessor) correspondingElement).isGetter() ? "get" : "set") + "_" + propertyName; label = (((JetPropertyAccessor) correspondingElement).isGetter() ? "get" : "set") + "_" + propertyName;
} }
else if (correspondingElement instanceof JetSecondaryConstructor) {
label = "this";
}
instructionDump.append("== ").append(label).append(" ==\n"); instructionDump.append("== ").append(label).append(" ==\n");
@@ -15,12 +15,15 @@
*/ */
package org.jetbrains.jet.checkers; package org.jetbrains.jet.checkers;
import junit.framework.Assert;
import junit.framework.Test; import junit.framework.Test;
import junit.framework.TestSuite; import junit.framework.TestSuite;
import java.io.File;
import org.jetbrains.jet.JetTestUtils; import org.jetbrains.jet.JetTestUtils;
import org.jetbrains.jet.test.TestMetadata; import org.jetbrains.jet.test.TestMetadata;
import java.io.File; import org.jetbrains.jet.checkers.AbstractDiagnosticsTestWithEagerResolve;
/** This class is generated by {@link org.jetbrains.jet.checkers.AbstractDiagnosticsTestWithEagerResolve}. DO NOT MODIFY MANUALLY */ /** This class is generated by {@link org.jetbrains.jet.checkers.AbstractDiagnosticsTestWithEagerResolve}. DO NOT MODIFY MANUALLY */
public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEagerResolve { public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEagerResolve {
@@ -2229,21 +2232,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
doTest("compiler/testData/diagnostics/tests/regressions/OverrideResolution.kt"); doTest("compiler/testData/diagnostics/tests/regressions/OverrideResolution.kt");
} }
@TestMetadata("ScopeForSecondaryConstructors.kt")
public void testScopeForSecondaryConstructors() throws Exception {
doTest("compiler/testData/diagnostics/tests/regressions/ScopeForSecondaryConstructors.kt");
}
@TestMetadata("SpecififcityByReceiver.kt") @TestMetadata("SpecififcityByReceiver.kt")
public void testSpecififcityByReceiver() throws Exception { public void testSpecififcityByReceiver() throws Exception {
doTest("compiler/testData/diagnostics/tests/regressions/SpecififcityByReceiver.kt"); doTest("compiler/testData/diagnostics/tests/regressions/SpecififcityByReceiver.kt");
} }
@TestMetadata("ThisConstructorInGenericClass.kt")
public void testThisConstructorInGenericClass() throws Exception {
doTest("compiler/testData/diagnostics/tests/regressions/ThisConstructorInGenericClass.kt");
}
@TestMetadata("TypeMismatchOnUnaryOperations.kt") @TestMetadata("TypeMismatchOnUnaryOperations.kt")
public void testTypeMismatchOnUnaryOperations() throws Exception { public void testTypeMismatchOnUnaryOperations() throws Exception {
doTest("compiler/testData/diagnostics/tests/regressions/TypeMismatchOnUnaryOperations.kt"); doTest("compiler/testData/diagnostics/tests/regressions/TypeMismatchOnUnaryOperations.kt");
@@ -137,11 +137,6 @@ public class ClassGenTest extends CodegenTestCase {
blackBoxFile("classes/outerThis.jet"); blackBoxFile("classes/outerThis.jet");
} }
public void testSecondaryConstructors() throws Exception {
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
blackBoxFile("classes/secondaryConstructors.jet");
}
public void testExceptionConstructor() throws Exception { public void testExceptionConstructor() throws Exception {
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY); createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
blackBoxFile("classes/exceptionConstructor.jet"); blackBoxFile("classes/exceptionConstructor.jet");
@@ -332,7 +327,7 @@ public class ClassGenTest extends CodegenTestCase {
} }
public void testKt1120 () throws Exception { public void testKt1120 () throws Exception {
createEnvironmentWithFullJdk(); //createEnvironmentWithFullJdk();
// blackBoxFile("regressions/kt1120.kt"); // blackBoxFile("regressions/kt1120.kt");
} }
@@ -767,11 +767,6 @@ public class JetTypeCheckerTest extends JetLiteFixture {
constructors, constructors,
null null
); );
for (JetSecondaryConstructor constructor : classElement.getSecondaryConstructors()) {
ConstructorDescriptorImpl functionDescriptor = descriptorResolver.resolveSecondaryConstructorDescriptor(memberDeclarations, classDescriptor, constructor, JetTestUtils.DUMMY_TRACE);
functionDescriptor.setReturnType(classDescriptor.getDefaultType());
constructors.add(functionDescriptor);
}
ConstructorDescriptorImpl primaryConstructorDescriptor = descriptorResolver.resolvePrimaryConstructorDescriptor(scope, classDescriptor, classElement, JetTestUtils.DUMMY_TRACE); ConstructorDescriptorImpl primaryConstructorDescriptor = descriptorResolver.resolvePrimaryConstructorDescriptor(scope, classDescriptor, classElement, JetTestUtils.DUMMY_TRACE);
if (primaryConstructorDescriptor != null) { if (primaryConstructorDescriptor != null) {
primaryConstructorDescriptor.setReturnType(classDescriptor.getDefaultType()); primaryConstructorDescriptor.setReturnType(classDescriptor.getDefaultType());
-11
View File
@@ -4,12 +4,6 @@ h3. Class members
/* /*
class Example(a : Foo, i : Int) : Bar(i), Some { class Example(a : Foo, i : Int) : Bar(i), Some {
// constrtuctors:
public this(a : Foo) : this(a, 0)
public this(a : Foo) : Bar(5), Some(a) {
// code
}
// functions // functions
abstract fun foo(a : Bar) abstract fun foo(a : Bar)
@@ -56,11 +50,6 @@ classObject
bq. See [Class objects|Classes and Inheritance#Class objects] bq. See [Class objects|Classes and Inheritance#Class objects]
*/ */
[undocumented]
constructor
: modifiers "this" valueParameters (":" initializer{","}) block?
;
valueParameters valueParameters
: "(" functionParameter{","}? ")" // default values : "(" functionParameter{","}? ")" // default values
; ;
@@ -21,9 +21,11 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.ui.popup.JBPopupAdapter; import com.intellij.openapi.ui.popup.JBPopupAdapter;
import com.intellij.openapi.ui.popup.JBPopupFactory; import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.ui.popup.LightweightWindowEvent; import com.intellij.openapi.ui.popup.LightweightWindowEvent;
import com.intellij.psi.*; import com.intellij.psi.PsiComment;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiWhiteSpace;
import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtilBase;
import com.intellij.psi.util.PsiUtilCore; import com.intellij.psi.util.PsiUtilCore;
import com.intellij.ui.components.JBList; import com.intellij.ui.components.JBList;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -87,7 +89,7 @@ public class JetRefactoringUtil {
ArrayList<JetExpression> expressions = new ArrayList<JetExpression>(); ArrayList<JetExpression> expressions = new ArrayList<JetExpression>();
while (element != null && !(element instanceof JetBlockExpression && !(element.getParent() instanceof JetFunctionLiteral)) && while (element != null && !(element instanceof JetBlockExpression && !(element.getParent() instanceof JetFunctionLiteral)) &&
!(element instanceof JetNamedFunction) !(element instanceof JetNamedFunction)
&& !(element instanceof JetClassBody) && !(element instanceof JetSecondaryConstructor)) { && !(element instanceof JetClassBody)) {
if (element instanceof JetExpression && !(element instanceof JetStatementExpression)) { if (element instanceof JetExpression && !(element instanceof JetStatementExpression)) {
boolean addExpression = true; boolean addExpression = true;
if (element.getParent() instanceof JetQualifiedExpression) { if (element.getParent() instanceof JetQualifiedExpression) {
@@ -292,12 +292,6 @@ public class JetIntroduceVariableHandler extends JetIntroduceHandlerBase {
oldElement = body; oldElement = body;
} }
} }
else if (commonContainer instanceof JetSecondaryConstructor) {
JetExpression body = ((JetSecondaryConstructor)commonContainer).getBodyExpression();
if (body != null) {
oldElement = body;
}
}
else if (commonContainer instanceof JetContainerNode) { else if (commonContainer instanceof JetContainerNode) {
JetContainerNode container = (JetContainerNode)commonContainer; JetContainerNode container = (JetContainerNode)commonContainer;
PsiElement[] children = container.getChildren(); PsiElement[] children = container.getChildren();
@@ -513,12 +507,6 @@ public class JetIntroduceVariableHandler extends JetIntroduceHandlerBase {
return parent; return parent;
} }
} }
else if (parent instanceof JetSecondaryConstructor) {
JetSecondaryConstructor secondaryConstructor = (JetSecondaryConstructor)parent;
if (secondaryConstructor.getBodyExpression() == place) {
return parent;
}
}
place = parent; place = parent;
} }
return null; return null;
@@ -570,14 +558,6 @@ public class JetIntroduceVariableHandler extends JetIntroduceHandlerBase {
} }
} }
} }
else if (parent instanceof JetSecondaryConstructor) {
JetSecondaryConstructor secondaryConstructor = (JetSecondaryConstructor)parent;
if (secondaryConstructor.getBodyExpression() == place) {
if (!(place instanceof JetBlockExpression)) {
result = parent;
}
}
}
place = parent; place = parent;
} }
return null; return null;