preferBlock removed from JetTypeInferrer

This commit is contained in:
Andrey Breslav
2011-08-29 21:43:48 +04:00
parent 7bebf426b8
commit a469526180
21 changed files with 1878 additions and 1954 deletions
@@ -723,7 +723,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
if (atSet(WHEN_CONDITION_RECOVERY_SET)) { if (atSet(WHEN_CONDITION_RECOVERY_SET)) {
error("Expecting an element"); error("Expecting an element");
} else { } else {
parseExpression(); parseExpressionPreferringBlocks();
} }
} else if (!atSet(WHEN_CONDITION_RECOVERY_SET)) { } else if (!atSet(WHEN_CONDITION_RECOVERY_SET)) {
errorAndAdvance("Expecting '=>'"); errorAndAdvance("Expecting '=>'");
@@ -750,7 +750,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
if (atSet(WHEN_CONDITION_RECOVERY_SET)) { if (atSet(WHEN_CONDITION_RECOVERY_SET)) {
error("Expecting an element"); error("Expecting an element");
} else { } else {
parseExpression(); parseExpressionPreferringBlocks();
} }
// SEMI is consumed in parseWhenEntry // SEMI is consumed in parseWhenEntry
} }
@@ -1032,6 +1032,10 @@ public class JetExpressionParsing extends AbstractJetParsing {
* ; * ;
*/ */
private void parseFunctionLiteral() { private void parseFunctionLiteral() {
parseFunctionLiteral(false);
}
private void parseFunctionLiteral(boolean preferBlock) {
assert _at(LBRACE); assert _at(LBRACE);
PsiBuilder.Marker literalExpression = mark(); 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; boolean dontExpectParameters = false;
int lastDot = matchTokenStreamPredicate(new LastBefore(new At(DOT), new AtOffset(doubleArrowPos))); int lastDot = matchTokenStreamPredicate(new LastBefore(new At(DOT), new AtOffset(doubleArrowPos)));
@@ -1116,7 +1121,17 @@ public class JetExpressionParsing extends AbstractJetParsing {
expectNoAdvance(DOUBLE_ARROW, "Expecting '=>'"); expectNoAdvance(DOUBLE_ARROW, "Expecting '=>'");
} }
else {
if (preferBlock) {
literal.drop();
parseStatements();
expect(RBRACE, "Expecting '}'");
literalExpression.done(BLOCK);
myBuilder.restoreNewlinesState();
return;
}
}
PsiBuilder.Marker body = mark(); PsiBuilder.Marker body = mark();
parseStatements(); parseStatements();
body.done(BLOCK); body.done(BLOCK);
@@ -1322,13 +1337,34 @@ public class JetExpressionParsing extends AbstractJetParsing {
loop.done(FOR); 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 * element
*/ */
private void parseControlStructureBody() { private void parseControlStructureBody() {
PsiBuilder.Marker body = mark(); PsiBuilder.Marker body = mark();
if (!at(SEMICOLON)) { if (!at(SEMICOLON)) {
parseExpression(); parseExpressionPreferringBlocks();
} }
body.done(BODY); body.done(BODY);
} }
@@ -1400,7 +1436,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
PsiBuilder.Marker thenBranch = mark(); PsiBuilder.Marker thenBranch = mark();
if (!at(ELSE_KEYWORD) && !at(SEMICOLON)) { if (!at(ELSE_KEYWORD) && !at(SEMICOLON)) {
parseExpression(); parseExpressionPreferringBlocks();
} }
if (at(SEMICOLON) && lookahead(1) == ELSE_KEYWORD) { if (at(SEMICOLON) && lookahead(1) == ELSE_KEYWORD) {
advance(); // SEMICOLON advance(); // SEMICOLON
@@ -1412,7 +1448,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
PsiBuilder.Marker elseBranch = mark(); PsiBuilder.Marker elseBranch = mark();
if (!at(SEMICOLON)) { if (!at(SEMICOLON)) {
parseExpression(); parseExpressionPreferringBlocks();
} }
elseBranch.done(ELSE); elseBranch.done(ELSE);
} }
@@ -540,7 +540,7 @@ public class ClassDescriptorResolver {
@Override @Override
protected JetType compute() { protected JetType compute() {
JetFlowInformationProvider flowInformationProvider = computeFlowData(property, initializer); 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) { if (allowDeferred) {
@@ -274,7 +274,7 @@ public class TopDownAnalyzer {
JetExpression importedReference = importDirective.getImportedReference(); JetExpression importedReference = importDirective.getImportedReference();
if (importedReference != null) { if (importedReference != null) {
JetTypeInferrer.Services typeInferrerServices = semanticServices.getTypeInferrerServices(trace, JetFlowInformationProvider.THROW_EXCEPTION); 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) { if (type != null) {
namespaceScope.importScope(type.getMemberScope()); namespaceScope.importScope(type.getMemberScope());
} }
@@ -287,7 +287,7 @@ public class TopDownAnalyzer {
JetExpression importedReference = importDirective.getImportedReference(); JetExpression importedReference = importDirective.getImportedReference();
if (importedReference instanceof JetDotQualifiedExpression) { if (importedReference instanceof JetDotQualifiedExpression) {
JetDotQualifiedExpression reference = (JetDotQualifiedExpression) importedReference; 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(); JetExpression selectorExpression = reference.getSelectorExpression();
if (selectorExpression != null) { if (selectorExpression != null) {
referenceExpression = (JetSimpleNameExpression) selectorExpression; referenceExpression = (JetSimpleNameExpression) selectorExpression;
@@ -567,7 +567,7 @@ public class TopDownAnalyzer {
JetExpression delegateExpression = specifier.getDelegateExpression(); JetExpression delegateExpression = specifier.getDelegateExpression();
if (delegateExpression != null) { if (delegateExpression != null) {
JetScope scope = scopeForConstructor == null ? descriptor.getScopeForMemberResolution() : scopeForConstructor; 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()); JetType supertype = trace.getBindingContext().get(BindingContext.TYPE, specifier.getTypeReference());
if (type != null && !semanticServices.getTypeChecker().isSubtypeOf(type, supertype)) { // TODO : Convertible? if (type != null && !semanticServices.getTypeChecker().isSubtypeOf(type, supertype)) { // TODO : Convertible?
trace.getErrorHandler().typeMismatch(delegateExpression, supertype, type); trace.getErrorHandler().typeMismatch(delegateExpression, supertype, type);
@@ -643,7 +643,7 @@ public class TopDownAnalyzer {
final JetScope scopeForConstructor = getInnerScopeForConstructor(primaryConstructor, classDescriptor.getScopeForMemberResolution(), true); final JetScope scopeForConstructor = getInnerScopeForConstructor(primaryConstructor, classDescriptor.getScopeForMemberResolution(), true);
JetTypeInferrer.Services typeInferrer = semanticServices.getTypeInferrerServices(traceForConstructors, JetFlowInformationProvider.NONE); // TODO : flow JetTypeInferrer.Services typeInferrer = semanticServices.getTypeInferrerServices(traceForConstructors, JetFlowInformationProvider.NONE); // TODO : flow
for (JetClassInitializer anonymousInitializer : anonymousInitializers) { for (JetClassInitializer anonymousInitializer : anonymousInitializers) {
typeInferrer.getType(scopeForConstructor, anonymousInitializer.getBody(), true, NO_EXPECTED_TYPE); typeInferrer.getType(scopeForConstructor, anonymousInitializer.getBody(), NO_EXPECTED_TYPE);
} }
} }
else { else {
@@ -859,7 +859,7 @@ public class TopDownAnalyzer {
private void resolvePropertyInitializer(JetProperty property, PropertyDescriptor propertyDescriptor, JetExpression initializer, JetScope scope) { private void resolvePropertyInitializer(JetProperty property, PropertyDescriptor propertyDescriptor, JetExpression initializer, JetScope scope) {
JetFlowInformationProvider flowInformationProvider = classDescriptorResolver.computeFlowData(property, initializer); // TODO : flow JET-15 JetFlowInformationProvider flowInformationProvider = classDescriptorResolver.computeFlowData(property, initializer); // TODO : flow JET-15
JetTypeInferrer.Services typeInferrer = semanticServices.getTypeInferrerServices(traceForConstructors, flowInformationProvider); 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; JetType expectedType;
PropertySetterDescriptor setter = propertyDescriptor.getSetter(); PropertySetterDescriptor setter = propertyDescriptor.getSetter();
@@ -504,7 +504,7 @@ public class CallResolver {
JetExpression expression = valueArgument.getArgumentExpression(); JetExpression expression = valueArgument.getArgumentExpression();
// TODO : more attempts, with different expected types // 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) { if (type != null) {
constraintSystem.addSubtypingConstraint(type, valueParameterDescriptor.getOutType()); constraintSystem.addSubtypingConstraint(type, valueParameterDescriptor.getOutType());
} }
@@ -599,12 +599,12 @@ public class CallResolver {
for (ValueArgument valueArgument : task.getValueArguments()) { for (ValueArgument valueArgument : task.getValueArguments()) {
JetExpression argumentExpression = valueArgument.getArgumentExpression(); JetExpression argumentExpression = valueArgument.getArgumentExpression();
if (argumentExpression != null) { 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()) { 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()) { for (JetTypeProjection typeProjection : task.getTypeArguments()) {
@@ -718,7 +718,7 @@ public class CallResolver {
JetType parameterType = substitutedParameter.getOutType(); JetType parameterType = substitutedParameter.getOutType();
JetExpression argumentExpression = valueArgument.getArgumentExpression(); JetExpression argumentExpression = valueArgument.getArgumentExpression();
if (argumentExpression != null) { if (argumentExpression != null) {
JetType type = temporaryServices.getType(scope, argumentExpression, false, parameterType); JetType type = temporaryServices.getType(scope, argumentExpression, parameterType);
if (type == null) { if (type == null) {
dirty.setValue(true); dirty.setValue(true);
} }
@@ -177,8 +177,8 @@ public class JetTypeInferrer {
} }
@NotNull @NotNull
public JetType safeGetType(@NotNull final JetScope scope, @NotNull JetExpression expression, boolean preferBlock, @NotNull JetType expectedType) { public JetType safeGetType(@NotNull final JetScope scope, @NotNull JetExpression expression, @NotNull JetType expectedType) {
JetType type = getType(scope, expression, preferBlock, expectedType); JetType type = getType(scope, expression, expectedType);
if (type != null) { if (type != null) {
return type; return type;
} }
@@ -186,12 +186,12 @@ public class JetTypeInferrer {
} }
@Nullable @Nullable
public JetType getType(@NotNull final JetScope scope, @NotNull JetExpression expression, boolean preferBlock, @NotNull JetType expectedType) { public JetType getType(@NotNull final JetScope scope, @NotNull JetExpression expression, @NotNull JetType expectedType) {
return typeInferrerVisitor.getType(expression, new TypeInferenceContext(trace, scope, preferBlock, DataFlowInfo.getEmpty(), expectedType, FORBIDDEN)); return typeInferrerVisitor.getType(expression, newContext(trace, scope, DataFlowInfo.getEmpty(), expectedType, FORBIDDEN));
} }
public JetType getTypeWithNamespaces(@NotNull final JetScope scope, @NotNull JetExpression expression, boolean preferBlock) { public JetType getTypeWithNamespaces(@NotNull final JetScope scope, @NotNull JetExpression expression) {
return typeInferrerVisitorWithNamespaces.getType(expression, new TypeInferenceContext(trace, scope, preferBlock, DataFlowInfo.getEmpty(), NO_EXPECTED_TYPE, NO_EXPECTED_TYPE)); return typeInferrerVisitorWithNamespaces.getType(expression, newContext(trace, scope, DataFlowInfo.getEmpty(), NO_EXPECTED_TYPE, NO_EXPECTED_TYPE));
} }
public CallResolver getCallResolver() { public CallResolver getCallResolver() {
@@ -275,8 +275,8 @@ public class JetTypeInferrer {
final boolean blockBody = function.hasBlockBody(); final boolean blockBody = function.hasBlockBody();
final TypeInferenceContext context = final TypeInferenceContext context =
blockBody blockBody
? new TypeInferenceContext(trace, functionInnerScope, function.hasBlockBody(), dataFlowInfo, NO_EXPECTED_TYPE, expectedReturnType) ? newContext(trace, functionInnerScope, dataFlowInfo, NO_EXPECTED_TYPE, expectedReturnType)
: new TypeInferenceContext(trace, functionInnerScope, function.hasBlockBody(), dataFlowInfo, expectedReturnType, FORBIDDEN); : newContext(trace, functionInnerScope, dataFlowInfo, expectedReturnType, FORBIDDEN);
if (function instanceof JetFunctionLiteralExpression) { if (function instanceof JetFunctionLiteralExpression) {
JetFunctionLiteralExpression functionLiteralExpression = (JetFunctionLiteralExpression) function; JetFunctionLiteralExpression functionLiteralExpression = (JetFunctionLiteralExpression) function;
@@ -363,7 +363,7 @@ public class JetTypeInferrer {
JetExpression bodyExpression = function.getBodyExpression(); JetExpression bodyExpression = function.getBodyExpression();
assert bodyExpression != null; assert bodyExpression != null;
JetScope functionInnerScope = FunctionDescriptorUtil.getFunctionInnerScope(outerScope, functionDescriptor, trace); 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<JetExpression> returnedExpressions = new ArrayList<JetExpression>(); Collection<JetExpression> returnedExpressions = new ArrayList<JetExpression>();
Collection<JetElement> elementsReturningUnit = new ArrayList<JetElement>(); Collection<JetElement> elementsReturningUnit = new ArrayList<JetElement>();
flowInformationProvider.collectReturnedInformation(function.asElement(), returnedExpressions, elementsReturningUnit); flowInformationProvider.collectReturnedInformation(function.asElement(), returnedExpressions, elementsReturningUnit);
@@ -387,7 +387,7 @@ public class JetTypeInferrer {
} }
TypeInferrerVisitorWithWritableScope blockLevelVisitor = newTypeInferrerVisitorWithWritableScope(scope); 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; JetType result = null;
for (Iterator<? extends JetElement> iterator = block.iterator(); iterator.hasNext(); ) { for (Iterator<? extends JetElement> iterator = block.iterator(); iterator.hasNext(); ) {
@@ -401,13 +401,13 @@ public class JetTypeInferrer {
TemporaryBindingTrace temporaryTraceExpectingUnit = TemporaryBindingTrace.create(trace); TemporaryBindingTrace temporaryTraceExpectingUnit = TemporaryBindingTrace.create(trace);
final boolean[] mismatch = new boolean[1]; final boolean[] mismatch = new boolean[1];
BindingTraceAdapter errorInterceptingTrace = makeTraceInterceptingTypeMismatch(temporaryTraceExpectingUnit, statementExpression, mismatch); 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); result = blockLevelVisitor.getType(statementExpression, newContext);
if (mismatch[0]) { if (mismatch[0]) {
TemporaryBindingTrace temporaryTraceNoExpectedType = TemporaryBindingTrace.create(trace); TemporaryBindingTrace temporaryTraceNoExpectedType = TemporaryBindingTrace.create(trace);
mismatch[0] = false; mismatch[0] = false;
BindingTraceAdapter interceptingTrace = makeTraceInterceptingTypeMismatch(temporaryTraceNoExpectedType, statementExpression, mismatch); 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); result = blockLevelVisitor.getType(statementExpression, newContext);
if (mismatch[0]) { if (mismatch[0]) {
temporaryTraceExpectingUnit.commit(); temporaryTraceExpectingUnit.commit();
@@ -419,7 +419,7 @@ public class JetTypeInferrer {
} }
else { 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); result = blockLevelVisitor.getType(statementExpression, newContext);
} }
} }
@@ -432,14 +432,14 @@ public class JetTypeInferrer {
newDataFlowInfo = context.dataFlowInfo; newDataFlowInfo = context.dataFlowInfo;
} }
if (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? blockLevelVisitor.resetResult(); // TODO : maybe it's better to recreate the visitors with the same scope?
} }
return result; 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) { return new BindingTraceAdapter(trace) {
@NotNull @NotNull
@Override @Override
@@ -447,7 +447,7 @@ public class JetTypeInferrer {
return new CompositeErrorHandler(super.getErrorHandler(), new ErrorHandler() { return new CompositeErrorHandler(super.getErrorHandler(), new ErrorHandler() {
@Override @Override
public void typeMismatch(@NotNull JetExpression expression, @NotNull JetType expectedType, @NotNull JetType actualType) { public void typeMismatch(@NotNull JetExpression expression, @NotNull JetType expectedType, @NotNull JetType actualType) {
if (expression == expression) { if (expression == expressionToWatch) {
mismatchFound[0] = true; mismatchFound[0] = true;
} }
} }
@@ -555,24 +555,47 @@ public class JetTypeInferrer {
COERCION_TO_UNIT 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 { private class TypeInferenceContext {
public final BindingTrace trace; public final BindingTrace trace;
public final TypeResolver typeResolver; public final TypeResolver typeResolver;
public final ClassDescriptorResolver classDescriptorResolver; public final ClassDescriptorResolver classDescriptorResolver;
public final JetScope scope; public final JetScope scope;
public final JetScope scopeForTopLevelCall;
public final Services services; public final Services services;
public final boolean preferBlock;
public final DataFlowInfo dataFlowInfo; public final DataFlowInfo dataFlowInfo;
public final JetType expectedType; public final JetType expectedType;
public final JetType expectedReturnType; public final JetType expectedReturnType;
@Deprecated // Only factory methods
private TypeInferenceContext( private TypeInferenceContext(
@NotNull BindingTrace trace, @NotNull BindingTrace trace,
@NotNull JetScope scope, @NotNull JetScope scope,
boolean preferBlock, @NotNull JetScope scopeForTopLevelCall,
@NotNull DataFlowInfo dataFlowInfo, @NotNull DataFlowInfo dataFlowInfo,
@NotNull JetType expectedType, @NotNull JetType expectedType,
@NotNull JetType expectedReturnType) { @NotNull JetType expectedReturnType) {
@@ -580,32 +603,44 @@ public class JetTypeInferrer {
this.typeResolver = new TypeResolver(semanticServices, trace, true); this.typeResolver = new TypeResolver(semanticServices, trace, true);
this.classDescriptorResolver = semanticServices.getClassDescriptorResolver(trace); this.classDescriptorResolver = semanticServices.getClassDescriptorResolver(trace);
this.scope = scope; this.scope = scope;
this.scopeForTopLevelCall = scopeForTopLevelCall;
this.services = getServices(trace); this.services = getServices(trace);
this.preferBlock = preferBlock;
this.dataFlowInfo = dataFlowInfo; this.dataFlowInfo = dataFlowInfo;
this.expectedType = expectedType; this.expectedType = expectedType;
this.expectedReturnType = expectedReturnType; this.expectedReturnType = expectedReturnType;
} }
public TypeInferenceContext replaceDataFlowInfo(DataFlowInfo newDataFlowInfo) { 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) { public TypeInferenceContext replaceExpectedType(@Nullable JetType newExpectedType) {
if (newExpectedType == null) return replaceExpectedType(NO_EXPECTED_TYPE); if (newExpectedType == null) return replaceExpectedType(NO_EXPECTED_TYPE);
if (expectedType == newExpectedType) return this; 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) { public TypeInferenceContext replaceExpectedReturnType(@Nullable JetType newExpectedReturnType) {
if (newExpectedReturnType == null) return replaceExpectedReturnType(NO_EXPECTED_TYPE); if (newExpectedReturnType == null) return replaceExpectedReturnType(NO_EXPECTED_TYPE);
if (expectedReturnType == newExpectedReturnType) return this; 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) { public TypeInferenceContext replaceBindingTrace(@NotNull BindingTrace newTrace) {
if (newTrace == trace) return this; 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; 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 @Nullable
public final JetType getType(@NotNull JetExpression expression, TypeInferenceContext context) { public final JetType getType(@NotNull JetExpression expression, TypeInferenceContext context) {
if (context.trace.get(BindingContext.PROCESSED, expression)) { if (context.trace.get(BindingContext.PROCESSED, expression)) {
@@ -662,6 +688,11 @@ public class JetTypeInferrer {
return result; 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() { public void resetResult() {
// result = null; // result = null;
resultDataFlowInfo = null; resultDataFlowInfo = null;
@@ -796,10 +827,6 @@ public class JetTypeInferrer {
@Override @Override
public JetType visitFunctionLiteralExpression(JetFunctionLiteralExpression expression, TypeInferenceContext context) { public JetType visitFunctionLiteralExpression(JetFunctionLiteralExpression expression, TypeInferenceContext context) {
JetFunctionLiteral functionLiteral = expression.getFunctionLiteral(); 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(); JetTypeReference receiverTypeRef = functionLiteral.getReceiverTypeRef();
final JetType receiverType; final JetType receiverType;
@@ -888,7 +915,7 @@ public class JetTypeInferrer {
@Override @Override
public JetType visitParenthesizedExpression(JetParenthesizedExpression expression, TypeInferenceContext context) { 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 @Override
@@ -961,7 +988,7 @@ public class JetTypeInferrer {
public JetType visitThrowExpression(JetThrowExpression expression, TypeInferenceContext context) { public JetType visitThrowExpression(JetThrowExpression expression, TypeInferenceContext context) {
JetExpression thrownExpression = expression.getThrownExpression(); JetExpression thrownExpression = expression.getThrownExpression();
if (thrownExpression != null) { 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 // TODO : check that it inherits Throwable
} }
return context.services.checkType(JetStandardClasses.getNothingType(), expression, context); return context.services.checkType(JetStandardClasses.getNothingType(), expression, context);
@@ -977,7 +1004,7 @@ public class JetTypeInferrer {
JetType returnedType = JetStandardClasses.getUnitType(); JetType returnedType = JetStandardClasses.getUnitType();
if (returnedExpression != null) { if (returnedExpression != null) {
getType(context.scope, returnedExpression, false, context.replaceExpectedType(context.expectedReturnType)); getType(returnedExpression, context.replaceExpectedType(context.expectedReturnType).replaceScope(context.scope));
} }
else { else {
if (context.expectedReturnType != NO_EXPECTED_TYPE && !JetStandardClasses.isUnit(context.expectedReturnType)) { if (context.expectedReturnType != NO_EXPECTED_TYPE && !JetStandardClasses.isUnit(context.expectedReturnType)) {
@@ -1000,7 +1027,7 @@ public class JetTypeInferrer {
@Override @Override
public JetType visitBinaryWithTypeRHSExpression(JetBinaryExpressionWithTypeRHS expression, TypeInferenceContext context) { public JetType visitBinaryWithTypeRHSExpression(JetBinaryExpressionWithTypeRHS expression, TypeInferenceContext context) {
IElementType operationType = expression.getOperationSign().getReferencedNameElementType(); 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(); JetTypeReference right = expression.getRight();
JetType result = null; JetType result = null;
if (right != null) { if (right != null) {
@@ -1051,7 +1078,7 @@ public class JetTypeInferrer {
List<JetExpression> entries = expression.getEntries(); List<JetExpression> entries = expression.getEntries();
List<JetType> types = new ArrayList<JetType>(); List<JetType> types = new ArrayList<JetType>();
for (JetExpression entry : entries) { 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)) { if (context.expectedType != NO_EXPECTED_TYPE && JetStandardClasses.isTupleType(context.expectedType)) {
List<JetType> enrichedTypes = context.services.checkArgumentTypes(types, entries, context.expectedType.getArguments(), context); List<JetType> 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 // TODO :change scope according to the bound value in the when header
final JetExpression subjectExpression = expression.getSubjectExpression(); 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; final VariableDescriptor variableDescriptor = subjectExpression != null ? context.services.getVariableDescriptorFromSimpleName(subjectExpression, context) : null;
// TODO : exhaustive patterns // TODO : exhaustive patterns
@@ -1215,7 +1242,7 @@ public class JetTypeInferrer {
} }
JetExpression bodyExpression = whenEntry.getExpression(); JetExpression bodyExpression = whenEntry.getExpression();
if (bodyExpression != null) { if (bodyExpression != null) {
JetType type = getTypeWithNewDataFlowInfo(scopeToExtend, bodyExpression, true, newDataFlowInfo, contextWithExpectedType); JetType type = getTypeWithNewScopeAndDataFlowInfo(scopeToExtend, bodyExpression, newDataFlowInfo, contextWithExpectedType);
if (type != null) { if (type != null) {
expressionTypes.add(type); expressionTypes.add(type);
} }
@@ -1241,7 +1268,7 @@ public class JetTypeInferrer {
// JetScope compositeScope = new ScopeWithReceiver(context.scope, subjectType, semanticServices.getTypeChecker()); // JetScope compositeScope = new ScopeWithReceiver(context.scope, subjectType, semanticServices.getTypeChecker());
if (callSuffixExpression != null) { if (callSuffixExpression != null) {
// JetType selectorReturnType = getType(compositeScope, callSuffixExpression, false, context); // 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); ensureBooleanResultWithCustomSubject(callSuffixExpression, selectorReturnType, "This expression", context);
context.services.checkNullSafety(subjectType, condition.getOperationTokenNode(), getCalleeFunctionDescriptor(callSuffixExpression, context)); context.services.checkNullSafety(subjectType, condition.getOperationTokenNode(), getCalleeFunctionDescriptor(callSuffixExpression, context));
} }
@@ -1314,9 +1341,12 @@ public class JetTypeInferrer {
@Override @Override
public void visitDecomposerPattern(JetDecomposerPattern pattern) { 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 @Override
@@ -1328,7 +1358,7 @@ public class JetTypeInferrer {
public void visitExpressionPattern(JetExpressionPattern pattern) { public void visitExpressionPattern(JetExpressionPattern pattern) {
JetExpression expression = pattern.getExpression(); JetExpression expression = pattern.getExpression();
if (expression != null) { if (expression != null) {
JetType type = getType(scopeToExtend, expression, false, context); JetType type = getType(expression, context.replaceScope(scopeToExtend));
checkTypeCompatibility(type, subjectType, pattern); checkTypeCompatibility(type, subjectType, pattern);
} }
} }
@@ -1388,7 +1418,7 @@ public class JetTypeInferrer {
if (catchBody != null) { if (catchBody != null) {
WritableScope catchScope = newWritableScopeImpl(context.scope, context.trace).setDebugName("Catch scope"); WritableScope catchScope = newWritableScopeImpl(context.scope, context.trace).setDebugName("Catch scope");
catchScope.addVariableDescriptor(variableDescriptor); catchScope.addVariableDescriptor(variableDescriptor);
JetType type = getType(catchScope, catchBody, true, context); JetType type = getType(catchBody, context.replaceScope(catchScope));
if (type != null) { if (type != null) {
types.add(type); types.add(type);
} }
@@ -1397,12 +1427,12 @@ public class JetTypeInferrer {
} }
if (finallyBlock != null) { if (finallyBlock != null) {
types.clear(); // Do not need the list for the check, but need the code above to typecheck catch bodies 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) { if (type != null) {
types.add(type); types.add(type);
} }
} }
JetType type = getType(context.scope, tryBlock, true, context); JetType type = getType(tryBlock, context.replaceScope(context.scope));
if (type != null) { if (type != null) {
types.add(type); types.add(type);
} }
@@ -1429,7 +1459,7 @@ public class JetTypeInferrer {
if (elseBranch == null) { if (elseBranch == null) {
if (thenBranch != 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)) { if (type != null && JetStandardClasses.isNothing(type)) {
resultDataFlowInfo = elseInfo; resultDataFlowInfo = elseInfo;
// resultScope = elseScope; // resultScope = elseScope;
@@ -1439,15 +1469,15 @@ public class JetTypeInferrer {
return null; return null;
} }
if (thenBranch == 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)) { if (type != null && JetStandardClasses.isNothing(type)) {
resultDataFlowInfo = thenInfo; resultDataFlowInfo = thenInfo;
// resultScope = thenScope; // resultScope = thenScope;
} }
return context.services.checkType(JetStandardClasses.getUnitType(), expression, contextWithExpectedType); return context.services.checkType(JetStandardClasses.getUnitType(), expression, contextWithExpectedType);
} }
JetType thenType = getTypeWithNewDataFlowInfo(thenScope, thenBranch, true, thenInfo, contextWithExpectedType); JetType thenType = getTypeWithNewScopeAndDataFlowInfo(thenScope, thenBranch, thenInfo, contextWithExpectedType);
JetType elseType = getTypeWithNewDataFlowInfo(context.scope, elseBranch, true, elseInfo, contextWithExpectedType); JetType elseType = getTypeWithNewScopeAndDataFlowInfo(context.scope, elseBranch, elseInfo, contextWithExpectedType);
JetType result; JetType result;
if (thenType == null) { if (thenType == null) {
@@ -1610,7 +1640,7 @@ public class JetTypeInferrer {
private void checkCondition(@NotNull JetScope scope, @Nullable JetExpression condition, TypeInferenceContext context) { private void checkCondition(@NotNull JetScope scope, @Nullable JetExpression condition, TypeInferenceContext context) {
if (condition != null) { if (condition != null) {
JetType conditionType = getType(scope, condition, false, context); JetType conditionType = getType(condition, context.replaceScope(scope));
if (conditionType != null && !isBoolean(conditionType)) { if (conditionType != null && !isBoolean(conditionType)) {
context.trace.getErrorHandler().genericError(condition.getNode(), "Condition must be of type Boolean, but was of type " + 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) { if (body != null) {
WritableScopeImpl scopeToExtend = newWritableScopeImpl(context.scope, context.trace).setDebugName("Scope extended in while's condition"); 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); 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)) { if (!flowInformationProvider.isBreakable(expression)) {
// resultScope = newWritableScopeImpl(); // resultScope = newWritableScopeImpl();
@@ -1649,7 +1679,7 @@ public class JetTypeInferrer {
context.services.getBlockReturnedTypeWithWritableScope(writableScope, function.getFunctionLiteral().getBodyExpression().getStatements(), CoercionStrategy.NO_COERCION, context); context.services.getBlockReturnedTypeWithWritableScope(writableScope, function.getFunctionLiteral().getBodyExpression().getStatements(), CoercionStrategy.NO_COERCION, context);
context.trace.record(BindingContext.BLOCK, function); context.trace.record(BindingContext.BLOCK, function);
} else { } else {
getType(context.scope, body, true, context); getType(body, context.replaceScope(context.scope));
} }
} }
else if (body != null) { else if (body != null) {
@@ -1677,7 +1707,7 @@ public class JetTypeInferrer {
JetExpression loopRange = expression.getLoopRange(); JetExpression loopRange = expression.getLoopRange();
JetType loopRangeType = null; JetType loopRangeType = null;
if (loopRange != null) { if (loopRange != null) {
loopRangeType = getType(context.scope, loopRange, false, context); loopRangeType = getType(loopRange, context.replaceScope(context.scope));
} }
JetType expectedParameterType = null; JetType expectedParameterType = null;
if (loopRangeType != null) { if (loopRangeType != null) {
@@ -1709,7 +1739,7 @@ public class JetTypeInferrer {
JetExpression body = expression.getBody(); JetExpression body = expression.getBody();
if (body != null) { if (body != null) {
getType(loopScope, body, true, context); // TODO getType(body, context.replaceScope(loopScope));
} }
return context.services.checkType(JetStandardClasses.getUnitType(), expression, contextWithExpectedType); return context.services.checkType(JetStandardClasses.getUnitType(), expression, contextWithExpectedType);
@@ -1794,7 +1824,7 @@ public class JetTypeInferrer {
// TODO : functions as values // TODO : functions as values
JetExpression selectorExpression = expression.getSelectorExpression(); JetExpression selectorExpression = expression.getSelectorExpression();
JetExpression receiverExpression = expression.getReceiverExpression(); 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 (receiverType == null) return null;
if (selectorExpression == 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); return context.services.callResolver.resolveCall(context.scope, receiverType, (JetCallExpression) selectorExpression, context.expectedType);
} }
else if (selectorExpression instanceof JetSimpleNameExpression) { else if (selectorExpression instanceof JetSimpleNameExpression) {
// JetScope compositeScope = new ScopeWithReceiver(context.scope, receiverType, semanticServices.getTypeChecker());
JetScope scope = receiverType != null ? receiverType.getMemberScope() : context.scope; 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 // 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); context.trace.getErrorHandler().genericError(selectorExpression.getNode(), "Unsupported selector element type: " + selectorExpression);
} }
@@ -1938,7 +1975,7 @@ public class JetTypeInferrer {
@Override @Override
public JetType visitIsExpression(JetIsExpression expression, TypeInferenceContext contextWithExpectedType) { public JetType visitIsExpression(JetIsExpression expression, TypeInferenceContext contextWithExpectedType) {
TypeInferenceContext context = contextWithExpectedType.replaceExpectedType(NO_EXPECTED_TYPE); 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(); JetPattern pattern = expression.getPattern();
if (pattern != null && knownType != null) { if (pattern != null && knownType != null) {
WritableScopeImpl scopeToExtend = newWritableScopeImpl(context.scope, context.trace).setDebugName("Scope extended in 'is'"); 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"); context.trace.getErrorHandler().genericError(operationSign.getNode(), "Unknown unary operation");
return null; 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; if (receiverType == null) return null;
FunctionDescriptor functionDescriptor = context.services.callResolver.resolveCallWithGivenName( FunctionDescriptor functionDescriptor = context.services.callResolver.resolveCallWithGivenName(
@@ -2040,9 +2077,9 @@ public class JetTypeInferrer {
else if (equalsOperations.contains(operationType)) { else if (equalsOperations.contains(operationType)) {
String name = "equals"; String name = "equals";
if (right != null) { if (right != null) {
JetType leftType = getType(context.scope, left, false, context); JetType leftType = getType(left, context.replaceScope(context.scope));
if (leftType != null) { if (leftType != null) {
JetType rightType = getType(context.scope, right, false, context); JetType rightType = getType(right, context.replaceScope(context.scope));
if (rightType != null) { if (rightType != null) {
OverloadResolutionResult resolutionResult = context.services.callResolver.resolveExactSignature( OverloadResolutionResult resolutionResult = context.services.callResolver.resolveExactSignature(
context.scope, leftType, "equals", context.scope, leftType, "equals",
@@ -2086,11 +2123,11 @@ public class JetTypeInferrer {
result = semanticServices.getStandardLibrary().getBooleanType(); result = semanticServices.getStandardLibrary().getBooleanType();
} }
else if (operationType == JetTokens.ANDAND || operationType == JetTokens.OROR) { 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 ||"); 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 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 ||"); 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)) { if (leftType != null && !isBoolean(leftType)) {
context.trace.getErrorHandler().typeMismatch(left, semanticServices.getStandardLibrary().getBooleanType(), leftType); context.trace.getErrorHandler().typeMismatch(left, semanticServices.getStandardLibrary().getBooleanType(), leftType);
} }
@@ -2100,8 +2137,8 @@ public class JetTypeInferrer {
result = semanticServices.getStandardLibrary().getBooleanType(); result = semanticServices.getStandardLibrary().getBooleanType();
} }
else if (operationType == JetTokens.ELVIS) { else if (operationType == JetTokens.ELVIS) {
JetType leftType = getType(context.scope, left, false, context); JetType leftType = getType(left, context.replaceScope(context.scope));
JetType rightType = right == null ? null : getType(context.scope, right, false, contextWithExpectedType); JetType rightType = right == null ? null : getType(right, contextWithExpectedType.replaceScope(context.scope));
if (leftType != null) { if (leftType != null) {
if (!leftType.isNullable()) { if (!leftType.isNullable()) {
context.trace.getErrorHandler().genericWarning(left.getNode(), "Elvis operator (?:) is always returns the left operand of non-nullable type " + leftType); 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) { private void checkInExpression(JetSimpleNameExpression operationSign, JetExpression left, JetExpression right, TypeInferenceContext context) {
String name = "contains"; 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( FunctionDescriptor functionDescriptor = context.services.callResolver.resolveCallWithGivenName(
context.scope, context.scope,
CallMaker.makeCall(operationSign, Collections.singletonList(left)), CallMaker.makeCall(operationSign, Collections.singletonList(left)),
@@ -2136,9 +2173,9 @@ public class JetTypeInferrer {
JetExpression right = expression.getRight(); JetExpression right = expression.getRight();
// TODO : duplicated effort for == and != // 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) { if (leftType != null && right != null) {
JetType rightType = getType(context.scope, right, false, context); JetType rightType = getType(right, context.replaceScope(context.scope));
if (rightType != null) { if (rightType != null) {
JetType intersect = TypeUtils.intersect(semanticServices.getTypeChecker(), new HashSet<JetType>(Arrays.asList(leftType, rightType))); JetType intersect = TypeUtils.intersect(semanticServices.getTypeChecker(), new HashSet<JetType>(Arrays.asList(leftType, rightType)));
@@ -2181,26 +2218,11 @@ public class JetTypeInferrer {
return semanticServices.getTypeChecker().isConvertibleTo(type, semanticServices.getStandardLibrary().getBooleanType()); return semanticServices.getTypeChecker().isConvertibleTo(type, semanticServices.getStandardLibrary().getBooleanType());
} }
@Nullable
protected List<JetType> getTypes(JetScope scope, List<JetExpression> indexExpressions, TypeInferenceContext context) {
List<JetType> argumentTypes = new ArrayList<JetType>();
TypeInferenceContext newContext = new TypeInferenceContext(context.trace, scope, 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 @Override
public JetType visitArrayAccessExpression(JetArrayAccessExpression expression, TypeInferenceContext contextWithExpectedType) { public JetType visitArrayAccessExpression(JetArrayAccessExpression expression, TypeInferenceContext contextWithExpectedType) {
TypeInferenceContext context = contextWithExpectedType.replaceExpectedType(NO_EXPECTED_TYPE); TypeInferenceContext context = contextWithExpectedType.replaceExpectedType(NO_EXPECTED_TYPE);
JetExpression arrayExpression = expression.getArrayExpression(); JetExpression arrayExpression = expression.getArrayExpression();
JetType receiverType = getType(context.scope, arrayExpression, false, context); JetType receiverType = getType(arrayExpression, context.replaceScope(context.scope));
if (receiverType != null) { if (receiverType != null) {
FunctionDescriptor functionDescriptor = context.services.callResolver.resolveCallWithGivenName( FunctionDescriptor functionDescriptor = context.services.callResolver.resolveCallWithGivenName(
@@ -2219,7 +2241,7 @@ public class JetTypeInferrer {
@Nullable @Nullable
protected JetType getTypeForBinaryCall(JetScope scope, String name, TypeInferenceContext context, JetBinaryExpression binaryExpression) { 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( FunctionDescriptor functionDescriptor = context.services.callResolver.resolveCallWithGivenName(
scope, scope,
CallMaker.makeCall(binaryExpression), CallMaker.makeCall(binaryExpression),
@@ -2267,7 +2289,7 @@ public class JetTypeInferrer {
public void visitStringTemplateEntryWithExpression(JetStringTemplateEntryWithExpression entry) { public void visitStringTemplateEntryWithExpression(JetStringTemplateEntryWithExpression entry) {
JetExpression entryExpression = entry.getExpression(); JetExpression entryExpression = entry.getExpression();
if (entryExpression != null) { if (entryExpression != null) {
getType(context.scope, entryExpression, true, context); getType(entryExpression, context.replaceScope(context.scope));
} }
value[0] = CompileTimeConstantResolver.OUT_OF_RANGE; value[0] = CompileTimeConstantResolver.OUT_OF_RANGE;
} }
@@ -2367,7 +2389,7 @@ public class JetTypeInferrer {
JetExpression initializer = property.getInitializer(); JetExpression initializer = property.getInitializer();
if (property.getPropertyTypeRef() != null && initializer != null) { if (property.getPropertyTypeRef() != null && initializer != null) {
JetType outType = propertyDescriptor.getOutType(); 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 && // if (outType != null &&
// initializerType != null && // initializerType != null &&
// !semanticServices.getTypeChecker().isConvertibleTo(initializerType, outType)) { // !semanticServices.getTypeChecker().isConvertibleTo(initializerType, outType)) {
@@ -2433,9 +2455,9 @@ public class JetTypeInferrer {
JetArrayAccessExpression arrayAccessExpression = (JetArrayAccessExpression) deparenthesized; JetArrayAccessExpression arrayAccessExpression = (JetArrayAccessExpression) deparenthesized;
return resolveArrayAccessToLValue(arrayAccessExpression, right, expression.getOperationReference(), context); 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) { if (right != null) {
JetType rightType = getType(scope, right, false, context.replaceExpectedType(leftType)); JetType rightType = getType(right, context.replaceExpectedType(leftType).replaceScope(scope));
// if (rightType != null && // if (rightType != null &&
// leftType != null && // leftType != null &&
// !semanticServices.getTypeChecker().isConvertibleTo(rightType, leftType)) { // !semanticServices.getTypeChecker().isConvertibleTo(rightType, leftType)) {
@@ -2446,7 +2468,7 @@ public class JetTypeInferrer {
} }
private JetType resolveArrayAccessToLValue(JetArrayAccessExpression arrayAccessExpression, JetExpression rightHandSide, JetSimpleNameExpression operationSign, TypeInferenceContext context) { 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; if (receiverType == null) return null;
// //
Call call = CallMaker.makeCall(arrayAccessExpression, rightHandSide); Call call = CallMaker.makeCall(arrayAccessExpression, rightHandSide);
+46 -67
View File
@@ -535,12 +535,9 @@ JetFile: ControlStructures.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
BODY BODY
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiElement(RBRACE)('}')
BLOCK
<empty list>
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
WHILE WHILE
PsiElement(while)('while') PsiElement(while)('while')
@@ -552,24 +549,18 @@ JetFile: ControlStructures.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
BODY BODY
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiElement(RBRACE)('}')
BLOCK
<empty list>
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
DO_WHILE DO_WHILE
PsiElement(do)('do') PsiElement(do)('do')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
BODY BODY
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n\n ')
PsiWhiteSpace('\n\n ') PsiElement(RBRACE)('}')
BLOCK
<empty list>
PsiElement(RBRACE)('}')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiElement(while)('while') PsiElement(while)('while')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
@@ -625,12 +616,9 @@ JetFile: ControlStructures.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
BODY BODY
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiElement(RBRACE)('}')
BLOCK
<empty list>
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
FOR FOR
PsiElement(for)('for') PsiElement(for)('for')
@@ -647,15 +635,13 @@ JetFile: ControlStructures.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
BODY BODY
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') REFERENCE_EXPRESSION
BLOCK PsiElement(IDENTIFIER)('b')
REFERENCE_EXPRESSION PsiWhiteSpace('\n ')
PsiElement(IDENTIFIER)('b') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
FOR FOR
PsiElement(for)('for') PsiElement(for)('for')
@@ -714,15 +700,13 @@ JetFile: ControlStructures.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
BODY BODY
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') REFERENCE_EXPRESSION
BLOCK PsiElement(IDENTIFIER)('b')
REFERENCE_EXPRESSION PsiWhiteSpace('\n ')
PsiElement(IDENTIFIER)('b') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
WHILE WHILE
PsiElement(while)('while') PsiElement(while)('while')
@@ -756,12 +740,9 @@ JetFile: ControlStructures.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
BODY BODY
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiElement(RBRACE)('}')
BLOCK
<empty list>
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
IF IF
PsiElement(if)('if') PsiElement(if)('if')
@@ -980,24 +961,22 @@ JetFile: ControlStructures.jet
PsiElement(do)('do') PsiElement(do)('do')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
BODY BODY
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiElement(SEMICOLON)(';')
BLOCK PsiElement(SEMICOLON)(';')
PsiElement(SEMICOLON)(';') PsiElement(SEMICOLON)(';')
PsiElement(SEMICOLON)(';') REFERENCE_EXPRESSION
PsiElement(SEMICOLON)(';') PsiElement(IDENTIFIER)('foo')
REFERENCE_EXPRESSION PsiElement(SEMICOLON)(';')
PsiElement(IDENTIFIER)('foo') REFERENCE_EXPRESSION
PsiElement(SEMICOLON)(';') PsiElement(IDENTIFIER)('bar')
REFERENCE_EXPRESSION PsiElement(SEMICOLON)(';')
PsiElement(IDENTIFIER)('bar') PsiElement(SEMICOLON)(';')
PsiElement(SEMICOLON)(';') PsiElement(SEMICOLON)(';')
PsiElement(SEMICOLON)(';') PsiElement(SEMICOLON)(';')
PsiElement(SEMICOLON)(';') PsiWhiteSpace(' ')
PsiElement(SEMICOLON)(';') PsiElement(RBRACE)('}')
PsiWhiteSpace(' ')
PsiElement(RBRACE)('}')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiElement(while)('while') PsiElement(while)('while')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
+32 -34
View File
@@ -23,37 +23,35 @@ JetFile: Expressions_ERR.jet
PsiElement(else)('else') PsiElement(else)('else')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
ELSE ELSE
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') REFERENCE_EXPRESSION
BLOCK PsiElement(IDENTIFIER)('dfsd')
REFERENCE_EXPRESSION PsiWhiteSpace('\n ')
PsiElement(IDENTIFIER)('dfsd') PsiErrorElement:Expecting an element
PsiWhiteSpace('\n ') PsiElement(RPAR)(')')
PsiErrorElement:Expecting an element PsiElement(SEMICOLON)(';')
PsiElement(RPAR)(')') PsiElement(SEMICOLON)(';')
PsiElement(SEMICOLON)(';') PsiElement(SEMICOLON)(';')
PsiElement(SEMICOLON)(';') PsiErrorElement:Expecting an element
PsiElement(SEMICOLON)(';') PsiElement(RPAR)(')')
PsiErrorElement:Expecting an element PsiElement(SEMICOLON)(';')
PsiElement(RPAR)(')') PsiElement(SEMICOLON)(';')
PsiElement(SEMICOLON)(';') PsiElement(SEMICOLON)(';')
PsiElement(SEMICOLON)(';') PsiErrorElement:Expecting an element
PsiElement(SEMICOLON)(';') PsiElement(BAD_CHARACTER)('~')
PsiErrorElement:Expecting an element PsiElement(SEMICOLON)(';')
PsiElement(BAD_CHARACTER)('~') PsiElement(SEMICOLON)(';')
PsiElement(SEMICOLON)(';') PsiElement(SEMICOLON)(';')
PsiElement(SEMICOLON)(';') PsiWhiteSpace('\n ')
PsiElement(SEMICOLON)(';') REFERENCE_EXPRESSION
PsiWhiteSpace('\n ') PsiElement(IDENTIFIER)('srgsdfg')
REFERENCE_EXPRESSION PsiWhiteSpace('\n\n ')
PsiElement(IDENTIFIER)('srgsdfg') PsiErrorElement:Expecting an element
PsiWhiteSpace('\n\n ') PsiElement(BAD_CHARACTER)('~')
PsiErrorElement:Expecting an element PsiWhiteSpace('\n\n ')
PsiElement(BAD_CHARACTER)('~') PsiErrorElement:Expecting an element
PsiWhiteSpace('\n\n ') PsiElement(RBRACKET)(']')
PsiErrorElement:Expecting an element PsiWhiteSpace('\n')
PsiElement(RBRACKET)(']') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')
+43 -51
View File
@@ -16,34 +16,30 @@ JetFile: IfWithPropery.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
THEN THEN
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PROPERTY
BLOCK PsiElement(var)('var')
PROPERTY PsiWhiteSpace(' ')
PsiElement(var)('var') PsiElement(IDENTIFIER)('f')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('f') PsiElement(EQ)('=')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiElement(EQ)('=') REFERENCE_EXPRESSION
PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('a')
REFERENCE_EXPRESSION PsiElement(SEMICOLON)(';')
PsiElement(IDENTIFIER)('a') REFERENCE_EXPRESSION
PsiElement(SEMICOLON)(';') PsiElement(IDENTIFIER)('a')
REFERENCE_EXPRESSION PsiElement(RBRACE)('}')
PsiElement(IDENTIFIER)('a')
PsiElement(RBRACE)('}')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiElement(else)('else') PsiElement(else)('else')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
ELSE ELSE
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') NULL
BLOCK PsiElement(null)('null')
NULL PsiElement(RBRACE)('}')
PsiElement(null)('null')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n') PsiWhiteSpace('\n')
PROPERTY PROPERTY
PsiElement(val)('val') PsiElement(val)('val')
@@ -61,34 +57,30 @@ JetFile: IfWithPropery.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
THEN THEN
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') PROPERTY
BLOCK PsiElement(var)('var')
PROPERTY PsiWhiteSpace(' ')
PsiElement(var)('var') PsiElement(IDENTIFIER)('f')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('f') PsiElement(EQ)('=')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiElement(EQ)('=') REFERENCE_EXPRESSION
PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('a')
REFERENCE_EXPRESSION PsiElement(SEMICOLON)(';')
PsiElement(IDENTIFIER)('a') PsiWhiteSpace('\n ')
PsiElement(SEMICOLON)(';') REFERENCE_EXPRESSION
PsiWhiteSpace('\n ') PsiElement(IDENTIFIER)('a')
REFERENCE_EXPRESSION PsiWhiteSpace('\n')
PsiElement(IDENTIFIER)('a') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiElement(else)('else') PsiElement(else)('else')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
ELSE ELSE
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') NULL
BLOCK PsiElement(null)('null')
NULL PsiElement(RBRACE)('}')
PsiElement(null)('null')
PsiElement(RBRACE)('}')
+3 -6
View File
@@ -115,12 +115,9 @@ JetFile: RootNamespace.jet
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiElement(DOUBLE_ARROW)('=>') PsiElement(DOUBLE_ARROW)('=>')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiElement(RBRACE)('}')
BLOCK
<empty list>
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
File diff suppressed because it is too large Load Diff
+38 -40
View File
@@ -288,46 +288,44 @@ JetFile: BitArith.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
BODY BODY
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') BINARY_EXPRESSION
BLOCK REFERENCE_EXPRESSION
BINARY_EXPRESSION PsiElement(IDENTIFIER)('result')
REFERENCE_EXPRESSION PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('result') OPERATION_REFERENCE
PsiWhiteSpace(' ') PsiElement(PLUSEQ)('+=')
OPERATION_REFERENCE PsiWhiteSpace(' ')
PsiElement(PLUSEQ)('+=') BINARY_EXPRESSION
PsiWhiteSpace(' ') REFERENCE_EXPRESSION
BINARY_EXPRESSION PsiElement(IDENTIFIER)('x')
REFERENCE_EXPRESSION PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('x') OPERATION_REFERENCE
PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('and')
OPERATION_REFERENCE PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('and') INTEGER_CONSTANT
PsiWhiteSpace(' ') PsiElement(INTEGER_LITERAL)('1')
INTEGER_CONSTANT PsiWhiteSpace('\n ')
PsiElement(INTEGER_LITERAL)('1') BINARY_EXPRESSION
PsiWhiteSpace('\n ') REFERENCE_EXPRESSION
BINARY_EXPRESSION PsiElement(IDENTIFIER)('x')
REFERENCE_EXPRESSION PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('x') OPERATION_REFERENCE
PsiWhiteSpace(' ') PsiElement(EQ)('=')
OPERATION_REFERENCE PsiWhiteSpace(' ')
PsiElement(EQ)('=') BINARY_EXPRESSION
PsiWhiteSpace(' ') REFERENCE_EXPRESSION
BINARY_EXPRESSION PsiElement(IDENTIFIER)('x')
REFERENCE_EXPRESSION PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('x') OPERATION_REFERENCE
PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('ushr')
OPERATION_REFERENCE PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('ushr') INTEGER_CONSTANT
PsiWhiteSpace(' ') PsiElement(INTEGER_LITERAL)('1')
INTEGER_CONSTANT PsiWhiteSpace('\n ')
PsiElement(INTEGER_LITERAL)('1') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('result') PsiElement(IDENTIFIER)('result')
+94 -98
View File
@@ -878,113 +878,109 @@ JetFile: Graph.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
BODY BODY
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') PROPERTY
BLOCK PsiElement(val)('val')
PROPERTY PsiWhiteSpace(' ')
PsiElement(val)('val') PsiElement(IDENTIFIER)('current')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('current') PsiElement(EQ)('=')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiElement(EQ)('=') DOT_QUALIFIED_EXPRESSION
PsiWhiteSpace(' ') REFERENCE_EXPRESSION
DOT_QUALIFIED_EXPRESSION PsiElement(IDENTIFIER)('pending')
REFERENCE_EXPRESSION PsiElement(DOT)('.')
PsiElement(IDENTIFIER)('pending')
PsiElement(DOT)('.')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('pop')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
CALL_EXPRESSION CALL_EXPRESSION
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('handler') PsiElement(IDENTIFIER)('pop')
VALUE_ARGUMENT_LIST VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(') PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('current')
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiElement(SEMICOLON)(';') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') CALL_EXPRESSION
DOT_QUALIFIED_EXPRESSION REFERENCE_EXPRESSION
CALL_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 REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('neighbours') PsiElement(IDENTIFIER)('current')
VALUE_ARGUMENT_LIST PsiElement(RPAR)(')')
PsiElement(LPAR)('(') PsiElement(DOT)('.')
VALUE_ARGUMENT CALL_EXPRESSION
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('current') PsiElement(IDENTIFIER)('foreach')
PsiElement(RPAR)(')') PsiWhiteSpace(' ')
PsiElement(DOT)('.') FUNCTION_LITERAL_EXPRESSION
CALL_EXPRESSION FUNCTION_LITERAL
REFERENCE_EXPRESSION PsiElement(LBRACE)('{')
PsiElement(IDENTIFIER)('foreach')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
FUNCTION_LITERAL_EXPRESSION VALUE_PARAMETER_LIST
FUNCTION_LITERAL VALUE_PARAMETER
PsiElement(LBRACE)('{') PsiElement(IDENTIFIER)('n')
PsiWhiteSpace(' ')
PsiElement(DOUBLE_ARROW)('=>')
PsiWhiteSpace('\n ')
BLOCK
IF
PsiElement(if)('if')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
VALUE_PARAMETER_LIST PsiElement(LPAR)('(')
VALUE_PARAMETER CONDITION
PsiElement(IDENTIFIER)('n') DOT_QUALIFIED_EXPRESSION
PsiWhiteSpace(' ') REFERENCE_EXPRESSION
PsiElement(DOUBLE_ARROW)('=>') PsiElement(IDENTIFIER)('visited')
PsiWhiteSpace('\n ') PsiElement(DOT)('.')
BLOCK CALL_EXPRESSION
IF REFERENCE_EXPRESSION
PsiElement(if)('if') PsiElement(IDENTIFIER)('add')
PsiWhiteSpace(' ') VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(') PsiElement(LPAR)('(')
CONDITION VALUE_ARGUMENT
DOT_QUALIFIED_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('visited')
PsiElement(DOT)('.')
CALL_EXPRESSION
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('add') PsiElement(IDENTIFIER)('n')
VALUE_ARGUMENT_LIST PsiElement(RPAR)(')')
PsiElement(LPAR)('(') PsiElement(RPAR)(')')
VALUE_ARGUMENT PsiWhiteSpace(' ')
REFERENCE_EXPRESSION THEN
PsiElement(IDENTIFIER)('n') BLOCK
PsiElement(RPAR)(')') PsiElement(LBRACE)('{')
PsiElement(RPAR)(')') PsiWhiteSpace('\n ')
PsiWhiteSpace(' ') DOT_QUALIFIED_EXPRESSION
THEN REFERENCE_EXPRESSION
FUNCTION_LITERAL_EXPRESSION PsiElement(IDENTIFIER)('pending')
FUNCTION_LITERAL PsiElement(DOT)('.')
PsiElement(LBRACE)('{') CALL_EXPRESSION
PsiWhiteSpace('\n ') REFERENCE_EXPRESSION
BLOCK PsiElement(IDENTIFIER)('push')
DOT_QUALIFIED_EXPRESSION VALUE_ARGUMENT_LIST
REFERENCE_EXPRESSION PsiElement(LPAR)('(')
PsiElement(IDENTIFIER)('pending') VALUE_ARGUMENT
PsiElement(DOT)('.') REFERENCE_EXPRESSION
CALL_EXPRESSION PsiElement(IDENTIFIER)('n')
REFERENCE_EXPRESSION PsiElement(RPAR)(')')
PsiElement(IDENTIFIER)('push') PsiWhiteSpace('\n ')
VALUE_ARGUMENT_LIST PsiElement(RBRACE)('}')
PsiElement(LPAR)('(') PsiWhiteSpace('\n ')
VALUE_ARGUMENT PsiElement(RBRACE)('}')
REFERENCE_EXPRESSION PsiWhiteSpace('\n ')
PsiElement(IDENTIFIER)('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<T>, this compiles into\n y.foreach{ n => push(n) }\n */')
PsiElement(RPAR)(')') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') PsiElement(RBRACE)('}')
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<T>, this compiles into\n y.foreach{ n => push(n) }\n */')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
@@ -371,29 +371,27 @@ JetFile: PolymorphicClassObjects.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
BODY BODY
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') BINARY_EXPRESSION
BLOCK REFERENCE_EXPRESSION
BINARY_EXPRESSION PsiElement(IDENTIFIER)('builder')
REFERENCE_EXPRESSION PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('builder') OPERATION_REFERENCE
PsiWhiteSpace(' ') PsiElement(PLUSEQ)('+=')
OPERATION_REFERENCE PsiWhiteSpace(' ')
PsiElement(PLUSEQ)('+=') CALL_EXPRESSION
PsiWhiteSpace(' ') REFERENCE_EXPRESSION
CALL_EXPRESSION PsiElement(IDENTIFIER)('f')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('f') PsiElement(IDENTIFIER)('e')
VALUE_ARGUMENT_LIST PsiElement(RPAR)(')')
PsiElement(LPAR)('(') PsiWhiteSpace('\n ')
VALUE_ARGUMENT PsiElement(RBRACE)('}')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('e')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
DOT_QUALIFIED_EXPRESSION DOT_QUALIFIED_EXPRESSION
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
+107 -113
View File
@@ -191,66 +191,62 @@ JetFile: Queue.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
THEN THEN
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') BINARY_EXPRESSION
BLOCK REFERENCE_EXPRESSION
BINARY_EXPRESSION PsiElement(IDENTIFIER)('head')
REFERENCE_EXPRESSION PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('head') OPERATION_REFERENCE
PsiWhiteSpace(' ') PsiElement(EQ)('=')
OPERATION_REFERENCE PsiWhiteSpace(' ')
PsiElement(EQ)('=') REFERENCE_EXPRESSION
PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('i')
REFERENCE_EXPRESSION PsiWhiteSpace('\n ')
PsiElement(IDENTIFIER)('i') BINARY_EXPRESSION
PsiWhiteSpace('\n ') REFERENCE_EXPRESSION
BINARY_EXPRESSION PsiElement(IDENTIFIER)('tail')
REFERENCE_EXPRESSION PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('tail') OPERATION_REFERENCE
PsiWhiteSpace(' ') PsiElement(EQ)('=')
OPERATION_REFERENCE PsiWhiteSpace(' ')
PsiElement(EQ)('=') REFERENCE_EXPRESSION
PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('head')
REFERENCE_EXPRESSION PsiWhiteSpace('\n ')
PsiElement(IDENTIFIER)('head') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiElement(else)('else') PsiElement(else)('else')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
ELSE ELSE
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') BINARY_EXPRESSION
BLOCK DOT_QUALIFIED_EXPRESSION
BINARY_EXPRESSION REFERENCE_EXPRESSION
DOT_QUALIFIED_EXPRESSION PsiElement(IDENTIFIER)('tail')
REFERENCE_EXPRESSION PsiElement(DOT)('.')
PsiElement(IDENTIFIER)('tail') REFERENCE_EXPRESSION
PsiElement(DOT)('.') PsiElement(IDENTIFIER)('next')
REFERENCE_EXPRESSION PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('next') OPERATION_REFERENCE
PsiWhiteSpace(' ') PsiElement(EQ)('=')
OPERATION_REFERENCE PsiWhiteSpace(' ')
PsiElement(EQ)('=') REFERENCE_EXPRESSION
PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('i')
REFERENCE_EXPRESSION PsiWhiteSpace('\n ')
PsiElement(IDENTIFIER)('i') BINARY_EXPRESSION
PsiWhiteSpace('\n ') REFERENCE_EXPRESSION
BINARY_EXPRESSION PsiElement(IDENTIFIER)('tail')
REFERENCE_EXPRESSION PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('tail') OPERATION_REFERENCE
PsiWhiteSpace(' ') PsiElement(EQ)('=')
OPERATION_REFERENCE PsiWhiteSpace(' ')
PsiElement(EQ)('=') REFERENCE_EXPRESSION
PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('i')
REFERENCE_EXPRESSION PsiWhiteSpace('\n ')
PsiElement(IDENTIFIER)('i') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
@@ -297,70 +293,68 @@ JetFile: Queue.jet
PsiElement(else)('else') PsiElement(else)('else')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
ELSE ELSE
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') PROPERTY
BLOCK PsiElement(val)('val')
PROPERTY PsiWhiteSpace(' ')
PsiElement(val)('val') PsiElement(IDENTIFIER)('result')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('result') PsiElement(EQ)('=')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiElement(EQ)('=') DOT_QUALIFIED_EXPRESSION
PsiWhiteSpace(' ') REFERENCE_EXPRESSION
DOT_QUALIFIED_EXPRESSION PsiElement(IDENTIFIER)('head')
REFERENCE_EXPRESSION PsiElement(DOT)('.')
PsiElement(IDENTIFIER)('head') REFERENCE_EXPRESSION
PsiElement(DOT)('.') PsiElement(IDENTIFIER)('data')
REFERENCE_EXPRESSION PsiWhiteSpace('\n ')
PsiElement(IDENTIFIER)('data') BINARY_EXPRESSION
PsiWhiteSpace('\n ') 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 BINARY_EXPRESSION
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('head') PsiElement(IDENTIFIER)('head')
PsiWhiteSpace(' ') 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 OPERATION_REFERENCE
PsiElement(EQ)('=') PsiElement(EQ)('=')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
DOT_QUALIFIED_EXPRESSION NULL
REFERENCE_EXPRESSION PsiElement(null)('null')
PsiElement(IDENTIFIER)('head') PsiWhiteSpace('\n ')
PsiElement(DOT)('.') REFERENCE_EXPRESSION
REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('result')
PsiElement(IDENTIFIER)('next') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') PsiElement(RBRACE)('}')
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)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
PROPERTY PROPERTY
MODIFIER_LIST MODIFIER_LIST
+81 -89
View File
@@ -150,19 +150,17 @@ JetFile: UnionFind.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
THEN THEN
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') RETURN
BLOCK PsiElement(return)('return')
RETURN PsiWhiteSpace(' ')
PsiElement(return)('return') REFERENCE_EXPRESSION
PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('x')
REFERENCE_EXPRESSION PsiElement(SEMICOLON)(';')
PsiElement(IDENTIFIER)('x') PsiWhiteSpace('\n ')
PsiElement(SEMICOLON)(';') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
PROPERTY PROPERTY
PsiElement(val)('val') PsiElement(val)('val')
@@ -283,83 +281,77 @@ JetFile: UnionFind.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
THEN THEN
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') IF
BLOCK PsiElement(if)('if')
IF PsiWhiteSpace(' ')
PsiElement(if)('if') PsiElement(LPAR)('(')
PsiWhiteSpace(' ') CONDITION
PsiElement(LPAR)('(') DOT_QUALIFIED_EXPRESSION
CONDITION DOT_QUALIFIED_EXPRESSION
DOT_QUALIFIED_EXPRESSION REFERENCE_EXPRESSION
DOT_QUALIFIED_EXPRESSION PsiElement(IDENTIFIER)('Random')
REFERENCE_EXPRESSION PsiElement(DOT)('.')
PsiElement(IDENTIFIER)('Random') CALL_EXPRESSION
PsiElement(DOT)('.')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('nextInt')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiElement(DOT)('.')
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('isOdd') PsiElement(IDENTIFIER)('nextInt')
PsiElement(RPAR)(')') VALUE_ARGUMENT_LIST
PsiWhiteSpace(' ') PsiElement(LPAR)('(')
THEN PsiElement(RPAR)(')')
FUNCTION_LITERAL_EXPRESSION PsiElement(DOT)('.')
FUNCTION_LITERAL REFERENCE_EXPRESSION
PsiElement(LBRACE)('{') PsiElement(IDENTIFIER)('isOdd')
PsiWhiteSpace('\n ') PsiElement(RPAR)(')')
BLOCK PsiWhiteSpace(' ')
BINARY_EXPRESSION THEN
ARRAY_ACCESS_EXPRESSION BLOCK
REFERENCE_EXPRESSION PsiElement(LBRACE)('{')
PsiElement(IDENTIFIER)('data') PsiWhiteSpace('\n ')
INDICES BINARY_EXPRESSION
PsiElement(LBRACKET)('[') ARRAY_ACCESS_EXPRESSION
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('pb') PsiElement(IDENTIFIER)('data')
PsiElement(RBRACKET)(']') INDICES
PsiWhiteSpace(' ') PsiElement(LBRACKET)('[')
OPERATION_REFERENCE REFERENCE_EXPRESSION
PsiElement(EQ)('=') PsiElement(IDENTIFIER)('pb')
PsiWhiteSpace(' ') PsiElement(RBRACKET)(']')
REFERENCE_EXPRESSION PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('pa') OPERATION_REFERENCE
PsiWhiteSpace('\n ') PsiElement(EQ)('=')
PsiElement(RBRACE)('}') PsiWhiteSpace(' ')
PsiWhiteSpace(' ') REFERENCE_EXPRESSION
PsiElement(else)('else') PsiElement(IDENTIFIER)('pa')
PsiWhiteSpace(' ') PsiWhiteSpace('\n ')
ELSE PsiElement(RBRACE)('}')
FUNCTION_LITERAL_EXPRESSION PsiWhiteSpace(' ')
FUNCTION_LITERAL PsiElement(else)('else')
PsiElement(LBRACE)('{') PsiWhiteSpace(' ')
PsiWhiteSpace('\n ') ELSE
BLOCK BLOCK
BINARY_EXPRESSION PsiElement(LBRACE)('{')
ARRAY_ACCESS_EXPRESSION PsiWhiteSpace('\n ')
REFERENCE_EXPRESSION BINARY_EXPRESSION
PsiElement(IDENTIFIER)('data') ARRAY_ACCESS_EXPRESSION
INDICES REFERENCE_EXPRESSION
PsiElement(LBRACKET)('[') PsiElement(IDENTIFIER)('data')
REFERENCE_EXPRESSION INDICES
PsiElement(IDENTIFIER)('pa') PsiElement(LBRACKET)('[')
PsiElement(RBRACKET)(']') REFERENCE_EXPRESSION
PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('pa')
OPERATION_REFERENCE PsiElement(RBRACKET)(']')
PsiElement(EQ)('=') PsiWhiteSpace(' ')
PsiWhiteSpace(' ') OPERATION_REFERENCE
REFERENCE_EXPRESSION PsiElement(EQ)('=')
PsiElement(IDENTIFIER)('pb') PsiWhiteSpace(' ')
PsiWhiteSpace('\n ') REFERENCE_EXPRESSION
PsiElement(RBRACE)('}') PsiElement(IDENTIFIER)('pb')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n') PsiWhiteSpace('\n')
@@ -672,31 +672,29 @@ JetFile: ArrayList.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
THEN THEN
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') BINARY_EXPRESSION
BLOCK ARRAY_ACCESS_EXPRESSION
BINARY_EXPRESSION REFERENCE_EXPRESSION
ARRAY_ACCESS_EXPRESSION PsiElement(IDENTIFIER)('data')
INDICES
PsiElement(LBRACKET)('[')
POSTFIX_EXPRESSION
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('data') PsiElement(IDENTIFIER)('used')
INDICES OPERATION_REFERENCE
PsiElement(LBRACKET)('[') PsiElement(PLUSPLUS)('++')
POSTFIX_EXPRESSION PsiElement(RBRACKET)(']')
REFERENCE_EXPRESSION PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('used') OPERATION_REFERENCE
OPERATION_REFERENCE PsiElement(EQ)('=')
PsiElement(PLUSPLUS)('++') PsiWhiteSpace(' ')
PsiElement(RBRACKET)(']') REFERENCE_EXPRESSION
PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('value')
OPERATION_REFERENCE PsiWhiteSpace('\n ')
PsiElement(EQ)('=') PsiElement(RBRACE)('}')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('value')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiElement(else)('else') PsiElement(else)('else')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
@@ -718,90 +716,88 @@ JetFile: ArrayList.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
THEN THEN
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') FOR
BLOCK PsiElement(for)('for')
FOR PsiWhiteSpace(' ')
PsiElement(for)('for') PsiElement(LPAR)('(')
PsiWhiteSpace(' ') LOOP_PARAMETER
PsiElement(LPAR)('(') PsiElement(IDENTIFIER)('i')
LOOP_PARAMETER PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('i') PsiElement(in)('in')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiElement(in)('in') LOOP_RANGE
PsiWhiteSpace(' ') BINARY_EXPRESSION
LOOP_RANGE BINARY_EXPRESSION
BINARY_EXPRESSION REFERENCE_EXPRESSION
BINARY_EXPRESSION PsiElement(IDENTIFIER)('used')
REFERENCE_EXPRESSION OPERATION_REFERENCE
PsiElement(IDENTIFIER)('used') PsiElement(MINUS)('-')
OPERATION_REFERENCE INTEGER_CONSTANT
PsiElement(MINUS)('-') PsiElement(INTEGER_LITERAL)('1')
INTEGER_CONSTANT OPERATION_REFERENCE
PsiElement(INTEGER_LITERAL)('1') PsiElement(RANGE)('..')
OPERATION_REFERENCE REFERENCE_EXPRESSION
PsiElement(RANGE)('..') PsiElement(IDENTIFIER)('index')
REFERENCE_EXPRESSION PsiElement(RPAR)(')')
PsiElement(IDENTIFIER)('index') PsiWhiteSpace(' ')
PsiElement(RPAR)(')') PsiComment(EOL_COMMENT)('// backwards, special operator... Need to optimize this to be a real indexed loop')
PsiWhiteSpace(' ') PsiWhiteSpace('\n ')
PsiComment(EOL_COMMENT)('// backwards, special operator... Need to optimize this to be a real indexed loop') BODY
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 ')
BINARY_EXPRESSION BINARY_EXPRESSION
ARRAY_ACCESS_EXPRESSION ARRAY_ACCESS_EXPRESSION
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('data') PsiElement(IDENTIFIER)('data')
INDICES INDICES
PsiElement(LBRACKET)('[') PsiElement(LBRACKET)('[')
REFERENCE_EXPRESSION BINARY_EXPRESSION
PsiElement(IDENTIFIER)('index') REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('i')
PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(PLUS)('+')
PsiWhiteSpace(' ')
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('1')
PsiElement(RBRACKET)(']') PsiElement(RBRACKET)(']')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
OPERATION_REFERENCE OPERATION_REFERENCE
PsiElement(EQ)('=') PsiElement(EQ)('=')
PsiWhiteSpace(' ') 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 REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('value') PsiElement(IDENTIFIER)('index')
PsiWhiteSpace('\n ') PsiElement(RBRACKET)(']')
POSTFIX_EXPRESSION PsiWhiteSpace(' ')
REFERENCE_EXPRESSION OPERATION_REFERENCE
PsiElement(IDENTIFIER)('used') PsiElement(EQ)('=')
OPERATION_REFERENCE PsiWhiteSpace(' ')
PsiElement(PLUSPLUS)('++') REFERENCE_EXPRESSION
PsiWhiteSpace('\n ') PsiElement(IDENTIFIER)('value')
PsiElement(RBRACE)('}') PsiWhiteSpace('\n ')
POSTFIX_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('used')
OPERATION_REFERENCE
PsiElement(PLUSPLUS)('++')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiElement(else)('else') PsiElement(else)('else')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
@@ -251,23 +251,21 @@ JetFile: IIterator.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
THEN THEN
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') THROW
BLOCK PsiElement(throw)('throw')
THROW PsiWhiteSpace(' ')
PsiElement(throw)('throw') CALL_EXPRESSION
PsiWhiteSpace(' ') REFERENCE_EXPRESSION
CALL_EXPRESSION PsiElement(IDENTIFIER)('IndexOutOfBoundsException')
REFERENCE_EXPRESSION VALUE_ARGUMENT_LIST
PsiElement(IDENTIFIER)('IndexOutOfBoundsException') PsiElement(LPAR)('(')
VALUE_ARGUMENT_LIST PsiElement(RPAR)(')')
PsiElement(LPAR)('(') PsiElement(SEMICOLON)(';')
PsiElement(RPAR)(')') PsiWhiteSpace('\n ')
PsiElement(SEMICOLON)(';') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
IF IF
PsiElement(if)('if') PsiElement(if)('if')
@@ -339,57 +337,55 @@ JetFile: IIterator.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
BODY BODY
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') IF
BLOCK PsiElement(if)('if')
IF PsiWhiteSpace(' ')
PsiElement(if)('if') PsiElement(LPAR)('(')
PsiWhiteSpace(' ') CONDITION
PsiElement(LPAR)('(') PREFIX_EXPRESSION
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(' ')
OPERATION_REFERENCE OPERATION_REFERENCE
PsiElement(EQ)('=') PsiElement(EXCL)('!')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('hasNext')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
THEN
RETURN
PsiElement(return)('return')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('next')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
POSTFIX_EXPRESSION
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('count') PsiElement(IDENTIFIER)('count')
OPERATION_REFERENCE PsiWhiteSpace('\n ')
PsiElement(PLUSPLUS)('++') BINARY_EXPRESSION
PsiWhiteSpace('\n ') ARRAY_ACCESS_EXPRESSION
PsiElement(RBRACE)('}') 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 ') PsiWhiteSpace('\n ')
RETURN RETURN
PsiElement(return)('return') PsiElement(return)('return')
@@ -224,163 +224,155 @@ JetFile: LinkedList.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
THEN THEN
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') BINARY_EXPRESSION
BLOCK DOT_QUALIFIED_EXPRESSION
BINARY_EXPRESSION REFERENCE_EXPRESSION
DOT_QUALIFIED_EXPRESSION PsiElement(IDENTIFIER)('newItem')
REFERENCE_EXPRESSION PsiElement(DOT)('.')
PsiElement(IDENTIFIER)('newItem') REFERENCE_EXPRESSION
PsiElement(DOT)('.') PsiElement(IDENTIFIER)('next')
REFERENCE_EXPRESSION PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('next') OPERATION_REFERENCE
PsiWhiteSpace(' ') PsiElement(EQ)('=')
OPERATION_REFERENCE PsiWhiteSpace(' ')
PsiElement(EQ)('=') REFERENCE_EXPRESSION
PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('head')
REFERENCE_EXPRESSION PsiWhiteSpace('\n ')
PsiElement(IDENTIFIER)('head') BINARY_EXPRESSION
PsiWhiteSpace('\n ') 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 BINARY_EXPRESSION
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('head') PsiElement(IDENTIFIER)('tail')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
OPERATION_REFERENCE OPERATION_REFERENCE
PsiElement(EQ)('=') PsiElement(EQEQEQ)('===')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
REFERENCE_EXPRESSION NULL
PsiElement(IDENTIFIER)('newItem') PsiElement(null)('null')
PsiWhiteSpace('\n ') PsiElement(RPAR)(')')
IF PsiWhiteSpace(' ')
PsiElement(if)('if') THEN
PsiWhiteSpace(' ') BLOCK
PsiElement(LPAR)('(') PsiElement(LBRACE)('{')
CONDITION PsiWhiteSpace('\n ')
BINARY_EXPRESSION BINARY_EXPRESSION
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('tail') PsiElement(IDENTIFIER)('tail')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
OPERATION_REFERENCE OPERATION_REFERENCE
PsiElement(EQEQEQ)('===') PsiElement(EQ)('=')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
NULL REFERENCE_EXPRESSION
PsiElement(null)('null') PsiElement(IDENTIFIER)('head')
PsiElement(RPAR)(')') PsiWhiteSpace('\n ')
PsiWhiteSpace(' ') PsiElement(RBRACE)('}')
THEN PsiWhiteSpace('\n ')
FUNCTION_LITERAL_EXPRESSION PsiElement(RBRACE)('}')
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)('}')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiElement(else)('else') PsiElement(else)('else')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
ELSE ELSE
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') PROPERTY
BLOCK PsiElement(var)('var')
PROPERTY PsiWhiteSpace(' ')
PsiElement(var)('var') PsiElement(IDENTIFIER)('insertAfter')
PsiWhiteSpace(' ') 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') PsiElement(IDENTIFIER)('insertAfter')
PsiWhiteSpace(' ') PsiElement(DOT)('.')
PsiElement(EQ)('=') REFERENCE_EXPRESSION
PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('next')
CALL_EXPRESSION PsiWhiteSpace('\n ')
REFERENCE_EXPRESSION BINARY_EXPRESSION
PsiElement(IDENTIFIER)('itemAt') DOT_QUALIFIED_EXPRESSION
VALUE_ARGUMENT_LIST REFERENCE_EXPRESSION
PsiElement(LPAR)('(') PsiElement(IDENTIFIER)('insertAfter')
VALUE_ARGUMENT PsiElement(DOT)('.')
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('index') PsiElement(IDENTIFIER)('next')
PsiElement(RPAR)(')') PsiWhiteSpace(' ')
PsiWhiteSpace('\n ') OPERATION_REFERENCE
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('newItem')
PsiWhiteSpace('\n ')
IF
PsiElement(if)('if')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
CONDITION
BINARY_EXPRESSION BINARY_EXPRESSION
DOT_QUALIFIED_EXPRESSION REFERENCE_EXPRESSION
REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('tail')
PsiElement(IDENTIFIER)('newItem')
PsiElement(DOT)('.')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('next')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
OPERATION_REFERENCE OPERATION_REFERENCE
PsiElement(EQ)('=') PsiElement(EQEQEQ)('===')
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)('=')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('newItem') PsiElement(IDENTIFIER)('insertAfter')
PsiWhiteSpace('\n ') PsiElement(RPAR)(')')
IF PsiWhiteSpace(' ')
PsiElement(if)('if') THEN
PsiWhiteSpace(' ') BLOCK
PsiElement(LPAR)('(') PsiElement(LBRACE)('{')
CONDITION PsiWhiteSpace('\n ')
BINARY_EXPRESSION BINARY_EXPRESSION
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('tail') PsiElement(IDENTIFIER)('tail')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
OPERATION_REFERENCE OPERATION_REFERENCE
PsiElement(EQEQEQ)('===') PsiElement(EQ)('=')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('insertAfter') PsiElement(IDENTIFIER)('newItem')
PsiElement(RPAR)(')') PsiWhiteSpace('\n ')
PsiWhiteSpace(' ') PsiElement(RBRACE)('}')
THEN PsiWhiteSpace('\n ')
FUNCTION_LITERAL_EXPRESSION PsiElement(RBRACE)('}')
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)('}')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
@@ -434,25 +426,23 @@ JetFile: LinkedList.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
THEN THEN
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') THROW
BLOCK PsiElement(throw)('throw')
THROW PsiWhiteSpace(' ')
PsiElement(throw)('throw') CALL_EXPRESSION
PsiWhiteSpace(' ') REFERENCE_EXPRESSION
CALL_EXPRESSION PsiElement(IDENTIFIER)('IndexOutOfBoundsException')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('IndexOutOfBoundsException') PsiElement(IDENTIFIER)('index')
VALUE_ARGUMENT_LIST PsiElement(RPAR)(')')
PsiElement(LPAR)('(') PsiWhiteSpace('\n ')
VALUE_ARGUMENT PsiElement(RBRACE)('}')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('index')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
@@ -530,158 +520,150 @@ JetFile: LinkedList.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
THEN THEN
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') BINARY_EXPRESSION
BLOCK 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 BINARY_EXPRESSION
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('head') PsiElement(IDENTIFIER)('head')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(EQEQEQ)('===')
PsiWhiteSpace(' ')
NULL
PsiElement(null)('null')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
THEN
BINARY_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('tail')
OPERATION_REFERENCE OPERATION_REFERENCE
PsiElement(EQ)('=') PsiElement(EQ)('=')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
DOT_QUALIFIED_EXPRESSION NULL
REFERENCE_EXPRESSION PsiElement(null)('null')
PsiElement(IDENTIFIER)('item') PsiWhiteSpace('\n ')
PsiElement(DOT)('.') PsiElement(RBRACE)('}')
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)('}')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiElement(else)('else') PsiElement(else)('else')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
ELSE ELSE
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') BINARY_EXPRESSION
BLOCK 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 BINARY_EXPRESSION
DOT_QUALIFIED_EXPRESSION DOT_QUALIFIED_EXPRESSION
DOT_QUALIFIED_EXPRESSION REFERENCE_EXPRESSION
REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('item')
PsiElement(IDENTIFIER)('item')
PsiElement(DOT)('.')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('previous')
PsiElement(DOT)('.') PsiElement(DOT)('.')
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('next') PsiElement(IDENTIFIER)('next')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
OPERATION_REFERENCE OPERATION_REFERENCE
PsiElement(EQ)('=') PsiElement(EQEQEQ)('===')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
DOT_QUALIFIED_EXPRESSION NULL
REFERENCE_EXPRESSION PsiElement(null)('null')
PsiElement(IDENTIFIER)('item') PsiElement(RPAR)(')')
PsiElement(DOT)('.') PsiWhiteSpace(' ')
REFERENCE_EXPRESSION THEN
PsiElement(IDENTIFIER)('next') BLOCK
PsiWhiteSpace('\n ') PsiElement(LBRACE)('{')
IF PsiWhiteSpace('\n ')
PsiElement(if)('if') BINARY_EXPRESSION
PsiWhiteSpace(' ') DOT_QUALIFIED_EXPRESSION
PsiElement(LPAR)('(')
CONDITION
BINARY_EXPRESSION
DOT_QUALIFIED_EXPRESSION DOT_QUALIFIED_EXPRESSION
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('item') PsiElement(IDENTIFIER)('item')
PsiElement(DOT)('.') PsiElement(DOT)('.')
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('next') PsiElement(IDENTIFIER)('next')
PsiWhiteSpace(' ') PsiElement(DOT)('.')
OPERATION_REFERENCE REFERENCE_EXPRESSION
PsiElement(EQEQEQ)('===') PsiElement(IDENTIFIER)('previous')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
NULL OPERATION_REFERENCE
PsiElement(null)('null') PsiElement(EQ)('=')
PsiElement(RPAR)(')') PsiWhiteSpace(' ')
PsiWhiteSpace(' ') DOT_QUALIFIED_EXPRESSION
THEN REFERENCE_EXPRESSION
FUNCTION_LITERAL_EXPRESSION PsiElement(IDENTIFIER)('item')
FUNCTION_LITERAL PsiElement(DOT)('.')
PsiElement(LBRACE)('{') REFERENCE_EXPRESSION
PsiWhiteSpace('\n ') PsiElement(IDENTIFIER)('previous')
BLOCK PsiWhiteSpace('\n ')
BINARY_EXPRESSION PsiElement(RBRACE)('}')
DOT_QUALIFIED_EXPRESSION PsiWhiteSpace(' ')
DOT_QUALIFIED_EXPRESSION PsiElement(else)('else')
REFERENCE_EXPRESSION PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('item') ELSE
PsiElement(DOT)('.') BLOCK
REFERENCE_EXPRESSION PsiElement(LBRACE)('{')
PsiElement(IDENTIFIER)('next') PsiWhiteSpace('\n ')
PsiElement(DOT)('.') BINARY_EXPRESSION
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('previous') PsiElement(IDENTIFIER)('tail')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
OPERATION_REFERENCE OPERATION_REFERENCE
PsiElement(EQ)('=') PsiElement(EQ)('=')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
DOT_QUALIFIED_EXPRESSION DOT_QUALIFIED_EXPRESSION
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('item') PsiElement(IDENTIFIER)('tail')
PsiElement(DOT)('.') PsiElement(DOT)('.')
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('previous') PsiElement(IDENTIFIER)('previous')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
PsiWhiteSpace(' ') PsiWhiteSpace('\n ')
PsiElement(else)('else') PsiElement(RBRACE)('}')
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)('}')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
POSTFIX_EXPRESSION POSTFIX_EXPRESSION
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
@@ -858,26 +840,24 @@ JetFile: LinkedList.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
BODY BODY
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') BINARY_EXPRESSION
BLOCK REFERENCE_EXPRESSION
BINARY_EXPRESSION PsiElement(IDENTIFIER)('result')
REFERENCE_EXPRESSION PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('result') OPERATION_REFERENCE
PsiWhiteSpace(' ') PsiElement(EQ)('=')
OPERATION_REFERENCE PsiWhiteSpace(' ')
PsiElement(EQ)('=') DOT_QUALIFIED_EXPRESSION
PsiWhiteSpace(' ') REFERENCE_EXPRESSION
DOT_QUALIFIED_EXPRESSION PsiElement(IDENTIFIER)('result')
REFERENCE_EXPRESSION PsiElement(DOT)('.')
PsiElement(IDENTIFIER)('result') REFERENCE_EXPRESSION
PsiElement(DOT)('.') PsiElement(IDENTIFIER)('next')
REFERENCE_EXPRESSION PsiWhiteSpace('\n ')
PsiElement(IDENTIFIER)('next') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
RETURN RETURN
PsiElement(return)('return') PsiElement(return)('return')
+61 -65
View File
@@ -358,37 +358,35 @@ JetFile: IOSamples.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
THEN THEN
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') BINARY_EXPRESSION
BLOCK REFERENCE_EXPRESSION
BINARY_EXPRESSION PsiElement(IDENTIFIER)('nextUsed')
REFERENCE_EXPRESSION PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('nextUsed') OPERATION_REFERENCE
PsiWhiteSpace(' ') PsiElement(EQ)('=')
OPERATION_REFERENCE PsiWhiteSpace(' ')
PsiElement(EQ)('=') BOOLEAN_CONSTANT
PsiWhiteSpace(' ') PsiElement(true)('true')
BOOLEAN_CONSTANT PsiWhiteSpace('\n ')
PsiElement(true)('true') RETURN
PsiWhiteSpace('\n ') PsiElement(return)('return')
RETURN PsiWhiteSpace(' ')
PsiElement(return)('return') BINARY_WITH_TYPE
PsiWhiteSpace(' ') REFERENCE_EXPRESSION
BINARY_WITH_TYPE PsiElement(IDENTIFIER)('next')
PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(as)('as')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('next') PsiElement(IDENTIFIER)('Byte')
PsiWhiteSpace(' ') PsiWhiteSpace('\n ')
OPERATION_REFERENCE PsiElement(RBRACE)('}')
PsiElement(as)('as')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Byte')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
RETURN RETURN
PsiElement(return)('return') PsiElement(return)('return')
@@ -440,42 +438,40 @@ JetFile: IOSamples.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
THEN THEN
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') BINARY_EXPRESSION
BLOCK REFERENCE_EXPRESSION
BINARY_EXPRESSION PsiElement(IDENTIFIER)('nextUsed')
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)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiComment(EOL_COMMENT)('// throws IOException') OPERATION_REFERENCE
PsiWhiteSpace('\n ') PsiElement(EQ)('=')
PsiElement(RBRACE)('}') 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 ') PsiWhiteSpace('\n ')
RETURN RETURN
PsiElement(return)('return') PsiElement(return)('return')
@@ -209,22 +209,20 @@ JetFile: BinaryHeap.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
BODY BODY
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') CALL_EXPRESSION
BLOCK REFERENCE_EXPRESSION
CALL_EXPRESSION PsiElement(IDENTIFIER)('siftDown')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('siftDown') PsiElement(IDENTIFIER)('i')
VALUE_ARGUMENT_LIST PsiElement(RPAR)(')')
PsiElement(LPAR)('(') PsiWhiteSpace('\n ')
VALUE_ARGUMENT PsiElement(RBRACE)('}')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('i')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
@@ -575,186 +573,180 @@ JetFile: BinaryHeap.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
BODY BODY
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') PROPERTY
BLOCK PsiElement(var)('var')
PROPERTY PsiWhiteSpace(' ')
PsiElement(var)('var') PsiElement(IDENTIFIER)('min')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('min') PsiElement(EQ)('=')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiElement(EQ)('=') REFERENCE_EXPRESSION
PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('current')
REFERENCE_EXPRESSION PsiWhiteSpace('\n ')
PsiElement(IDENTIFIER)('current') IF
PsiWhiteSpace('\n ') PsiElement(if)('if')
IF PsiWhiteSpace(' ')
PsiElement(if)('if') PsiElement(LPAR)('(')
PsiWhiteSpace(' ') CONDITION
PsiElement(LPAR)('(') BINARY_EXPRESSION
CONDITION DOT_QUALIFIED_EXPRESSION
BINARY_EXPRESSION DOT_QUALIFIED_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(' ')
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('current') PsiElement(IDENTIFIER)('current')
PsiElement(RPAR)(')') PsiElement(DOT)('.')
PsiWhiteSpace(' ') REFERENCE_EXPRESSION
THEN PsiElement(IDENTIFIER)('left')
BREAK PsiElement(DOT)('.')
PsiElement(break)('break')
PsiWhiteSpace('\n ')
DOT_QUALIFIED_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('data')
PsiElement(DOT)('.')
CALL_EXPRESSION
REFERENCE_EXPRESSION REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('swap') PsiElement(IDENTIFIER)('value')
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(' ') PsiWhiteSpace(' ')
OPERATION_REFERENCE OPERATION_REFERENCE
PsiElement(EQ)('=') PsiElement(LT)('<')
PsiWhiteSpace(' ') 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 REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('min') PsiElement(IDENTIFIER)('min')
PsiWhiteSpace('\n ') PsiWhiteSpace(' ')
PsiElement(RBRACE)('}') 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 ') PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
@@ -829,85 +821,81 @@ JetFile: BinaryHeap.jet
PsiElement(RPAR)(')') PsiElement(RPAR)(')')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
BODY BODY
FUNCTION_LITERAL_EXPRESSION BLOCK
FUNCTION_LITERAL PsiElement(LBRACE)('{')
PsiElement(LBRACE)('{') PsiWhiteSpace('\n ')
PsiWhiteSpace('\n ') IF
BLOCK PsiElement(if)('if')
IF PsiWhiteSpace(' ')
PsiElement(if)('if') PsiElement(LPAR)('(')
CONDITION
BINARY_EXPRESSION
DOT_QUALIFIED_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('current')
PsiElement(DOT)('.')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('value')
PsiWhiteSpace(' ') PsiWhiteSpace(' ')
PsiElement(LPAR)('(') OPERATION_REFERENCE
CONDITION PsiElement(LT)('<')
BINARY_EXPRESSION PsiWhiteSpace(' ')
DOT_QUALIFIED_EXPRESSION DOT_QUALIFIED_EXPRESSION
REFERENCE_EXPRESSION DOT_QUALIFIED_EXPRESSION
PsiElement(IDENTIFIER)('current') REFERENCE_EXPRESSION
PsiElement(DOT)('.') PsiElement(IDENTIFIER)('current')
REFERENCE_EXPRESSION PsiElement(DOT)('.')
PsiElement(IDENTIFIER)('value') REFERENCE_EXPRESSION
PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('parent')
OPERATION_REFERENCE PsiElement(DOT)('.')
PsiElement(LT)('<') REFERENCE_EXPRESSION
PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('value')
DOT_QUALIFIED_EXPRESSION PsiElement(RPAR)(')')
DOT_QUALIFIED_EXPRESSION 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 REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('current') PsiElement(IDENTIFIER)('current')
PsiElement(DOT)('.') PsiElement(COMMA)(',')
REFERENCE_EXPRESSION PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('parent') VALUE_ARGUMENT
PsiElement(DOT)('.')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('value')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
THEN
FUNCTION_LITERAL_EXPRESSION
FUNCTION_LITERAL
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
BLOCK
DOT_QUALIFIED_EXPRESSION 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 REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('current') PsiElement(IDENTIFIER)('current')
PsiWhiteSpace(' ') PsiElement(DOT)('.')
OPERATION_REFERENCE REFERENCE_EXPRESSION
PsiElement(EQ)('=') PsiElement(IDENTIFIER)('parent')
PsiWhiteSpace(' ') PsiElement(RPAR)(')')
DOT_QUALIFIED_EXPRESSION PsiWhiteSpace('\n ')
REFERENCE_EXPRESSION BINARY_EXPRESSION
PsiElement(IDENTIFIER)('current') REFERENCE_EXPRESSION
PsiElement(DOT)('.') PsiElement(IDENTIFIER)('current')
REFERENCE_EXPRESSION PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('parent') OPERATION_REFERENCE
PsiWhiteSpace('\n ') PsiElement(EQ)('=')
PsiElement(RBRACE)('}') PsiWhiteSpace(' ')
PsiWhiteSpace('\n ') DOT_QUALIFIED_EXPRESSION
PsiElement(RBRACE)('}') REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('current')
PsiElement(DOT)('.')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('parent')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ') PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}') PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ') PsiWhiteSpace('\n\n ')
@@ -488,14 +488,14 @@ public class JetTypeCheckerTest extends LightDaemonAnalyzerTestCase {
private void assertType(String expression, JetType expectedType) { private void assertType(String expression, JetType expectedType) {
Project project = getProject(); Project project = getProject();
JetExpression jetExpression = JetChangeUtil.createExpression(project, expression); 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)); assertTrue(type + " != " + expectedType, type.equals(expectedType));
} }
private void assertErrorType(String expression) { private void assertErrorType(String expression) {
Project project = getProject(); Project project = getProject();
JetExpression jetExpression = JetChangeUtil.createExpression(project, expression); 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)); 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) { private void assertType(JetScope scope, String expression, String expectedTypeStr) {
Project project = getProject(); Project project = getProject();
JetExpression jetExpression = JetChangeUtil.createExpression(project, expression); 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); JetType expectedType = expectedTypeStr == null ? null : makeType(expectedTypeStr);
assertEquals(expectedType, type); assertEquals(expectedType, type);
} }