diff --git a/idea/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java b/idea/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java index b0cbbb879f0..7c2a7accf53 100644 --- a/idea/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java +++ b/idea/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java @@ -723,7 +723,7 @@ public class JetExpressionParsing extends AbstractJetParsing { if (atSet(WHEN_CONDITION_RECOVERY_SET)) { error("Expecting an element"); } else { - parseExpression(); + parseExpressionPreferringBlocks(); } } else if (!atSet(WHEN_CONDITION_RECOVERY_SET)) { errorAndAdvance("Expecting '=>'"); @@ -750,7 +750,7 @@ public class JetExpressionParsing extends AbstractJetParsing { if (atSet(WHEN_CONDITION_RECOVERY_SET)) { error("Expecting an element"); } else { - parseExpression(); + parseExpressionPreferringBlocks(); } // SEMI is consumed in parseWhenEntry } @@ -1032,6 +1032,10 @@ public class JetExpressionParsing extends AbstractJetParsing { * ; */ private void parseFunctionLiteral() { + parseFunctionLiteral(false); + } + + private void parseFunctionLiteral(boolean preferBlock) { assert _at(LBRACE); PsiBuilder.Marker literalExpression = mark(); @@ -1048,7 +1052,8 @@ public class JetExpressionParsing extends AbstractJetParsing { } }); - if (doubleArrowPos >= 0) { + boolean doubleArrowPresent = doubleArrowPos >= 0; + if (doubleArrowPresent) { boolean dontExpectParameters = false; int lastDot = matchTokenStreamPredicate(new LastBefore(new At(DOT), new AtOffset(doubleArrowPos))); @@ -1116,7 +1121,17 @@ public class JetExpressionParsing extends AbstractJetParsing { expectNoAdvance(DOUBLE_ARROW, "Expecting '=>'"); } + else { + if (preferBlock) { + literal.drop(); + parseStatements(); + expect(RBRACE, "Expecting '}'"); + literalExpression.done(BLOCK); + myBuilder.restoreNewlinesState(); + return; + } + } PsiBuilder.Marker body = mark(); parseStatements(); body.done(BLOCK); @@ -1322,13 +1337,34 @@ public class JetExpressionParsing extends AbstractJetParsing { loop.done(FOR); } + /** + * If it has no =>, it's a block, otherwise a function literal + */ + private void parseExpressionPreferringBlocks() { + if (at(LBRACE)) { + parseFunctionLiteral(true); + } + else if (atSet(LABELS) && lookahead(1) == LBRACE ) { + PsiBuilder.Marker mark = mark(); + + parseOperationReference(); + + parseFunctionLiteral(true); + + mark.done(PREFIX_EXPRESSION); + } + else { + parseExpression(); + } + } + /* * element */ private void parseControlStructureBody() { PsiBuilder.Marker body = mark(); if (!at(SEMICOLON)) { - parseExpression(); + parseExpressionPreferringBlocks(); } body.done(BODY); } @@ -1400,7 +1436,7 @@ public class JetExpressionParsing extends AbstractJetParsing { PsiBuilder.Marker thenBranch = mark(); if (!at(ELSE_KEYWORD) && !at(SEMICOLON)) { - parseExpression(); + parseExpressionPreferringBlocks(); } if (at(SEMICOLON) && lookahead(1) == ELSE_KEYWORD) { advance(); // SEMICOLON @@ -1412,7 +1448,7 @@ public class JetExpressionParsing extends AbstractJetParsing { PsiBuilder.Marker elseBranch = mark(); if (!at(SEMICOLON)) { - parseExpression(); + parseExpressionPreferringBlocks(); } elseBranch.done(ELSE); } diff --git a/idea/src/org/jetbrains/jet/lang/resolve/ClassDescriptorResolver.java b/idea/src/org/jetbrains/jet/lang/resolve/ClassDescriptorResolver.java index b0fb1a535d1..509c10ade39 100644 --- a/idea/src/org/jetbrains/jet/lang/resolve/ClassDescriptorResolver.java +++ b/idea/src/org/jetbrains/jet/lang/resolve/ClassDescriptorResolver.java @@ -540,7 +540,7 @@ public class ClassDescriptorResolver { @Override protected JetType compute() { JetFlowInformationProvider flowInformationProvider = computeFlowData(property, initializer); - return semanticServices.getTypeInferrerServices(trace, flowInformationProvider).safeGetType(scope, initializer, false, JetTypeInferrer.NO_EXPECTED_TYPE); + return semanticServices.getTypeInferrerServices(trace, flowInformationProvider).safeGetType(scope, initializer, JetTypeInferrer.NO_EXPECTED_TYPE); } }; if (allowDeferred) { diff --git a/idea/src/org/jetbrains/jet/lang/resolve/TopDownAnalyzer.java b/idea/src/org/jetbrains/jet/lang/resolve/TopDownAnalyzer.java index bd84dca3f44..57006c0d4e9 100644 --- a/idea/src/org/jetbrains/jet/lang/resolve/TopDownAnalyzer.java +++ b/idea/src/org/jetbrains/jet/lang/resolve/TopDownAnalyzer.java @@ -274,7 +274,7 @@ public class TopDownAnalyzer { JetExpression importedReference = importDirective.getImportedReference(); if (importedReference != null) { JetTypeInferrer.Services typeInferrerServices = semanticServices.getTypeInferrerServices(trace, JetFlowInformationProvider.THROW_EXCEPTION); - JetType type = typeInferrerServices.getTypeWithNamespaces(namespaceScope, importedReference, false); + JetType type = typeInferrerServices.getTypeWithNamespaces(namespaceScope, importedReference); if (type != null) { namespaceScope.importScope(type.getMemberScope()); } @@ -287,7 +287,7 @@ public class TopDownAnalyzer { JetExpression importedReference = importDirective.getImportedReference(); if (importedReference instanceof JetDotQualifiedExpression) { JetDotQualifiedExpression reference = (JetDotQualifiedExpression) importedReference; - JetType type = semanticServices.getTypeInferrerServices(trace, JetFlowInformationProvider.THROW_EXCEPTION).getTypeWithNamespaces(namespaceScope, reference.getReceiverExpression(), false); + JetType type = semanticServices.getTypeInferrerServices(trace, JetFlowInformationProvider.THROW_EXCEPTION).getTypeWithNamespaces(namespaceScope, reference.getReceiverExpression()); JetExpression selectorExpression = reference.getSelectorExpression(); if (selectorExpression != null) { referenceExpression = (JetSimpleNameExpression) selectorExpression; @@ -567,7 +567,7 @@ public class TopDownAnalyzer { JetExpression delegateExpression = specifier.getDelegateExpression(); if (delegateExpression != null) { JetScope scope = scopeForConstructor == null ? descriptor.getScopeForMemberResolution() : scopeForConstructor; - JetType type = typeInferrer.getType(scope, delegateExpression, false, NO_EXPECTED_TYPE); + JetType type = typeInferrer.getType(scope, delegateExpression, NO_EXPECTED_TYPE); 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); @@ -643,7 +643,7 @@ public class TopDownAnalyzer { final JetScope scopeForConstructor = getInnerScopeForConstructor(primaryConstructor, classDescriptor.getScopeForMemberResolution(), true); JetTypeInferrer.Services typeInferrer = semanticServices.getTypeInferrerServices(traceForConstructors, JetFlowInformationProvider.NONE); // TODO : flow for (JetClassInitializer anonymousInitializer : anonymousInitializers) { - typeInferrer.getType(scopeForConstructor, anonymousInitializer.getBody(), true, NO_EXPECTED_TYPE); + typeInferrer.getType(scopeForConstructor, anonymousInitializer.getBody(), NO_EXPECTED_TYPE); } } else { @@ -859,7 +859,7 @@ public class TopDownAnalyzer { private void resolvePropertyInitializer(JetProperty property, PropertyDescriptor propertyDescriptor, JetExpression initializer, JetScope scope) { JetFlowInformationProvider flowInformationProvider = classDescriptorResolver.computeFlowData(property, initializer); // TODO : flow JET-15 JetTypeInferrer.Services typeInferrer = semanticServices.getTypeInferrerServices(traceForConstructors, flowInformationProvider); - JetType type = typeInferrer.getType(getPropertyDeclarationInnerScope(scope, propertyDescriptor), initializer, false, NO_EXPECTED_TYPE); + JetType type = typeInferrer.getType(getPropertyDeclarationInnerScope(scope, propertyDescriptor), initializer, NO_EXPECTED_TYPE); JetType expectedType; PropertySetterDescriptor setter = propertyDescriptor.getSetter(); diff --git a/idea/src/org/jetbrains/jet/lang/types/CallResolver.java b/idea/src/org/jetbrains/jet/lang/types/CallResolver.java index d6a08b64bb1..e7d130ab149 100644 --- a/idea/src/org/jetbrains/jet/lang/types/CallResolver.java +++ b/idea/src/org/jetbrains/jet/lang/types/CallResolver.java @@ -504,7 +504,7 @@ public class CallResolver { JetExpression expression = valueArgument.getArgumentExpression(); // TODO : more attempts, with different expected types - JetType type = temporaryServices.getType(scope, expression, false, NO_EXPECTED_TYPE); + JetType type = temporaryServices.getType(scope, expression, NO_EXPECTED_TYPE); if (type != null) { constraintSystem.addSubtypingConstraint(type, valueParameterDescriptor.getOutType()); } @@ -599,12 +599,12 @@ public class CallResolver { for (ValueArgument valueArgument : task.getValueArguments()) { JetExpression argumentExpression = valueArgument.getArgumentExpression(); if (argumentExpression != null) { - typeInferrer.getServices(trace).getType(scope, argumentExpression, false, NO_EXPECTED_TYPE); + typeInferrer.getServices(trace).getType(scope, argumentExpression, NO_EXPECTED_TYPE); } } for (JetExpression expression : task.getFunctionLiteralArguments()) { - typeInferrer.getServices(trace).getType(scope, expression, false, NO_EXPECTED_TYPE); + typeInferrer.getServices(trace).getType(scope, expression, NO_EXPECTED_TYPE); } for (JetTypeProjection typeProjection : task.getTypeArguments()) { @@ -718,7 +718,7 @@ public class CallResolver { JetType parameterType = substitutedParameter.getOutType(); JetExpression argumentExpression = valueArgument.getArgumentExpression(); if (argumentExpression != null) { - JetType type = temporaryServices.getType(scope, argumentExpression, false, parameterType); + JetType type = temporaryServices.getType(scope, argumentExpression, parameterType); if (type == null) { dirty.setValue(true); } diff --git a/idea/src/org/jetbrains/jet/lang/types/JetTypeInferrer.java b/idea/src/org/jetbrains/jet/lang/types/JetTypeInferrer.java index 1288e0e91b4..8bec7d0d118 100644 --- a/idea/src/org/jetbrains/jet/lang/types/JetTypeInferrer.java +++ b/idea/src/org/jetbrains/jet/lang/types/JetTypeInferrer.java @@ -177,8 +177,8 @@ public class JetTypeInferrer { } @NotNull - public JetType safeGetType(@NotNull final JetScope scope, @NotNull JetExpression expression, boolean preferBlock, @NotNull JetType expectedType) { - JetType type = getType(scope, expression, preferBlock, expectedType); + public JetType safeGetType(@NotNull final JetScope scope, @NotNull JetExpression expression, @NotNull JetType expectedType) { + JetType type = getType(scope, expression, expectedType); if (type != null) { return type; } @@ -186,12 +186,12 @@ 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, preferBlock, DataFlowInfo.getEmpty(), expectedType, FORBIDDEN)); + public JetType getType(@NotNull final JetScope scope, @NotNull JetExpression expression, @NotNull JetType expectedType) { + return typeInferrerVisitor.getType(expression, newContext(trace, scope, DataFlowInfo.getEmpty(), expectedType, FORBIDDEN)); } - public JetType getTypeWithNamespaces(@NotNull final JetScope scope, @NotNull JetExpression expression, boolean preferBlock) { - return typeInferrerVisitorWithNamespaces.getType(expression, new TypeInferenceContext(trace, scope, preferBlock, DataFlowInfo.getEmpty(), NO_EXPECTED_TYPE, NO_EXPECTED_TYPE)); + public JetType getTypeWithNamespaces(@NotNull final JetScope scope, @NotNull JetExpression expression) { + return typeInferrerVisitorWithNamespaces.getType(expression, newContext(trace, scope, DataFlowInfo.getEmpty(), NO_EXPECTED_TYPE, NO_EXPECTED_TYPE)); } public CallResolver getCallResolver() { @@ -275,8 +275,8 @@ public class JetTypeInferrer { final boolean blockBody = function.hasBlockBody(); final TypeInferenceContext context = blockBody - ? new TypeInferenceContext(trace, functionInnerScope, function.hasBlockBody(), dataFlowInfo, NO_EXPECTED_TYPE, expectedReturnType) - : new TypeInferenceContext(trace, functionInnerScope, function.hasBlockBody(), dataFlowInfo, expectedReturnType, FORBIDDEN); + ? newContext(trace, functionInnerScope, dataFlowInfo, NO_EXPECTED_TYPE, expectedReturnType) + : newContext(trace, functionInnerScope, dataFlowInfo, expectedReturnType, FORBIDDEN); if (function instanceof JetFunctionLiteralExpression) { JetFunctionLiteralExpression functionLiteralExpression = (JetFunctionLiteralExpression) function; @@ -363,7 +363,7 @@ public class JetTypeInferrer { JetExpression bodyExpression = function.getBodyExpression(); assert bodyExpression != null; JetScope functionInnerScope = FunctionDescriptorUtil.getFunctionInnerScope(outerScope, functionDescriptor, trace); - typeInferrerVisitor.getType(bodyExpression, new TypeInferenceContext(trace, functionInnerScope, function.hasBlockBody(), DataFlowInfo.getEmpty(), NO_EXPECTED_TYPE, FORBIDDEN)); + typeInferrerVisitor.getType(bodyExpression, newContext(trace, functionInnerScope, DataFlowInfo.getEmpty(), NO_EXPECTED_TYPE, FORBIDDEN)); Collection returnedExpressions = new ArrayList(); Collection elementsReturningUnit = new ArrayList(); flowInformationProvider.collectReturnedInformation(function.asElement(), returnedExpressions, elementsReturningUnit); @@ -387,7 +387,7 @@ public class JetTypeInferrer { } TypeInferrerVisitorWithWritableScope blockLevelVisitor = newTypeInferrerVisitorWithWritableScope(scope); - TypeInferenceContext newContext = new TypeInferenceContext(trace, scope, true, context.dataFlowInfo, NO_EXPECTED_TYPE, context.expectedReturnType); + TypeInferenceContext newContext = newContext(trace, scope, context.dataFlowInfo, NO_EXPECTED_TYPE, context.expectedReturnType); JetType result = null; for (Iterator iterator = block.iterator(); iterator.hasNext(); ) { @@ -401,13 +401,13 @@ public class JetTypeInferrer { TemporaryBindingTrace temporaryTraceExpectingUnit = TemporaryBindingTrace.create(trace); final boolean[] mismatch = new boolean[1]; BindingTraceAdapter errorInterceptingTrace = makeTraceInterceptingTypeMismatch(temporaryTraceExpectingUnit, statementExpression, mismatch); - newContext = new TypeInferenceContext(errorInterceptingTrace, scope, true, newContext.dataFlowInfo, context.expectedType, context.expectedReturnType); + newContext = newContext(errorInterceptingTrace, scope, newContext.dataFlowInfo, context.expectedType, context.expectedReturnType); result = blockLevelVisitor.getType(statementExpression, newContext); if (mismatch[0]) { TemporaryBindingTrace temporaryTraceNoExpectedType = TemporaryBindingTrace.create(trace); mismatch[0] = false; BindingTraceAdapter interceptingTrace = makeTraceInterceptingTypeMismatch(temporaryTraceNoExpectedType, statementExpression, mismatch); - newContext = new TypeInferenceContext(interceptingTrace, scope, true, newContext.dataFlowInfo, NO_EXPECTED_TYPE, context.expectedReturnType); + newContext = newContext(interceptingTrace, scope, newContext.dataFlowInfo, NO_EXPECTED_TYPE, context.expectedReturnType); result = blockLevelVisitor.getType(statementExpression, newContext); if (mismatch[0]) { temporaryTraceExpectingUnit.commit(); @@ -419,7 +419,7 @@ public class JetTypeInferrer { } else { - newContext = new TypeInferenceContext(trace, scope, true, newContext.dataFlowInfo, context.expectedType, context.expectedReturnType); + newContext = newContext(trace, scope, newContext.dataFlowInfo, context.expectedType, context.expectedReturnType); result = blockLevelVisitor.getType(statementExpression, newContext); } } @@ -432,14 +432,14 @@ public class JetTypeInferrer { newDataFlowInfo = context.dataFlowInfo; } if (newDataFlowInfo != context.dataFlowInfo) { - newContext = new TypeInferenceContext(trace, scope, true, newDataFlowInfo, NO_EXPECTED_TYPE, context.expectedReturnType); + newContext = newContext(trace, scope, newDataFlowInfo, NO_EXPECTED_TYPE, context.expectedReturnType); } blockLevelVisitor.resetResult(); // TODO : maybe it's better to recreate the visitors with the same scope? } return result; } - private BindingTraceAdapter makeTraceInterceptingTypeMismatch(final BindingTrace trace, JetExpression expression, final boolean[] mismatchFound) { + private BindingTraceAdapter makeTraceInterceptingTypeMismatch(final BindingTrace trace, final JetExpression expressionToWatch, final boolean[] mismatchFound) { return new BindingTraceAdapter(trace) { @NotNull @Override @@ -447,7 +447,7 @@ public class JetTypeInferrer { return new CompositeErrorHandler(super.getErrorHandler(), new ErrorHandler() { @Override public void typeMismatch(@NotNull JetExpression expression, @NotNull JetType expectedType, @NotNull JetType actualType) { - if (expression == expression) { + if (expression == expressionToWatch) { mismatchFound[0] = true; } } @@ -555,24 +555,47 @@ public class JetTypeInferrer { COERCION_TO_UNIT } + @NotNull + private TypeInferenceContext newContext( + @NotNull BindingTrace trace, + @NotNull JetScope scope, + @NotNull DataFlowInfo dataFlowInfo, + @NotNull JetType expectedType, + @NotNull JetType expectedReturnType) { + return newContextForCallResolution(trace, scope, scope, dataFlowInfo, expectedType, expectedReturnType); + } + + @NotNull + private TypeInferenceContext newContextForCallResolution( + @NotNull BindingTrace trace, + @NotNull JetScope scope, + @NotNull JetScope scopeForTopLevelCall, + @NotNull DataFlowInfo dataFlowInfo, + @NotNull JetType expectedType, + @NotNull JetType expectedReturnType) { + return new TypeInferenceContext(trace, scope, scopeForTopLevelCall, dataFlowInfo, expectedType, expectedReturnType); + } + private class TypeInferenceContext { + public final BindingTrace trace; public final TypeResolver typeResolver; public final ClassDescriptorResolver classDescriptorResolver; public final JetScope scope; + public final JetScope scopeForTopLevelCall; public final Services services; - public final boolean preferBlock; public final DataFlowInfo dataFlowInfo; public final JetType expectedType; public final JetType expectedReturnType; + @Deprecated // Only factory methods private TypeInferenceContext( @NotNull BindingTrace trace, @NotNull JetScope scope, - boolean preferBlock, + @NotNull JetScope scopeForTopLevelCall, @NotNull DataFlowInfo dataFlowInfo, @NotNull JetType expectedType, @NotNull JetType expectedReturnType) { @@ -580,32 +603,44 @@ public class JetTypeInferrer { this.typeResolver = new TypeResolver(semanticServices, trace, true); this.classDescriptorResolver = semanticServices.getClassDescriptorResolver(trace); this.scope = scope; + this.scopeForTopLevelCall = scopeForTopLevelCall; this.services = getServices(trace); - this.preferBlock = preferBlock; this.dataFlowInfo = dataFlowInfo; this.expectedType = expectedType; this.expectedReturnType = expectedReturnType; } public TypeInferenceContext replaceDataFlowInfo(DataFlowInfo newDataFlowInfo) { - return new TypeInferenceContext(trace, scope, preferBlock, newDataFlowInfo, expectedType, expectedReturnType); + return newContextForCallResolution(trace, scope, scopeForTopLevelCall, 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, preferBlock, dataFlowInfo, newExpectedType, expectedReturnType); + return newContextForCallResolution(trace, scope, scopeForTopLevelCall, 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, preferBlock, dataFlowInfo, expectedType, newExpectedReturnType); + return newContextForCallResolution(trace, scope, scopeForTopLevelCall, dataFlowInfo, expectedType, newExpectedReturnType); } public TypeInferenceContext replaceBindingTrace(@NotNull BindingTrace newTrace) { if (newTrace == trace) return this; - return new TypeInferenceContext(newTrace, scope, preferBlock, dataFlowInfo, expectedType, expectedReturnType); + return newContextForCallResolution(newTrace, scope, scopeForTopLevelCall, dataFlowInfo, expectedType, expectedReturnType); + } + + @NotNull + public TypeInferenceContext replaceScope(@NotNull JetScope newScope) { + if (newScope == scope) return this; + return newContextForCallResolution(trace, newScope, scopeForTopLevelCall, dataFlowInfo, expectedType, expectedReturnType); + } + + @NotNull + public TypeInferenceContext replaceExpectedTypes(@NotNull JetType newExpectedType, @NotNull JetType newExpectedReturnType) { + if (expectedType == newExpectedType && expectedReturnType == newExpectedReturnType) return this; + return newContextForCallResolution(trace, scope, scopeForTopLevelCall, dataFlowInfo, newExpectedType, newExpectedReturnType); } } @@ -618,15 +653,6 @@ public class JetTypeInferrer { return resultDataFlowInfo; } - @Nullable - public JetType getType(@NotNull JetScope scope, @NotNull JetExpression expression, boolean preferBlock, TypeInferenceContext context) { - 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, preferBlock, newDataFlowInfo, context.expectedType, context.expectedReturnType)); - } - @Nullable public final JetType getType(@NotNull JetExpression expression, TypeInferenceContext context) { if (context.trace.get(BindingContext.PROCESSED, expression)) { @@ -662,6 +688,11 @@ public class JetTypeInferrer { return result; } + private JetType getTypeWithNewScopeAndDataFlowInfo(@NotNull JetScope scope, @NotNull JetExpression expression, @NotNull DataFlowInfo newDataFlowInfo, @NotNull TypeInferenceContext context) { + return getType(expression, newContextForCallResolution(context.trace, scope, context.scopeForTopLevelCall, newDataFlowInfo, context.expectedType, context.expectedReturnType)); + } + + public void resetResult() { // result = null; resultDataFlowInfo = null; @@ -796,10 +827,6 @@ public class JetTypeInferrer { @Override public JetType visitFunctionLiteralExpression(JetFunctionLiteralExpression expression, TypeInferenceContext context) { JetFunctionLiteral functionLiteral = expression.getFunctionLiteral(); - if (context.preferBlock && !functionLiteral.hasParameterSpecification()) { - context.trace.record(BindingContext.BLOCK, expression); - return context.services.checkType(context.services.getBlockReturnedType(context.scope, functionLiteral.getBodyExpression(), CoercionStrategy.NO_COERCION, context), expression, context); - } JetTypeReference receiverTypeRef = functionLiteral.getReceiverTypeRef(); final JetType receiverType; @@ -888,7 +915,7 @@ public class JetTypeInferrer { @Override public JetType visitParenthesizedExpression(JetParenthesizedExpression expression, TypeInferenceContext context) { - return context.services.checkType(getType(context.scope, expression.getExpression(), false, context), expression, context); + return context.services.checkType(getType(expression.getExpression(), context.replaceScope(context.scope)), expression, context); } @Override @@ -961,7 +988,7 @@ public class JetTypeInferrer { public JetType visitThrowExpression(JetThrowExpression expression, TypeInferenceContext context) { JetExpression thrownExpression = expression.getThrownExpression(); if (thrownExpression != null) { - JetType type = getType(context.scope, thrownExpression, false, context.replaceExpectedType(NO_EXPECTED_TYPE)); + JetType type = getType(thrownExpression, context.replaceExpectedType(NO_EXPECTED_TYPE).replaceScope(context.scope)); // TODO : check that it inherits Throwable } return context.services.checkType(JetStandardClasses.getNothingType(), expression, context); @@ -977,7 +1004,7 @@ public class JetTypeInferrer { JetType returnedType = JetStandardClasses.getUnitType(); if (returnedExpression != null) { - getType(context.scope, returnedExpression, false, context.replaceExpectedType(context.expectedReturnType)); + getType(returnedExpression, context.replaceExpectedType(context.expectedReturnType).replaceScope(context.scope)); } else { if (context.expectedReturnType != NO_EXPECTED_TYPE && !JetStandardClasses.isUnit(context.expectedReturnType)) { @@ -1000,7 +1027,7 @@ public class JetTypeInferrer { @Override public JetType visitBinaryWithTypeRHSExpression(JetBinaryExpressionWithTypeRHS expression, TypeInferenceContext context) { IElementType operationType = expression.getOperationSign().getReferencedNameElementType(); - JetType actualType = getType(context.scope, expression.getLeft(), false, context.replaceExpectedType(NO_EXPECTED_TYPE)); + JetType actualType = getType(expression.getLeft(), context.replaceExpectedType(NO_EXPECTED_TYPE).replaceScope(context.scope)); JetTypeReference right = expression.getRight(); JetType result = null; if (right != null) { @@ -1051,7 +1078,7 @@ public class JetTypeInferrer { List entries = expression.getEntries(); List types = new ArrayList(); for (JetExpression entry : entries) { - types.add(context.services.safeGetType(context.scope, entry, false, NO_EXPECTED_TYPE)); // TODO + types.add(context.services.safeGetType(context.scope, entry, NO_EXPECTED_TYPE)); // TODO } if (context.expectedType != NO_EXPECTED_TYPE && JetStandardClasses.isTupleType(context.expectedType)) { List enrichedTypes = context.services.checkArgumentTypes(types, entries, context.expectedType.getArguments(), context); @@ -1176,7 +1203,7 @@ public class JetTypeInferrer { // TODO :change scope according to the bound value in the when header final JetExpression subjectExpression = expression.getSubjectExpression(); - final JetType subjectType = subjectExpression != null ? context.services.safeGetType(context.scope, subjectExpression, false, NO_EXPECTED_TYPE) : ErrorUtils.createErrorType("Unknown type"); + final JetType subjectType = subjectExpression != null ? context.services.safeGetType(context.scope, subjectExpression, NO_EXPECTED_TYPE) : ErrorUtils.createErrorType("Unknown type"); final VariableDescriptor variableDescriptor = subjectExpression != null ? context.services.getVariableDescriptorFromSimpleName(subjectExpression, context) : null; // TODO : exhaustive patterns @@ -1215,7 +1242,7 @@ public class JetTypeInferrer { } JetExpression bodyExpression = whenEntry.getExpression(); if (bodyExpression != null) { - JetType type = getTypeWithNewDataFlowInfo(scopeToExtend, bodyExpression, true, newDataFlowInfo, contextWithExpectedType); + JetType type = getTypeWithNewScopeAndDataFlowInfo(scopeToExtend, bodyExpression, newDataFlowInfo, contextWithExpectedType); if (type != null) { expressionTypes.add(type); } @@ -1241,7 +1268,7 @@ public class JetTypeInferrer { // JetScope compositeScope = new ScopeWithReceiver(context.scope, subjectType, semanticServices.getTypeChecker()); if (callSuffixExpression != null) { // JetType selectorReturnType = getType(compositeScope, callSuffixExpression, false, context); - JetType selectorReturnType = getType(subjectType.getMemberScope(), callSuffixExpression, false, context);//getType(compositeScope, callSuffixExpression, false, context); + JetType selectorReturnType = getSelectorReturnType(subjectType, callSuffixExpression, context);//getType(compositeScope, callSuffixExpression, false, context); ensureBooleanResultWithCustomSubject(callSuffixExpression, selectorReturnType, "This expression", context); context.services.checkNullSafety(subjectType, condition.getOperationTokenNode(), getCalleeFunctionDescriptor(callSuffixExpression, context)); } @@ -1314,9 +1341,12 @@ public class JetTypeInferrer { @Override public void visitDecomposerPattern(JetDecomposerPattern pattern) { - JetType selectorReturnType = getSelectorReturnType(subjectType, pattern.getDecomposerExpression(), context); + JetExpression decomposerExpression = pattern.getDecomposerExpression(); + if (decomposerExpression != null) { + JetType selectorReturnType = getSelectorReturnType(subjectType, decomposerExpression, context); - result[0] = checkPatternType(pattern.getArgumentList(), selectorReturnType == null ? ErrorUtils.createErrorType("No type") : selectorReturnType, scopeToExtend, context); + result[0] = checkPatternType(pattern.getArgumentList(), selectorReturnType == null ? ErrorUtils.createErrorType("No type") : selectorReturnType, scopeToExtend, context); + } } @Override @@ -1328,7 +1358,7 @@ public class JetTypeInferrer { public void visitExpressionPattern(JetExpressionPattern pattern) { JetExpression expression = pattern.getExpression(); if (expression != null) { - JetType type = getType(scopeToExtend, expression, false, context); + JetType type = getType(expression, context.replaceScope(scopeToExtend)); checkTypeCompatibility(type, subjectType, pattern); } } @@ -1388,7 +1418,7 @@ public class JetTypeInferrer { if (catchBody != null) { WritableScope catchScope = newWritableScopeImpl(context.scope, context.trace).setDebugName("Catch scope"); catchScope.addVariableDescriptor(variableDescriptor); - JetType type = getType(catchScope, catchBody, true, context); + JetType type = getType(catchBody, context.replaceScope(catchScope)); if (type != null) { types.add(type); } @@ -1397,12 +1427,12 @@ public class JetTypeInferrer { } if (finallyBlock != null) { types.clear(); // Do not need the list for the check, but need the code above to typecheck catch bodies - JetType type = getType(context.scope, finallyBlock.getFinalExpression(), true, context); + JetType type = getType(finallyBlock.getFinalExpression(), context.replaceScope(context.scope)); if (type != null) { types.add(type); } } - JetType type = getType(context.scope, tryBlock, true, context); + JetType type = getType(tryBlock, context.replaceScope(context.scope)); if (type != null) { types.add(type); } @@ -1429,7 +1459,7 @@ public class JetTypeInferrer { if (elseBranch == null) { if (thenBranch != null) { - JetType type = getTypeWithNewDataFlowInfo(thenScope, thenBranch, true, thenInfo, context); + JetType type = getTypeWithNewScopeAndDataFlowInfo(thenScope, thenBranch, thenInfo, context); if (type != null && JetStandardClasses.isNothing(type)) { resultDataFlowInfo = elseInfo; // resultScope = elseScope; @@ -1439,15 +1469,15 @@ public class JetTypeInferrer { return null; } if (thenBranch == null) { - JetType type = getTypeWithNewDataFlowInfo(context.scope, elseBranch, true, elseInfo, context); + JetType type = getTypeWithNewScopeAndDataFlowInfo(context.scope, elseBranch, elseInfo, context); if (type != null && JetStandardClasses.isNothing(type)) { resultDataFlowInfo = thenInfo; // resultScope = thenScope; } return context.services.checkType(JetStandardClasses.getUnitType(), expression, contextWithExpectedType); } - JetType thenType = getTypeWithNewDataFlowInfo(thenScope, thenBranch, true, thenInfo, contextWithExpectedType); - JetType elseType = getTypeWithNewDataFlowInfo(context.scope, elseBranch, true, elseInfo, contextWithExpectedType); + JetType thenType = getTypeWithNewScopeAndDataFlowInfo(thenScope, thenBranch, thenInfo, contextWithExpectedType); + JetType elseType = getTypeWithNewScopeAndDataFlowInfo(context.scope, elseBranch, elseInfo, contextWithExpectedType); JetType result; if (thenType == null) { @@ -1610,7 +1640,7 @@ public class JetTypeInferrer { private void checkCondition(@NotNull JetScope scope, @Nullable JetExpression condition, TypeInferenceContext context) { if (condition != null) { - JetType conditionType = getType(scope, condition, false, context); + JetType conditionType = getType(condition, context.replaceScope(scope)); if (conditionType != null && !isBoolean(conditionType)) { context.trace.getErrorHandler().genericError(condition.getNode(), "Condition must be of type Boolean, but was of type " + conditionType); @@ -1627,7 +1657,7 @@ public class JetTypeInferrer { if (body != null) { WritableScopeImpl scopeToExtend = newWritableScopeImpl(context.scope, context.trace).setDebugName("Scope extended in while's condition"); DataFlowInfo conditionInfo = condition == null ? context.dataFlowInfo : extractDataFlowInfoFromCondition(condition, true, scopeToExtend, context); - getTypeWithNewDataFlowInfo(scopeToExtend, body, true, conditionInfo, context); + getTypeWithNewScopeAndDataFlowInfo(scopeToExtend, body, conditionInfo, context); } if (!flowInformationProvider.isBreakable(expression)) { // resultScope = newWritableScopeImpl(); @@ -1649,7 +1679,7 @@ public class JetTypeInferrer { context.services.getBlockReturnedTypeWithWritableScope(writableScope, function.getFunctionLiteral().getBodyExpression().getStatements(), CoercionStrategy.NO_COERCION, context); context.trace.record(BindingContext.BLOCK, function); } else { - getType(context.scope, body, true, context); + getType(body, context.replaceScope(context.scope)); } } else if (body != null) { @@ -1677,7 +1707,7 @@ public class JetTypeInferrer { JetExpression loopRange = expression.getLoopRange(); JetType loopRangeType = null; if (loopRange != null) { - loopRangeType = getType(context.scope, loopRange, false, context); + loopRangeType = getType(loopRange, context.replaceScope(context.scope)); } JetType expectedParameterType = null; if (loopRangeType != null) { @@ -1709,7 +1739,7 @@ public class JetTypeInferrer { JetExpression body = expression.getBody(); if (body != null) { - getType(loopScope, body, true, context); // TODO + getType(body, context.replaceScope(loopScope)); } return context.services.checkType(JetStandardClasses.getUnitType(), expression, contextWithExpectedType); @@ -1794,7 +1824,7 @@ 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, false, context.dataFlowInfo, NO_EXPECTED_TYPE, NO_EXPECTED_TYPE)); + JetType receiverType = context.services.typeInferrerVisitorWithNamespaces.getType(receiverExpression, context.replaceExpectedTypes(NO_EXPECTED_TYPE, NO_EXPECTED_TYPE)); if (receiverType == null) return null; if (selectorExpression == null) return null; @@ -1918,11 +1948,18 @@ public class JetTypeInferrer { return context.services.callResolver.resolveCall(context.scope, receiverType, (JetCallExpression) selectorExpression, context.expectedType); } else if (selectorExpression instanceof JetSimpleNameExpression) { -// JetScope compositeScope = new ScopeWithReceiver(context.scope, receiverType, semanticServices.getTypeChecker()); JetScope scope = receiverType != null ? receiverType.getMemberScope() : context.scope; - return getType(scope, selectorExpression, false, context); + return getType(selectorExpression, context.replaceScope(scope)); } - else if (selectorExpression != null) { + else if (selectorExpression instanceof JetQualifiedExpression) { + JetQualifiedExpression qualifiedExpression = (JetQualifiedExpression) selectorExpression; + JetType newReceiverType = getSelectorReturnType(receiverType, qualifiedExpression.getReceiverExpression(), context.replaceExpectedType(NO_EXPECTED_TYPE)); + JetExpression newSelectorExpression = qualifiedExpression.getSelectorExpression(); + if (newReceiverType != null && newSelectorExpression != null) { + return getSelectorReturnType(newReceiverType, newSelectorExpression, context); + } + } + else { // TODO : not a simple name -> resolve in scope, expect property type or a function type context.trace.getErrorHandler().genericError(selectorExpression.getNode(), "Unsupported selector element type: " + selectorExpression); } @@ -1938,7 +1975,7 @@ public class JetTypeInferrer { @Override public JetType visitIsExpression(JetIsExpression expression, TypeInferenceContext contextWithExpectedType) { TypeInferenceContext context = contextWithExpectedType.replaceExpectedType(NO_EXPECTED_TYPE); - JetType knownType = getType(context.scope, expression.getLeftHandSide(), false, context); + JetType knownType = getType(expression.getLeftHandSide(), context.replaceScope(context.scope)); JetPattern pattern = expression.getPattern(); if (pattern != null && knownType != null) { WritableScopeImpl scopeToExtend = newWritableScopeImpl(context.scope, context.trace).setDebugName("Scope extended in 'is'"); @@ -1964,7 +2001,7 @@ public class JetTypeInferrer { context.trace.getErrorHandler().genericError(operationSign.getNode(), "Unknown unary operation"); return null; } - JetType receiverType = getType(context.scope, baseExpression, false, context.replaceExpectedType(NO_EXPECTED_TYPE)); + JetType receiverType = getType(baseExpression, context.replaceExpectedType(NO_EXPECTED_TYPE).replaceScope(context.scope)); if (receiverType == null) return null; FunctionDescriptor functionDescriptor = context.services.callResolver.resolveCallWithGivenName( @@ -2040,9 +2077,9 @@ public class JetTypeInferrer { else if (equalsOperations.contains(operationType)) { String name = "equals"; if (right != null) { - JetType leftType = getType(context.scope, left, false, context); + JetType leftType = getType(left, context.replaceScope(context.scope)); if (leftType != null) { - JetType rightType = getType(context.scope, right, false, context); + JetType rightType = getType(right, context.replaceScope(context.scope)); if (rightType != null) { OverloadResolutionResult resolutionResult = context.services.callResolver.resolveExactSignature( context.scope, leftType, "equals", @@ -2086,11 +2123,11 @@ public class JetTypeInferrer { result = semanticServices.getStandardLibrary().getBooleanType(); } else if (operationType == JetTokens.ANDAND || operationType == JetTokens.OROR) { - JetType leftType = getType(context.scope, left, false, context); + JetType leftType = getType(left, context.replaceScope(context.scope)); WritableScopeImpl leftScope = newWritableScopeImpl(context.scope, context.trace).setDebugName("Left scope of && or ||"); DataFlowInfo flowInfoLeft = extractDataFlowInfoFromCondition(left, operationType == JetTokens.ANDAND, leftScope, context); // TODO: This gets computed twice: here and in extractDataFlowInfoFromCondition() for the whole condition WritableScopeImpl rightScope = operationType == JetTokens.ANDAND ? leftScope : newWritableScopeImpl(context.scope, context.trace).setDebugName("Right scope of && or ||"); - JetType rightType = right == null ? null : getTypeWithNewDataFlowInfo(rightScope, right, false, flowInfoLeft, context); + JetType rightType = right == null ? null : getType(right, context.replaceDataFlowInfo(flowInfoLeft).replaceScope(rightScope)); if (leftType != null && !isBoolean(leftType)) { context.trace.getErrorHandler().typeMismatch(left, semanticServices.getStandardLibrary().getBooleanType(), leftType); } @@ -2100,8 +2137,8 @@ public class JetTypeInferrer { result = semanticServices.getStandardLibrary().getBooleanType(); } else if (operationType == JetTokens.ELVIS) { - JetType leftType = getType(context.scope, left, false, context); - JetType rightType = right == null ? null : getType(context.scope, right, false, contextWithExpectedType); + JetType leftType = getType(left, context.replaceScope(context.scope)); + JetType rightType = right == null ? null : getType(right, contextWithExpectedType.replaceScope(context.scope)); if (leftType != null) { if (!leftType.isNullable()) { context.trace.getErrorHandler().genericWarning(left.getNode(), "Elvis operator (?:) is always returns the left operand of non-nullable type " + leftType); @@ -2120,7 +2157,7 @@ public class JetTypeInferrer { private void checkInExpression(JetSimpleNameExpression operationSign, JetExpression left, JetExpression right, TypeInferenceContext context) { String name = "contains"; - JetType receiverType = context.services.safeGetType(context.scope, right, false, NO_EXPECTED_TYPE); + JetType receiverType = context.services.safeGetType(context.scope, right, NO_EXPECTED_TYPE); FunctionDescriptor functionDescriptor = context.services.callResolver.resolveCallWithGivenName( context.scope, CallMaker.makeCall(operationSign, Collections.singletonList(left)), @@ -2136,9 +2173,9 @@ public class JetTypeInferrer { JetExpression right = expression.getRight(); // TODO : duplicated effort for == and != - JetType leftType = getType(context.scope, left, false, context); + JetType leftType = getType(left, context.replaceScope(context.scope)); if (leftType != null && right != null) { - JetType rightType = getType(context.scope, right, false, context); + JetType rightType = getType(right, context.replaceScope(context.scope)); if (rightType != null) { JetType intersect = TypeUtils.intersect(semanticServices.getTypeChecker(), new HashSet(Arrays.asList(leftType, rightType))); @@ -2181,26 +2218,11 @@ public class JetTypeInferrer { return semanticServices.getTypeChecker().isConvertibleTo(type, semanticServices.getStandardLibrary().getBooleanType()); } - @Nullable - protected List getTypes(JetScope scope, List indexExpressions, TypeInferenceContext context) { - List argumentTypes = new ArrayList(); - 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) { - return null; - } - argumentTypes.add(type); - context.services.typeInferrerVisitor.resetResult(); // TODO : recreate? - } - return argumentTypes; - } - @Override public JetType visitArrayAccessExpression(JetArrayAccessExpression expression, TypeInferenceContext contextWithExpectedType) { TypeInferenceContext context = contextWithExpectedType.replaceExpectedType(NO_EXPECTED_TYPE); JetExpression arrayExpression = expression.getArrayExpression(); - JetType receiverType = getType(context.scope, arrayExpression, false, context); + JetType receiverType = getType(arrayExpression, context.replaceScope(context.scope)); if (receiverType != null) { FunctionDescriptor functionDescriptor = context.services.callResolver.resolveCallWithGivenName( @@ -2219,7 +2241,7 @@ public class JetTypeInferrer { @Nullable protected JetType getTypeForBinaryCall(JetScope scope, String name, TypeInferenceContext context, JetBinaryExpression binaryExpression) { - JetType leftType = getType(scope, binaryExpression.getLeft(), false, context); + JetType leftType = getType(binaryExpression.getLeft(), context.replaceScope(scope)); FunctionDescriptor functionDescriptor = context.services.callResolver.resolveCallWithGivenName( scope, CallMaker.makeCall(binaryExpression), @@ -2267,7 +2289,7 @@ public class JetTypeInferrer { public void visitStringTemplateEntryWithExpression(JetStringTemplateEntryWithExpression entry) { JetExpression entryExpression = entry.getExpression(); if (entryExpression != null) { - getType(context.scope, entryExpression, true, context); + getType(entryExpression, context.replaceScope(context.scope)); } value[0] = CompileTimeConstantResolver.OUT_OF_RANGE; } @@ -2367,7 +2389,7 @@ public class JetTypeInferrer { JetExpression initializer = property.getInitializer(); if (property.getPropertyTypeRef() != null && initializer != null) { JetType outType = propertyDescriptor.getOutType(); - JetType initializerType = getType(scope, initializer, false, context.replaceExpectedType(outType)); + JetType initializerType = getType(initializer, context.replaceExpectedType(outType).replaceScope(scope)); // if (outType != null && // initializerType != null && // !semanticServices.getTypeChecker().isConvertibleTo(initializerType, outType)) { @@ -2433,9 +2455,9 @@ public class JetTypeInferrer { JetArrayAccessExpression arrayAccessExpression = (JetArrayAccessExpression) deparenthesized; return resolveArrayAccessToLValue(arrayAccessExpression, right, expression.getOperationReference(), context); } - JetType leftType = getType(scope, left, false, context.replaceExpectedType(NO_EXPECTED_TYPE)); + JetType leftType = getType(left, context.replaceExpectedType(NO_EXPECTED_TYPE).replaceScope(scope)); if (right != null) { - JetType rightType = getType(scope, right, false, context.replaceExpectedType(leftType)); + JetType rightType = getType(right, context.replaceExpectedType(leftType).replaceScope(scope)); // if (rightType != null && // leftType != null && // !semanticServices.getTypeChecker().isConvertibleTo(rightType, leftType)) { @@ -2446,7 +2468,7 @@ public class JetTypeInferrer { } private JetType resolveArrayAccessToLValue(JetArrayAccessExpression arrayAccessExpression, JetExpression rightHandSide, JetSimpleNameExpression operationSign, TypeInferenceContext context) { - JetType receiverType = getType(scope, arrayAccessExpression.getArrayExpression(), false, context); + JetType receiverType = getType(arrayAccessExpression.getArrayExpression(), context.replaceScope(scope)); if (receiverType == null) return null; // Call call = CallMaker.makeCall(arrayAccessExpression, rightHandSide); diff --git a/idea/testData/psi/ControlStructures.txt b/idea/testData/psi/ControlStructures.txt index 4273155b270..8b7e70fd7d0 100644 --- a/idea/testData/psi/ControlStructures.txt +++ b/idea/testData/psi/ControlStructures.txt @@ -535,12 +535,9 @@ JetFile: ControlStructures.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') BODY - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - BLOCK - - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') WHILE PsiElement(while)('while') @@ -552,24 +549,18 @@ JetFile: ControlStructures.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') BODY - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - BLOCK - - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') DO_WHILE PsiElement(do)('do') PsiWhiteSpace(' ') BODY - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n\n ') - BLOCK - - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace(' ') PsiElement(while)('while') PsiWhiteSpace(' ') @@ -625,12 +616,9 @@ JetFile: ControlStructures.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') BODY - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - BLOCK - - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') FOR PsiElement(for)('for') @@ -647,15 +635,13 @@ JetFile: ControlStructures.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') BODY - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('b') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('b') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') FOR PsiElement(for)('for') @@ -714,15 +700,13 @@ JetFile: ControlStructures.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') BODY - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('b') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('b') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') WHILE PsiElement(while)('while') @@ -756,12 +740,9 @@ JetFile: ControlStructures.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') BODY - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - BLOCK - - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') IF PsiElement(if)('if') @@ -980,24 +961,22 @@ JetFile: ControlStructures.jet PsiElement(do)('do') PsiWhiteSpace(' ') BODY - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - BLOCK - PsiElement(SEMICOLON)(';') - PsiElement(SEMICOLON)(';') - PsiElement(SEMICOLON)(';') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foo') - PsiElement(SEMICOLON)(';') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('bar') - PsiElement(SEMICOLON)(';') - PsiElement(SEMICOLON)(';') - PsiElement(SEMICOLON)(';') - PsiElement(SEMICOLON)(';') - PsiWhiteSpace(' ') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(SEMICOLON)(';') + PsiElement(SEMICOLON)(';') + PsiElement(SEMICOLON)(';') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + PsiElement(SEMICOLON)(';') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('bar') + PsiElement(SEMICOLON)(';') + PsiElement(SEMICOLON)(';') + PsiElement(SEMICOLON)(';') + PsiElement(SEMICOLON)(';') + PsiWhiteSpace(' ') + PsiElement(RBRACE)('}') PsiWhiteSpace(' ') PsiElement(while)('while') PsiWhiteSpace(' ') diff --git a/idea/testData/psi/Expressions_ERR.txt b/idea/testData/psi/Expressions_ERR.txt index 66a07a57f5c..456496b2c99 100644 --- a/idea/testData/psi/Expressions_ERR.txt +++ b/idea/testData/psi/Expressions_ERR.txt @@ -23,37 +23,35 @@ JetFile: Expressions_ERR.jet PsiElement(else)('else') PsiWhiteSpace(' ') ELSE - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('dfsd') - PsiWhiteSpace('\n ') - PsiErrorElement:Expecting an element - PsiElement(RPAR)(')') - PsiElement(SEMICOLON)(';') - PsiElement(SEMICOLON)(';') - PsiElement(SEMICOLON)(';') - PsiErrorElement:Expecting an element - PsiElement(RPAR)(')') - PsiElement(SEMICOLON)(';') - PsiElement(SEMICOLON)(';') - PsiElement(SEMICOLON)(';') - PsiErrorElement:Expecting an element - PsiElement(BAD_CHARACTER)('~') - PsiElement(SEMICOLON)(';') - PsiElement(SEMICOLON)(';') - PsiElement(SEMICOLON)(';') - PsiWhiteSpace('\n ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('srgsdfg') - PsiWhiteSpace('\n\n ') - PsiErrorElement:Expecting an element - PsiElement(BAD_CHARACTER)('~') - PsiWhiteSpace('\n\n ') - PsiErrorElement:Expecting an element - PsiElement(RBRACKET)(']') - PsiWhiteSpace('\n') - PsiElement(RBRACE)('}') \ No newline at end of file + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('dfsd') + PsiWhiteSpace('\n ') + PsiErrorElement:Expecting an element + PsiElement(RPAR)(')') + PsiElement(SEMICOLON)(';') + PsiElement(SEMICOLON)(';') + PsiElement(SEMICOLON)(';') + PsiErrorElement:Expecting an element + PsiElement(RPAR)(')') + PsiElement(SEMICOLON)(';') + PsiElement(SEMICOLON)(';') + PsiElement(SEMICOLON)(';') + PsiErrorElement:Expecting an element + PsiElement(BAD_CHARACTER)('~') + PsiElement(SEMICOLON)(';') + PsiElement(SEMICOLON)(';') + PsiElement(SEMICOLON)(';') + PsiWhiteSpace('\n ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('srgsdfg') + PsiWhiteSpace('\n\n ') + PsiErrorElement:Expecting an element + PsiElement(BAD_CHARACTER)('~') + PsiWhiteSpace('\n\n ') + PsiErrorElement:Expecting an element + PsiElement(RBRACKET)(']') + PsiWhiteSpace('\n') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/idea/testData/psi/IfWithPropery.txt b/idea/testData/psi/IfWithPropery.txt index 1891ebe0f4d..6e3d344b660 100644 --- a/idea/testData/psi/IfWithPropery.txt +++ b/idea/testData/psi/IfWithPropery.txt @@ -16,34 +16,30 @@ JetFile: IfWithPropery.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - BLOCK - PROPERTY - PsiElement(var)('var') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('f') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(SEMICOLON)(';') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PROPERTY + PsiElement(var)('var') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('f') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(SEMICOLON)(';') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACE)('}') PsiWhiteSpace(' ') PsiElement(else)('else') PsiWhiteSpace(' ') ELSE - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - BLOCK - NULL - PsiElement(null)('null') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + NULL + PsiElement(null)('null') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n') PROPERTY PsiElement(val)('val') @@ -61,34 +57,30 @@ JetFile: IfWithPropery.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - PROPERTY - PsiElement(var)('var') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('f') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(SEMICOLON)(';') - PsiWhiteSpace('\n ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiWhiteSpace('\n') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(var)('var') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('f') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(SEMICOLON)(';') + PsiWhiteSpace('\n ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace('\n') + PsiElement(RBRACE)('}') PsiWhiteSpace(' ') PsiElement(else)('else') PsiWhiteSpace(' ') ELSE - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - BLOCK - NULL - PsiElement(null)('null') - PsiElement(RBRACE)('}') \ No newline at end of file + BLOCK + PsiElement(LBRACE)('{') + NULL + PsiElement(null)('null') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/idea/testData/psi/RootNamespace.txt b/idea/testData/psi/RootNamespace.txt index 8e9ebf86805..4b1f87ba7ea 100644 --- a/idea/testData/psi/RootNamespace.txt +++ b/idea/testData/psi/RootNamespace.txt @@ -115,12 +115,9 @@ JetFile: RootNamespace.jet PsiWhiteSpace(' ') PsiElement(DOUBLE_ARROW)('=>') PsiWhiteSpace(' ') - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - BLOCK - - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') diff --git a/idea/testData/psi/examples/BinaryTree.txt b/idea/testData/psi/examples/BinaryTree.txt index 36008ffeaa0..41e839f7454 100644 --- a/idea/testData/psi/examples/BinaryTree.txt +++ b/idea/testData/psi/examples/BinaryTree.txt @@ -556,30 +556,28 @@ JetFile: BinaryTree.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - POSTFIX_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('size') - OPERATION_REFERENCE - PsiElement(PLUSPLUS)('++') - PsiWhiteSpace('\n ') - POSTFIX_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('version') - OPERATION_REFERENCE - PsiElement(PLUSPLUS)('++') - PsiWhiteSpace('\n ') - RETURN - PsiElement(return)('return') - PsiWhiteSpace(' ') - BOOLEAN_CONSTANT - PsiElement(true)('true') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + POSTFIX_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('size') + OPERATION_REFERENCE + PsiElement(PLUSPLUS)('++') + PsiWhiteSpace('\n ') + POSTFIX_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('version') + OPERATION_REFERENCE + PsiElement(PLUSPLUS)('++') + PsiWhiteSpace('\n ') + RETURN + PsiElement(return)('return') + PsiWhiteSpace(' ') + BOOLEAN_CONSTANT + PsiElement(true)('true') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') RETURN PsiElement(return)('return') @@ -649,40 +647,38 @@ JetFile: BinaryTree.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('node') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - CALL_EXPRESSION + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('node') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('TreeNode') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('TreeNode') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('item') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('parent') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - RETURN - PsiElement(return)('return') + PsiElement(IDENTIFIER)('item') + PsiElement(COMMA)(',') PsiWhiteSpace(' ') - BOOLEAN_CONSTANT - PsiElement(true)('true') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + VALUE_ARGUMENT + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('parent') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + RETURN + PsiElement(return)('return') + PsiWhiteSpace(' ') + BOOLEAN_CONSTANT + PsiElement(true)('true') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') WHEN PsiElement(when)('when') @@ -829,40 +825,38 @@ JetFile: BinaryTree.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('root') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - CALL_EXPRESSION + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('root') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('TreeNode') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('TreeNode') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('item') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - NULL - PsiElement(null)('null') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - RETURN - PsiElement(return)('return') + PsiElement(IDENTIFIER)('item') + PsiElement(COMMA)(',') PsiWhiteSpace(' ') - BOOLEAN_CONSTANT - PsiElement(true)('true') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + VALUE_ARGUMENT + NULL + PsiElement(null)('null') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + RETURN + PsiElement(return)('return') + PsiWhiteSpace(' ') + BOOLEAN_CONSTANT + PsiElement(true)('true') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') WHEN PsiElement(when)('when') @@ -933,44 +927,42 @@ JetFile: BinaryTree.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - DOT_QUALIFIED_EXPRESSION + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('node') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('left') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('TreeNode') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('item') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_ARGUMENT REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('node') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('left') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('TreeNode') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('item') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('node') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - RETURN - PsiElement(return)('return') - PsiWhiteSpace(' ') - BOOLEAN_CONSTANT - PsiElement(true)('true') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + RETURN + PsiElement(return)('return') + PsiWhiteSpace(' ') + BOOLEAN_CONSTANT + PsiElement(true)('true') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace(' ') PsiElement(else)('else') PsiWhiteSpace(' ') @@ -1021,44 +1013,42 @@ JetFile: BinaryTree.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - DOT_QUALIFIED_EXPRESSION + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('node') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('right') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('TreeNode') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('item') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_ARGUMENT REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('node') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('right') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('TreeNode') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('item') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('node') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - RETURN - PsiElement(return)('return') - PsiWhiteSpace(' ') - BOOLEAN_CONSTANT - PsiElement(true)('true') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + RETURN + PsiElement(return)('return') + PsiWhiteSpace(' ') + BOOLEAN_CONSTANT + PsiElement(true)('true') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace(' ') PsiElement(else)('else') PsiWhiteSpace(' ') @@ -1516,61 +1506,59 @@ JetFile: BinaryTree.jet PsiWhiteSpace(' ') PsiElement(DOUBLE_ARROW)('=>') PsiWhiteSpace(' ') - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - PROPERTY - PsiElement(val)('val') - PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('min') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + CALL_EXPRESSION + REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('min') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('min') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('node') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('right') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - BINARY_EXPRESSION - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('node') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('value') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('min') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('value') - PsiWhiteSpace('\n ') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('remove') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + DOT_QUALIFIED_EXPRESSION REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('min') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + PsiElement(IDENTIFIER)('node') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('right') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('node') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('value') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('min') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('value') + PsiWhiteSpace('\n ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('remove') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('min') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') @@ -1622,25 +1610,23 @@ JetFile: BinaryTree.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('root') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('replace') - PsiWhiteSpace('\n ') - RETURN - PsiElement(return)('return') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('root') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('replace') + PsiWhiteSpace('\n ') + RETURN + PsiElement(return)('return') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') IF PsiElement(if)('if') @@ -1667,30 +1653,28 @@ JetFile: BinaryTree.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - DOT_QUALIFIED_EXPRESSION - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('node') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('parent') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('left') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + DOT_QUALIFIED_EXPRESSION + DOT_QUALIFIED_EXPRESSION REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('replace') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + PsiElement(IDENTIFIER)('node') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('parent') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('left') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('replace') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace(' ') PsiElement(else)('else') PsiWhiteSpace(' ') @@ -1720,30 +1704,28 @@ JetFile: BinaryTree.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - DOT_QUALIFIED_EXPRESSION - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('node') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('parent') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('right') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + DOT_QUALIFIED_EXPRESSION + DOT_QUALIFIED_EXPRESSION REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('replace') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + PsiElement(IDENTIFIER)('node') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('parent') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('right') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('replace') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace(' ') PsiElement(else)('else') PsiWhiteSpace(' ') @@ -2134,257 +2116,243 @@ JetFile: BinaryTree.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') BODY - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - IF - PsiElement(if)('if') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - CONDITION - PREFIX_EXPRESSION - OPERATION_REFERENCE - PsiElement(EXCL)('!') - DOT_QUALIFIED_EXPRESSION + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + IF + PsiElement(if)('if') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + CONDITION + PREFIX_EXPRESSION + OPERATION_REFERENCE + PsiElement(EXCL)('!') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('down') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('isEmpty') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + THEN + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('curNode') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('down') + PsiElement(DOT)('.') + CALL_EXPRESSION REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('down') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('isEmpty') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - PROPERTY - PsiElement(val)('val') - PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('pop') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + IF + PsiElement(if)('if') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + CONDITION + BINARY_EXPRESSION + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('curNode') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('down') - PsiElement(DOT)('.') - CALL_EXPRESSION + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('left') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EXCLEQ)('!=') + PsiWhiteSpace(' ') + NULL + PsiElement(null)('null') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + THEN + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('up') + PsiElement(DOT)('.') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('push') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('pop') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - IF - PsiElement(if)('if') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - CONDITION - BINARY_EXPRESSION + PsiElement(IDENTIFIER)('curNode') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('down') + PsiElement(DOT)('.') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('push') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT DOT_QUALIFIED_EXPRESSION REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('curNode') PsiElement(DOT)('.') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('left') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EXCLEQ)('!=') - PsiWhiteSpace(' ') - NULL - PsiElement(null)('null') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('up') - PsiElement(DOT)('.') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('push') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('curNode') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('down') - PsiElement(DOT)('.') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('push') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('curNode') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('left') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace(' ') - PsiElement(else)('else') - PsiWhiteSpace(' ') - ELSE - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - IF - PsiElement(if)('if') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - CONDITION - BINARY_EXPRESSION - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('curNode') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('right') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EXCLEQ)('!=') - PsiWhiteSpace(' ') - NULL - PsiElement(null)('null') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('down') - PsiElement(DOT)('.') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('push') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('curNode') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('right') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n ') - RETURN - PsiElement(return)('return') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('curNode') - PsiElement(SEMICOLON)(';') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace(' ') - PsiElement(else)('else') - PsiWhiteSpace(' ') - ELSE - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') + PsiElement(RPAR)(')') PsiWhiteSpace('\n ') - BLOCK - PROPERTY - PsiElement(val)('val') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('curNode') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('up') - PsiElement(DOT)('.') - CALL_EXPRESSION + PsiElement(RBRACE)('}') + PsiWhiteSpace(' ') + PsiElement(else)('else') + PsiWhiteSpace(' ') + ELSE + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + IF + PsiElement(if)('if') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + CONDITION + BINARY_EXPRESSION + DOT_QUALIFIED_EXPRESSION REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('pop') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - IF - PsiElement(if)('if') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - CONDITION - BINARY_EXPRESSION + PsiElement(IDENTIFIER)('curNode') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('right') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EXCLEQ)('!=') + PsiWhiteSpace(' ') + NULL + PsiElement(null)('null') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + THEN + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('down') + PsiElement(DOT)('.') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('push') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('curNode') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('right') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + RETURN + PsiElement(return)('return') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('curNode') + PsiElement(SEMICOLON)(';') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace(' ') + PsiElement(else)('else') + PsiWhiteSpace(' ') + ELSE + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('curNode') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('up') + PsiElement(DOT)('.') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('pop') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + IF + PsiElement(if)('if') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + CONDITION + BINARY_EXPRESSION + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('curNode') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('right') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EXCLEQ)('!=') + PsiWhiteSpace(' ') + NULL + PsiElement(null)('null') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + THEN + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('down') + PsiElement(DOT)('.') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('push') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT DOT_QUALIFIED_EXPRESSION REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('curNode') PsiElement(DOT)('.') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('right') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EXCLEQ)('!=') - PsiWhiteSpace(' ') - NULL - PsiElement(null)('null') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('down') - PsiElement(DOT)('.') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('push') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('curNode') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('right') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n ') - RETURN - PsiElement(return)('return') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('curNode') - PsiWhiteSpace('\n ') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') PsiElement(RBRACE)('}') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + RETURN + PsiElement(return)('return') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('curNode') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') @@ -2565,22 +2533,20 @@ JetFile: BinaryTree.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - THROW - PsiElement(throw)('throw') - PsiWhiteSpace(' ') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('ConcurrentModificationException') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + THROW + PsiElement(throw)('throw') + PsiWhiteSpace(' ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('ConcurrentModificationException') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace(' \n ') PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') diff --git a/idea/testData/psi/examples/BitArith.txt b/idea/testData/psi/examples/BitArith.txt index bb961a436f6..827bdff7a10 100644 --- a/idea/testData/psi/examples/BitArith.txt +++ b/idea/testData/psi/examples/BitArith.txt @@ -288,46 +288,44 @@ JetFile: BitArith.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') BODY - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('result') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(PLUSEQ)('+=') - PsiWhiteSpace(' ') - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('x') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(IDENTIFIER)('and') - PsiWhiteSpace(' ') - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiWhiteSpace('\n ') - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('x') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('x') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(IDENTIFIER)('ushr') - PsiWhiteSpace(' ') - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('result') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(PLUSEQ)('+=') + PsiWhiteSpace(' ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('x') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(IDENTIFIER)('and') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('x') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('x') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(IDENTIFIER)('ushr') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('result') diff --git a/idea/testData/psi/examples/Graph.txt b/idea/testData/psi/examples/Graph.txt index b259175e054..a21315c0896 100644 --- a/idea/testData/psi/examples/Graph.txt +++ b/idea/testData/psi/examples/Graph.txt @@ -878,113 +878,109 @@ JetFile: Graph.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') BODY - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - PROPERTY - PsiElement(val)('val') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('current') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('pending') - PsiElement(DOT)('.') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('pop') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('current') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('pending') + PsiElement(DOT)('.') CALL_EXPRESSION REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('handler') + PsiElement(IDENTIFIER)('pop') VALUE_ARGUMENT_LIST PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('current') PsiElement(RPAR)(')') - PsiElement(SEMICOLON)(';') - PsiWhiteSpace('\n ') - DOT_QUALIFIED_EXPRESSION - CALL_EXPRESSION + PsiWhiteSpace('\n ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('handler') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('current') + PsiElement(RPAR)(')') + PsiElement(SEMICOLON)(';') + PsiWhiteSpace('\n ') + DOT_QUALIFIED_EXPRESSION + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('neighbours') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('neighbours') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('current') - PsiElement(RPAR)(')') - PsiElement(DOT)('.') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('foreach') + PsiElement(IDENTIFIER)('current') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foreach') + PsiWhiteSpace(' ') + FUNCTION_LITERAL_EXPRESSION + FUNCTION_LITERAL + PsiElement(LBRACE)('{') PsiWhiteSpace(' ') - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') + VALUE_PARAMETER_LIST + VALUE_PARAMETER + PsiElement(IDENTIFIER)('n') + PsiWhiteSpace(' ') + PsiElement(DOUBLE_ARROW)('=>') + PsiWhiteSpace('\n ') + BLOCK + IF + PsiElement(if)('if') PsiWhiteSpace(' ') - VALUE_PARAMETER_LIST - VALUE_PARAMETER - PsiElement(IDENTIFIER)('n') - PsiWhiteSpace(' ') - PsiElement(DOUBLE_ARROW)('=>') - PsiWhiteSpace('\n ') - BLOCK - IF - PsiElement(if)('if') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - CONDITION - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('visited') - PsiElement(DOT)('.') - CALL_EXPRESSION + PsiElement(LPAR)('(') + CONDITION + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('visited') + PsiElement(DOT)('.') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('add') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('add') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('n') - PsiElement(RPAR)(')') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('pending') - PsiElement(DOT)('.') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('push') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('n') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n ') - PsiComment(BLOCK_COMMENT)('/* alternative\n pending->push(neighbours(current).filter{n => !visited[n])})\n // -> means that if push(x : T) and actual parameter y is IIterable, this compiles into\n y.foreach{ n => push(n) }\n */') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + PsiElement(IDENTIFIER)('n') + PsiElement(RPAR)(')') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + THEN + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('pending') + PsiElement(DOT)('.') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('push') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('n') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + PsiComment(BLOCK_COMMENT)('/* alternative\n pending->push(neighbours(current).filter{n => !visited[n])})\n // -> means that if push(x : T) and actual parameter y is IIterable, this compiles into\n y.foreach{ n => push(n) }\n */') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') diff --git a/idea/testData/psi/examples/PolymorphicClassObjects.txt b/idea/testData/psi/examples/PolymorphicClassObjects.txt index dcc30974cee..f4f39ba0580 100644 --- a/idea/testData/psi/examples/PolymorphicClassObjects.txt +++ b/idea/testData/psi/examples/PolymorphicClassObjects.txt @@ -371,29 +371,27 @@ JetFile: PolymorphicClassObjects.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') BODY - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('builder') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(PLUSEQ)('+=') - PsiWhiteSpace(' ') - CALL_EXPRESSION + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('builder') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(PLUSEQ)('+=') + PsiWhiteSpace(' ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('f') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('f') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('e') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + PsiElement(IDENTIFIER)('e') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') DOT_QUALIFIED_EXPRESSION REFERENCE_EXPRESSION diff --git a/idea/testData/psi/examples/Queue.txt b/idea/testData/psi/examples/Queue.txt index d1d91f81253..335c7217d56 100644 --- a/idea/testData/psi/examples/Queue.txt +++ b/idea/testData/psi/examples/Queue.txt @@ -191,66 +191,62 @@ JetFile: Queue.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('head') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('i') - PsiWhiteSpace('\n ') - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('tail') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('head') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('head') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('i') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('tail') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('head') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace(' ') PsiElement(else)('else') PsiWhiteSpace(' ') ELSE - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('tail') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('next') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('i') - PsiWhiteSpace('\n ') - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('tail') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('i') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('tail') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('next') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('i') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('tail') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('i') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') @@ -297,70 +293,68 @@ JetFile: Queue.jet PsiElement(else)('else') PsiWhiteSpace(' ') ELSE - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - PROPERTY - PsiElement(val)('val') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('result') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('head') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('data') - PsiWhiteSpace('\n ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('result') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('head') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('data') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('head') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('head') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('next') + PsiWhiteSpace('\n ') + IF + PsiElement(if)('if') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + CONDITION BINARY_EXPRESSION REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('head') PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQEQ)('==') + PsiWhiteSpace(' ') + NULL + PsiElement(null)('null') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + THEN + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('tail') + PsiWhiteSpace(' ') OPERATION_REFERENCE PsiElement(EQ)('=') PsiWhiteSpace(' ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('head') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('next') - PsiWhiteSpace('\n ') - IF - PsiElement(if)('if') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - CONDITION - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('head') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQEQ)('==') - PsiWhiteSpace(' ') - NULL - PsiElement(null)('null') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - THEN - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('tail') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - NULL - PsiElement(null)('null') - PsiWhiteSpace('\n ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('result') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + NULL + PsiElement(null)('null') + PsiWhiteSpace('\n ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('result') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') PROPERTY MODIFIER_LIST diff --git a/idea/testData/psi/examples/UnionFind.txt b/idea/testData/psi/examples/UnionFind.txt index 1e92c93b621..a349879dc7d 100644 --- a/idea/testData/psi/examples/UnionFind.txt +++ b/idea/testData/psi/examples/UnionFind.txt @@ -150,19 +150,17 @@ JetFile: UnionFind.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - RETURN - PsiElement(return)('return') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('x') - PsiElement(SEMICOLON)(';') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + RETURN + PsiElement(return)('return') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('x') + PsiElement(SEMICOLON)(';') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') PROPERTY PsiElement(val)('val') @@ -283,83 +281,77 @@ JetFile: UnionFind.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - IF - PsiElement(if)('if') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - CONDITION - DOT_QUALIFIED_EXPRESSION - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Random') - PsiElement(DOT)('.') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('nextInt') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiElement(DOT)('.') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + IF + PsiElement(if)('if') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + CONDITION + DOT_QUALIFIED_EXPRESSION + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Random') + PsiElement(DOT)('.') + CALL_EXPRESSION REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('isOdd') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - ARRAY_ACCESS_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('data') - INDICES - PsiElement(LBRACKET)('[') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('pb') - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('pa') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace(' ') - PsiElement(else)('else') - PsiWhiteSpace(' ') - ELSE - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - ARRAY_ACCESS_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('data') - INDICES - PsiElement(LBRACKET)('[') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('pa') - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('pb') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + PsiElement(IDENTIFIER)('nextInt') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('isOdd') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + THEN + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + ARRAY_ACCESS_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('data') + INDICES + PsiElement(LBRACKET)('[') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('pb') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('pa') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace(' ') + PsiElement(else)('else') + PsiWhiteSpace(' ') + ELSE + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + ARRAY_ACCESS_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('data') + INDICES + PsiElement(LBRACKET)('[') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('pa') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('pb') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') PsiElement(RBRACE)('}') PsiWhiteSpace('\n') diff --git a/idea/testData/psi/examples/collections/ArrayList.txt b/idea/testData/psi/examples/collections/ArrayList.txt index 769d27e1aa4..4ca13335330 100644 --- a/idea/testData/psi/examples/collections/ArrayList.txt +++ b/idea/testData/psi/examples/collections/ArrayList.txt @@ -672,31 +672,29 @@ JetFile: ArrayList.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - ARRAY_ACCESS_EXPRESSION + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + ARRAY_ACCESS_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('data') + INDICES + PsiElement(LBRACKET)('[') + POSTFIX_EXPRESSION REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('data') - INDICES - PsiElement(LBRACKET)('[') - POSTFIX_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('used') - OPERATION_REFERENCE - PsiElement(PLUSPLUS)('++') - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('value') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + PsiElement(IDENTIFIER)('used') + OPERATION_REFERENCE + PsiElement(PLUSPLUS)('++') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('value') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace(' ') PsiElement(else)('else') PsiWhiteSpace(' ') @@ -718,90 +716,88 @@ JetFile: ArrayList.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - FOR - PsiElement(for)('for') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - LOOP_PARAMETER - PsiElement(IDENTIFIER)('i') - PsiWhiteSpace(' ') - PsiElement(in)('in') - PsiWhiteSpace(' ') - LOOP_RANGE - BINARY_EXPRESSION - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('used') - OPERATION_REFERENCE - PsiElement(MINUS)('-') - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - OPERATION_REFERENCE - PsiElement(RANGE)('..') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('index') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiComment(EOL_COMMENT)('// backwards, special operator... Need to optimize this to be a real indexed loop') - PsiWhiteSpace('\n ') - BODY - BINARY_EXPRESSION - ARRAY_ACCESS_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('data') - INDICES - PsiElement(LBRACKET)('[') - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('i') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(PLUS)('+') - PsiWhiteSpace(' ') - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - ARRAY_ACCESS_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('data') - INDICES - PsiElement(LBRACKET)('[') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('i') - PsiElement(RBRACKET)(']') - PsiWhiteSpace('\n ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + FOR + PsiElement(for)('for') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + LOOP_PARAMETER + PsiElement(IDENTIFIER)('i') + PsiWhiteSpace(' ') + PsiElement(in)('in') + PsiWhiteSpace(' ') + LOOP_RANGE + BINARY_EXPRESSION + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('used') + OPERATION_REFERENCE + PsiElement(MINUS)('-') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + OPERATION_REFERENCE + PsiElement(RANGE)('..') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('index') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiComment(EOL_COMMENT)('// backwards, special operator... Need to optimize this to be a real indexed loop') + PsiWhiteSpace('\n ') + BODY BINARY_EXPRESSION ARRAY_ACCESS_EXPRESSION REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('data') INDICES PsiElement(LBRACKET)('[') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('index') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('i') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(PLUS)('+') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') OPERATION_REFERENCE PsiElement(EQ)('=') PsiWhiteSpace(' ') + ARRAY_ACCESS_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('data') + INDICES + PsiElement(LBRACKET)('[') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('i') + PsiElement(RBRACKET)(']') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + ARRAY_ACCESS_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('data') + INDICES + PsiElement(LBRACKET)('[') REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('value') - PsiWhiteSpace('\n ') - POSTFIX_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('used') - OPERATION_REFERENCE - PsiElement(PLUSPLUS)('++') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + PsiElement(IDENTIFIER)('index') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('value') + PsiWhiteSpace('\n ') + POSTFIX_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('used') + OPERATION_REFERENCE + PsiElement(PLUSPLUS)('++') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace(' ') PsiElement(else)('else') PsiWhiteSpace(' ') diff --git a/idea/testData/psi/examples/collections/IIterator.txt b/idea/testData/psi/examples/collections/IIterator.txt index 113721a69eb..aad40e0df47 100644 --- a/idea/testData/psi/examples/collections/IIterator.txt +++ b/idea/testData/psi/examples/collections/IIterator.txt @@ -251,23 +251,21 @@ JetFile: IIterator.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - THROW - PsiElement(throw)('throw') - PsiWhiteSpace(' ') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('IndexOutOfBoundsException') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiElement(SEMICOLON)(';') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + THROW + PsiElement(throw)('throw') + PsiWhiteSpace(' ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('IndexOutOfBoundsException') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiElement(SEMICOLON)(';') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') IF PsiElement(if)('if') @@ -339,57 +337,55 @@ JetFile: IIterator.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') BODY - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - IF - PsiElement(if)('if') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - CONDITION - PREFIX_EXPRESSION - OPERATION_REFERENCE - PsiElement(EXCL)('!') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('hasNext') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - THEN - RETURN - PsiElement(return)('return') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('count') - PsiWhiteSpace('\n ') - BINARY_EXPRESSION - ARRAY_ACCESS_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('buffer') - INDICES - PsiElement(LBRACKET)('[') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('i') - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + IF + PsiElement(if)('if') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + CONDITION + PREFIX_EXPRESSION OPERATION_REFERENCE - PsiElement(EQ)('=') + PsiElement(EXCL)('!') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('hasNext') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + THEN + RETURN + PsiElement(return)('return') PsiWhiteSpace(' ') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('next') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - POSTFIX_EXPRESSION REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('count') - OPERATION_REFERENCE - PsiElement(PLUSPLUS)('++') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + ARRAY_ACCESS_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('buffer') + INDICES + PsiElement(LBRACKET)('[') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('i') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('next') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + POSTFIX_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('count') + OPERATION_REFERENCE + PsiElement(PLUSPLUS)('++') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') RETURN PsiElement(return)('return') diff --git a/idea/testData/psi/examples/collections/LinkedList.txt b/idea/testData/psi/examples/collections/LinkedList.txt index e382676f705..70ecbe15074 100644 --- a/idea/testData/psi/examples/collections/LinkedList.txt +++ b/idea/testData/psi/examples/collections/LinkedList.txt @@ -224,163 +224,155 @@ JetFile: LinkedList.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('newItem') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('next') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('head') - PsiWhiteSpace('\n ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('newItem') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('next') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('head') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('head') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('newItem') + PsiWhiteSpace('\n ') + IF + PsiElement(if)('if') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + CONDITION BINARY_EXPRESSION REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('head') + PsiElement(IDENTIFIER)('tail') PsiWhiteSpace(' ') OPERATION_REFERENCE - PsiElement(EQ)('=') + PsiElement(EQEQEQ)('===') PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('newItem') - PsiWhiteSpace('\n ') - IF - PsiElement(if)('if') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - CONDITION - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('tail') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQEQEQ)('===') - PsiWhiteSpace(' ') - NULL - PsiElement(null)('null') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('tail') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('head') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + NULL + PsiElement(null)('null') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + THEN + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('tail') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('head') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace(' ') PsiElement(else)('else') PsiWhiteSpace(' ') ELSE - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - PROPERTY - PsiElement(var)('var') - PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(var)('var') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('insertAfter') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('itemAt') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('index') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('newItem') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('next') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('insertAfter') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('itemAt') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('index') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('next') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('insertAfter') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('next') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('newItem') + PsiWhiteSpace('\n ') + IF + PsiElement(if)('if') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + CONDITION BINARY_EXPRESSION - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('newItem') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('next') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('tail') PsiWhiteSpace(' ') OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('insertAfter') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('next') - PsiWhiteSpace('\n ') - BINARY_EXPRESSION - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('insertAfter') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('next') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') + PsiElement(EQEQEQ)('===') PsiWhiteSpace(' ') REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('newItem') - PsiWhiteSpace('\n ') - IF - PsiElement(if)('if') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - CONDITION - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('tail') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQEQEQ)('===') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('insertAfter') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('tail') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('newItem') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + PsiElement(IDENTIFIER)('insertAfter') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + THEN + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('tail') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('newItem') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') @@ -434,25 +426,23 @@ JetFile: LinkedList.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - THROW - PsiElement(throw)('throw') - PsiWhiteSpace(' ') - CALL_EXPRESSION + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + THROW + PsiElement(throw)('throw') + PsiWhiteSpace(' ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('IndexOutOfBoundsException') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('IndexOutOfBoundsException') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('index') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + PsiElement(IDENTIFIER)('index') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') @@ -530,158 +520,150 @@ JetFile: LinkedList.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('head') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('item') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('next') + PsiWhiteSpace('\n ') + IF + PsiElement(if)('if') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + CONDITION BINARY_EXPRESSION REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('head') PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQEQEQ)('===') + PsiWhiteSpace(' ') + NULL + PsiElement(null)('null') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + THEN + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('tail') OPERATION_REFERENCE PsiElement(EQ)('=') PsiWhiteSpace(' ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('item') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('next') - PsiWhiteSpace('\n ') - IF - PsiElement(if)('if') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - CONDITION - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('head') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQEQEQ)('===') - PsiWhiteSpace(' ') - NULL - PsiElement(null)('null') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - THEN - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('tail') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - NULL - PsiElement(null)('null') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + NULL + PsiElement(null)('null') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace(' ') PsiElement(else)('else') PsiWhiteSpace(' ') ELSE - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + DOT_QUALIFIED_EXPRESSION + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('item') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('previous') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('next') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('item') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('next') + PsiWhiteSpace('\n ') + IF + PsiElement(if)('if') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + CONDITION BINARY_EXPRESSION DOT_QUALIFIED_EXPRESSION - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('item') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('previous') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('item') PsiElement(DOT)('.') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('next') PsiWhiteSpace(' ') OPERATION_REFERENCE - PsiElement(EQ)('=') + PsiElement(EQEQEQ)('===') PsiWhiteSpace(' ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('item') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('next') - PsiWhiteSpace('\n ') - IF - PsiElement(if)('if') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - CONDITION - BINARY_EXPRESSION + NULL + PsiElement(null)('null') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + THEN + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + DOT_QUALIFIED_EXPRESSION DOT_QUALIFIED_EXPRESSION REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('item') PsiElement(DOT)('.') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('next') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQEQEQ)('===') - PsiWhiteSpace(' ') - NULL - PsiElement(null)('null') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - DOT_QUALIFIED_EXPRESSION - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('item') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('next') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('previous') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('item') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('previous') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace(' ') - PsiElement(else)('else') - PsiWhiteSpace(' ') - ELSE - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('tail') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('tail') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('previous') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('previous') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('item') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('previous') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace(' ') + PsiElement(else)('else') + PsiWhiteSpace(' ') + ELSE + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('tail') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('tail') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('previous') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') POSTFIX_EXPRESSION REFERENCE_EXPRESSION @@ -858,26 +840,24 @@ JetFile: LinkedList.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') BODY - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('result') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('result') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('next') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('result') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('result') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('next') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') RETURN PsiElement(return)('return') diff --git a/idea/testData/psi/examples/io/IOSamples.txt b/idea/testData/psi/examples/io/IOSamples.txt index 9f6e5596509..10ca7f4441a 100644 --- a/idea/testData/psi/examples/io/IOSamples.txt +++ b/idea/testData/psi/examples/io/IOSamples.txt @@ -358,37 +358,35 @@ JetFile: IOSamples.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('nextUsed') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - BOOLEAN_CONSTANT - PsiElement(true)('true') - PsiWhiteSpace('\n ') - RETURN - PsiElement(return)('return') - PsiWhiteSpace(' ') - BINARY_WITH_TYPE + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('nextUsed') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + BOOLEAN_CONSTANT + PsiElement(true)('true') + PsiWhiteSpace('\n ') + RETURN + PsiElement(return)('return') + PsiWhiteSpace(' ') + BINARY_WITH_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('next') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(as)('as') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('next') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(as)('as') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Byte') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + PsiElement(IDENTIFIER)('Byte') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') RETURN PsiElement(return)('return') @@ -440,42 +438,40 @@ JetFile: IOSamples.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('nextUsed') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - BOOLEAN_CONSTANT - PsiElement(false)('false') - PsiWhiteSpace('\n ') - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('next') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('stream') - PsiElement(DOT)('.') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('read') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('nextUsed') PsiWhiteSpace(' ') - PsiComment(EOL_COMMENT)('// throws IOException') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + BOOLEAN_CONSTANT + PsiElement(false)('false') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('next') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('stream') + PsiElement(DOT)('.') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('read') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiComment(EOL_COMMENT)('// throws IOException') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') RETURN PsiElement(return)('return') diff --git a/idea/testData/psi/examples/priorityqueues/BinaryHeap.txt b/idea/testData/psi/examples/priorityqueues/BinaryHeap.txt index 48d975a1f91..d585bc8ffed 100644 --- a/idea/testData/psi/examples/priorityqueues/BinaryHeap.txt +++ b/idea/testData/psi/examples/priorityqueues/BinaryHeap.txt @@ -209,22 +209,20 @@ JetFile: BinaryHeap.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') BODY - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - CALL_EXPRESSION + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('siftDown') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('siftDown') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('i') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + PsiElement(IDENTIFIER)('i') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') @@ -575,186 +573,180 @@ JetFile: BinaryHeap.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') BODY - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - PROPERTY - PsiElement(var)('var') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('min') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('current') - PsiWhiteSpace('\n ') - IF - PsiElement(if)('if') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - CONDITION - BINARY_EXPRESSION - DOT_QUALIFIED_EXPRESSION - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('current') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('left') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('value') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(LT)('<') - PsiWhiteSpace(' ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('min') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('value') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('min') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('current') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('left') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n ') - IF - PsiElement(if)('if') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - CONDITION - BINARY_EXPRESSION - DOT_QUALIFIED_EXPRESSION - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('current') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('right') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('exists') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(ANDAND)('&&') - PsiWhiteSpace(' ') - BINARY_EXPRESSION - DOT_QUALIFIED_EXPRESSION - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('current') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('right') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('value') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(LT)('<') - PsiWhiteSpace(' ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('min') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('value') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('min') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('current') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('right') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n ') - IF - PsiElement(if)('if') - PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - CONDITION - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('min') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQEQ)('==') - PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(var)('var') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('min') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('current') + PsiWhiteSpace('\n ') + IF + PsiElement(if)('if') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + CONDITION + BINARY_EXPRESSION + DOT_QUALIFIED_EXPRESSION + DOT_QUALIFIED_EXPRESSION REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('current') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - THEN - BREAK - PsiElement(break)('break') - PsiWhiteSpace('\n ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('data') - PsiElement(DOT)('.') - CALL_EXPRESSION + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('left') + PsiElement(DOT)('.') REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('swap') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('min') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('current') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - BINARY_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('current') + PsiElement(IDENTIFIER)('value') PsiWhiteSpace(' ') OPERATION_REFERENCE - PsiElement(EQ)('=') + PsiElement(LT)('<') PsiWhiteSpace(' ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('min') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('value') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + THEN + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('min') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('current') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('left') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + IF + PsiElement(if)('if') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + CONDITION + BINARY_EXPRESSION + DOT_QUALIFIED_EXPRESSION + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('current') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('right') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('exists') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(ANDAND)('&&') + PsiWhiteSpace(' ') + BINARY_EXPRESSION + DOT_QUALIFIED_EXPRESSION + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('current') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('right') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('value') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(LT)('<') + PsiWhiteSpace(' ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('min') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('value') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + THEN + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('min') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('current') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('right') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + IF + PsiElement(if)('if') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + CONDITION + BINARY_EXPRESSION REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('min') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQEQ)('==') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('current') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + THEN + BREAK + PsiElement(break)('break') + PsiWhiteSpace('\n ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('data') + PsiElement(DOT)('.') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('swap') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('min') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_ARGUMENT + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('current') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('current') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('min') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') @@ -829,85 +821,81 @@ JetFile: BinaryHeap.jet PsiElement(RPAR)(')') PsiWhiteSpace(' ') BODY - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK - IF - PsiElement(if)('if') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + IF + PsiElement(if)('if') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + CONDITION + BINARY_EXPRESSION + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('current') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('value') PsiWhiteSpace(' ') - PsiElement(LPAR)('(') - CONDITION - BINARY_EXPRESSION - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('current') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('value') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(LT)('<') - PsiWhiteSpace(' ') - DOT_QUALIFIED_EXPRESSION - DOT_QUALIFIED_EXPRESSION + OPERATION_REFERENCE + PsiElement(LT)('<') + PsiWhiteSpace(' ') + DOT_QUALIFIED_EXPRESSION + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('current') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('parent') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('value') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + THEN + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('data') + PsiElement(DOT)('.') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('swap') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('current') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('parent') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('value') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - THEN - FUNCTION_LITERAL_EXPRESSION - FUNCTION_LITERAL - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - BLOCK + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + VALUE_ARGUMENT DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('data') - PsiElement(DOT)('.') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('swap') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('current') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('current') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('parent') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - BINARY_EXPRESSION REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('current') - PsiWhiteSpace(' ') - OPERATION_REFERENCE - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('current') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('parent') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n ') - PsiElement(RBRACE)('}') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('parent') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('current') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + DOT_QUALIFIED_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('current') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('parent') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') PsiWhiteSpace('\n ') PsiElement(RBRACE)('}') PsiWhiteSpace('\n\n ') diff --git a/idea/tests/org/jetbrains/jet/types/JetTypeCheckerTest.java b/idea/tests/org/jetbrains/jet/types/JetTypeCheckerTest.java index 9240616035f..b3e2b853a99 100644 --- a/idea/tests/org/jetbrains/jet/types/JetTypeCheckerTest.java +++ b/idea/tests/org/jetbrains/jet/types/JetTypeCheckerTest.java @@ -488,14 +488,14 @@ public class JetTypeCheckerTest extends LightDaemonAnalyzerTestCase { private void assertType(String expression, JetType expectedType) { Project project = getProject(); JetExpression jetExpression = JetChangeUtil.createExpression(project, expression); - JetType type = semanticServices.getTypeInferrerServices(JetTestUtils.DUMMY_TRACE, JetFlowInformationProvider.NONE).getType(scopeWithImports, jetExpression, false, JetTypeInferrer.NO_EXPECTED_TYPE); + JetType type = semanticServices.getTypeInferrerServices(JetTestUtils.DUMMY_TRACE, JetFlowInformationProvider.NONE).getType(scopeWithImports, jetExpression, JetTypeInferrer.NO_EXPECTED_TYPE); assertTrue(type + " != " + expectedType, type.equals(expectedType)); } private void assertErrorType(String expression) { Project project = getProject(); JetExpression jetExpression = JetChangeUtil.createExpression(project, expression); - JetType type = semanticServices.getTypeInferrerServices(JetTestUtils.DUMMY_TRACE, JetFlowInformationProvider.NONE).safeGetType(scopeWithImports, jetExpression, false, JetTypeInferrer.NO_EXPECTED_TYPE); + JetType type = semanticServices.getTypeInferrerServices(JetTestUtils.DUMMY_TRACE, JetFlowInformationProvider.NONE).safeGetType(scopeWithImports, jetExpression, JetTypeInferrer.NO_EXPECTED_TYPE); assertTrue("Error type expected but " + type + " returned", ErrorUtils.isErrorType(type)); } @@ -518,7 +518,7 @@ public class JetTypeCheckerTest extends LightDaemonAnalyzerTestCase { private void assertType(JetScope scope, String expression, String expectedTypeStr) { Project project = getProject(); JetExpression jetExpression = JetChangeUtil.createExpression(project, expression); - JetType type = semanticServices.getTypeInferrerServices(JetTestUtils.DUMMY_TRACE, JetFlowInformationProvider.NONE).getType(addImports(scope), jetExpression, false, JetTypeInferrer.NO_EXPECTED_TYPE); + JetType type = semanticServices.getTypeInferrerServices(JetTestUtils.DUMMY_TRACE, JetFlowInformationProvider.NONE).getType(addImports(scope), jetExpression, JetTypeInferrer.NO_EXPECTED_TYPE); JetType expectedType = expectedTypeStr == null ? null : makeType(expectedTypeStr); assertEquals(expectedType, type); }