Removed IDE templates support from compiler.
This commit is contained in:
-11
@@ -30,7 +30,6 @@ import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.diagnostics.*;
|
||||
import org.jetbrains.jet.lang.diagnostics.rendering.DefaultErrorMessages;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.psi.JetIdeTemplate;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzingUtils;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContextUtils;
|
||||
@@ -62,9 +61,6 @@ public final class AnalyzerWithCompilerReport {
|
||||
|
||||
@NotNull
|
||||
private static final DiagnosticFactory0<PsiErrorElement> SYNTAX_ERROR_FACTORY = DiagnosticFactory0.create(Severity.ERROR);
|
||||
@NotNull
|
||||
private static final DiagnosticFactory0<JetIdeTemplate> UNRESOLVED_IDE_TEMPLATE_ERROR_FACTORY
|
||||
= DiagnosticFactory0.create(Severity.ERROR);
|
||||
|
||||
private boolean hasErrors = false;
|
||||
@NotNull
|
||||
@@ -201,13 +197,6 @@ public final class AnalyzerWithCompilerReport {
|
||||
hasErrors = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitIdeTemplate(JetIdeTemplate expression) {
|
||||
String placeholderText = expression.getPlaceholderText();
|
||||
reportDiagnostic(expression, UNRESOLVED_IDE_TEMPLATE_ERROR_FACTORY,
|
||||
"Unresolved IDE template" + (StringUtil.isEmpty(placeholderText) ? "" : ": " + placeholderText));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitErrorElement(PsiErrorElement element) {
|
||||
String description = element.getErrorDescription();
|
||||
|
||||
@@ -148,8 +148,6 @@ public interface JetNodeTypes {
|
||||
JetNodeType NAMESPACE_HEADER = new JetNodeType("NAMESPACE_HEADER", JetNamespaceHeader.class);
|
||||
JetNodeType SCRIPT = new JetNodeType("SCRIPT", JetScript.class);
|
||||
|
||||
JetNodeType IDE_TEMPLATE_EXPRESSION = new JetNodeType("IDE_TEMPLATE_EXPRESSION", JetIdeTemplate.class);
|
||||
|
||||
IFileElementType TYPE_CODE_FRAGMENT = new JetTypeCodeFragmentType();
|
||||
IFileElementType EXPRESSION_CODE_FRAGMENT = new JetExpressionCodeFragmentType();
|
||||
}
|
||||
|
||||
@@ -71,7 +71,6 @@ public abstract class AbstractDiagnostic<E extends PsiElement> implements Parame
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
if (!getFactory().isValid(this)) return false;
|
||||
if (psiElement.getNode().findChildByType(JetNodeTypes.IDE_TEMPLATE_EXPRESSION) != null) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,8 +106,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
||||
IDENTIFIER, // SimpleName
|
||||
FIELD_IDENTIFIER, // Field reference
|
||||
|
||||
PACKAGE_KEYWORD, // for absolute qualified names
|
||||
IDE_TEMPLATE_START
|
||||
PACKAGE_KEYWORD // for absolute qualified names
|
||||
);
|
||||
|
||||
private static final TokenSet STATEMENT_FIRST = TokenSet.orSet(
|
||||
@@ -125,7 +124,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
||||
);
|
||||
|
||||
/*package*/ static final TokenSet EXPRESSION_FOLLOW = TokenSet.create(
|
||||
SEMICOLON, ARROW, COMMA, RBRACE, RPAR, RBRACKET, IDE_TEMPLATE_END
|
||||
SEMICOLON, ARROW, COMMA, RBRACE, RPAR, RBRACKET
|
||||
);
|
||||
|
||||
@SuppressWarnings({"UnusedDeclaration"})
|
||||
@@ -532,9 +531,6 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
||||
if (at(LPAR)) {
|
||||
parseParenthesizedExpression();
|
||||
}
|
||||
else if (at(IDE_TEMPLATE_START)) {
|
||||
myJetParsing.parseIdeTemplate();
|
||||
}
|
||||
else if (at(HASH)) {
|
||||
parseTupleExpression();
|
||||
}
|
||||
@@ -820,14 +816,13 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
||||
* : whenCondition{","} "->" element SEMI
|
||||
*/
|
||||
private void parseWhenEntryNotElse() {
|
||||
if (!myJetParsing.parseIdeTemplate()) {
|
||||
while (true) {
|
||||
while (at(COMMA)) errorAndAdvance("Expecting a when-condition");
|
||||
parseWhenCondition();
|
||||
if (!at(COMMA)) break;
|
||||
advance(); // COMMA
|
||||
}
|
||||
while (true) {
|
||||
while (at(COMMA)) errorAndAdvance("Expecting a when-condition");
|
||||
parseWhenCondition();
|
||||
if (!at(COMMA)) break;
|
||||
advance(); // COMMA
|
||||
}
|
||||
|
||||
expect(ARROW, "Expecting '->' or 'when'", WHEN_CONDITION_RECOVERY_SET);
|
||||
if (atSet(WHEN_CONDITION_RECOVERY_SET)) {
|
||||
error("Expecting an element");
|
||||
@@ -1359,9 +1354,8 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
||||
parameter.done(MULTI_VARIABLE_DECLARATION);
|
||||
}
|
||||
else {
|
||||
if (!myJetParsing.parseIdeTemplate()) {
|
||||
expect(IDENTIFIER, "Expecting a variable name", TokenSet.create(COLON));
|
||||
}
|
||||
expect(IDENTIFIER, "Expecting a variable name", TokenSet.create(COLON));
|
||||
|
||||
if (at(COLON)) {
|
||||
advance(); // COLON
|
||||
myJetParsing.parseTypeRef(TokenSet.create(IN_KEYWORD));
|
||||
|
||||
@@ -465,9 +465,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
assert _atSet(CLASS_KEYWORD, TRAIT_KEYWORD);
|
||||
advance(); // CLASS_KEYWORD or TRAIT_KEYWORD
|
||||
|
||||
if (!parseIdeTemplate()) {
|
||||
expect(IDENTIFIER, "Class name expected", CLASS_NAME_RECOVERY_SET);
|
||||
}
|
||||
expect(IDENTIFIER, "Class name expected", CLASS_NAME_RECOVERY_SET);
|
||||
boolean typeParametersDeclared = parseTypeParameterList(TYPE_PARAMETER_GT_RECOVERY_SET);
|
||||
|
||||
PsiBuilder.Marker beforeConstructorModifiers = mark();
|
||||
@@ -525,31 +523,29 @@ public class JetParsing extends AbstractJetParsing {
|
||||
myBuilder.enableNewlines();
|
||||
advance(); // LBRACE
|
||||
|
||||
if (!parseIdeTemplate()) {
|
||||
while (!eof() && !at(RBRACE)) {
|
||||
PsiBuilder.Marker entryOrMember = mark();
|
||||
while (!eof() && !at(RBRACE)) {
|
||||
PsiBuilder.Marker entryOrMember = mark();
|
||||
|
||||
TokenSet constructorNameFollow = TokenSet.create(SEMICOLON, COLON, LPAR, LT, LBRACE);
|
||||
int lastId = findLastBefore(ENUM_MEMBER_FIRST, constructorNameFollow, false);
|
||||
TokenDetector enumDetector = new TokenDetector(ENUM_KEYWORD);
|
||||
createTruncatedBuilder(lastId).parseModifierList(MODIFIER_LIST, enumDetector, false);
|
||||
TokenSet constructorNameFollow = TokenSet.create(SEMICOLON, COLON, LPAR, LT, LBRACE);
|
||||
int lastId = findLastBefore(ENUM_MEMBER_FIRST, constructorNameFollow, false);
|
||||
TokenDetector enumDetector = new TokenDetector(ENUM_KEYWORD);
|
||||
createTruncatedBuilder(lastId).parseModifierList(MODIFIER_LIST, enumDetector, false);
|
||||
|
||||
IElementType type;
|
||||
if (at(IDENTIFIER)) {
|
||||
parseEnumEntry();
|
||||
type = ENUM_ENTRY;
|
||||
}
|
||||
else {
|
||||
type = parseMemberDeclarationRest(enumDetector.isDetected());
|
||||
}
|
||||
IElementType type;
|
||||
if (at(IDENTIFIER)) {
|
||||
parseEnumEntry();
|
||||
type = ENUM_ENTRY;
|
||||
}
|
||||
else {
|
||||
type = parseMemberDeclarationRest(enumDetector.isDetected());
|
||||
}
|
||||
|
||||
if (type == null) {
|
||||
errorAndAdvance("Expecting an enum entry or member declaration");
|
||||
entryOrMember.drop();
|
||||
}
|
||||
else {
|
||||
entryOrMember.done(type);
|
||||
}
|
||||
if (type == null) {
|
||||
errorAndAdvance("Expecting an enum entry or member declaration");
|
||||
entryOrMember.drop();
|
||||
}
|
||||
else {
|
||||
entryOrMember.done(type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -595,13 +591,11 @@ public class JetParsing extends AbstractJetParsing {
|
||||
myBuilder.enableNewlines();
|
||||
expect(LBRACE, "Expecting a class body", TokenSet.create(LBRACE));
|
||||
|
||||
if (!parseIdeTemplate()) {
|
||||
while (!eof()) {
|
||||
if (at(RBRACE)) {
|
||||
break;
|
||||
}
|
||||
parseMemberDeclaration();
|
||||
while (!eof()) {
|
||||
if (at(RBRACE)) {
|
||||
break;
|
||||
}
|
||||
parseMemberDeclaration();
|
||||
}
|
||||
expect(RBRACE, "Missing '}");
|
||||
myBuilder.restoreNewlinesState();
|
||||
@@ -689,9 +683,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
|
||||
if (named) {
|
||||
PsiBuilder.Marker propertyDeclaration = mark();
|
||||
if (!parseIdeTemplate()) {
|
||||
expect(IDENTIFIER, "Expecting object name", TokenSet.create(LBRACE));
|
||||
}
|
||||
expect(IDENTIFIER, "Expecting object name", TokenSet.create(LBRACE));
|
||||
propertyDeclaration.done(OBJECT_DECLARATION_NAME);
|
||||
}
|
||||
else {
|
||||
@@ -879,9 +871,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
if (at(COLON)) {
|
||||
PsiBuilder.Marker type = mark();
|
||||
advance(); // COLON
|
||||
if (!parseIdeTemplate()) {
|
||||
parseTypeRef();
|
||||
}
|
||||
parseTypeRef();
|
||||
errorIf(type, multiDeclaration, "Type annotations are not allowed on multi-declarations");
|
||||
}
|
||||
|
||||
@@ -1097,9 +1087,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
if (at(COLON)) {
|
||||
advance(); // COLON
|
||||
|
||||
if (!parseIdeTemplate()) {
|
||||
parseTypeRef();
|
||||
}
|
||||
parseTypeRef();
|
||||
}
|
||||
|
||||
parseTypeConstraintsGuarded(typeParameterListOccurred);
|
||||
@@ -1122,20 +1110,14 @@ public class JetParsing extends AbstractJetParsing {
|
||||
parseAnnotations(false);
|
||||
}
|
||||
else {
|
||||
if (parseIdeTemplate()) {
|
||||
expect(DOT, "Expecting '.' after receiver template");
|
||||
createTruncatedBuilder(lastDot).parseTypeRef();
|
||||
|
||||
if (atSet(RECEIVER_TYPE_TERMINATORS)) {
|
||||
advance(); // expectation
|
||||
}
|
||||
else {
|
||||
createTruncatedBuilder(lastDot).parseTypeRef();
|
||||
|
||||
if (atSet(RECEIVER_TYPE_TERMINATORS)) {
|
||||
advance(); // expectation
|
||||
}
|
||||
else {
|
||||
errorWithRecovery("Expecting '.' before a " + title + " name", nameFollow);
|
||||
}
|
||||
errorWithRecovery("Expecting '.' before a " + title + " name", nameFollow);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1144,14 +1126,10 @@ public class JetParsing extends AbstractJetParsing {
|
||||
*/
|
||||
private void parseFunctionOrPropertyName(boolean receiverFound, String title, TokenSet nameFollow) {
|
||||
if (!receiverFound) {
|
||||
if (!parseIdeTemplate()) {
|
||||
expect(IDENTIFIER, "Expecting " + title + " name or receiver type", nameFollow);
|
||||
}
|
||||
expect(IDENTIFIER, "Expecting " + title + " name or receiver type", nameFollow);
|
||||
}
|
||||
else {
|
||||
if (!parseIdeTemplate()) {
|
||||
expect(IDENTIFIER, "Expecting " + title + " name", nameFollow);
|
||||
}
|
||||
expect(IDENTIFIER, "Expecting " + title + " name", nameFollow);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1702,32 +1680,30 @@ public class JetParsing extends AbstractJetParsing {
|
||||
myBuilder.disableNewlines();
|
||||
advance(); // LPAR
|
||||
|
||||
if (!parseIdeTemplate()) {
|
||||
if (!at(RPAR) && !atSet(recoverySet)) {
|
||||
while (true) {
|
||||
if (at(COMMA)) {
|
||||
errorAndAdvance("Expecting a parameter declaration");
|
||||
}
|
||||
else if (at(RPAR)) {
|
||||
error("Expecting a parameter declaration");
|
||||
break;
|
||||
}
|
||||
if (isFunctionTypeContents) {
|
||||
if (!tryParseValueParameter()) {
|
||||
PsiBuilder.Marker valueParameter = mark();
|
||||
parseModifierList(MODIFIER_LIST, false); // lazy, out, ref
|
||||
parseTypeRef();
|
||||
valueParameter.done(VALUE_PARAMETER);
|
||||
}
|
||||
}
|
||||
else {
|
||||
parseValueParameter();
|
||||
}
|
||||
if (at(COMMA)) {
|
||||
advance(); // COMMA
|
||||
}
|
||||
else if (!atSet(VALUE_PARAMETER_FIRST)) break;
|
||||
if (!at(RPAR) && !atSet(recoverySet)) {
|
||||
while (true) {
|
||||
if (at(COMMA)) {
|
||||
errorAndAdvance("Expecting a parameter declaration");
|
||||
}
|
||||
else if (at(RPAR)) {
|
||||
error("Expecting a parameter declaration");
|
||||
break;
|
||||
}
|
||||
if (isFunctionTypeContents) {
|
||||
if (!tryParseValueParameter()) {
|
||||
PsiBuilder.Marker valueParameter = mark();
|
||||
parseModifierList(MODIFIER_LIST, false); // lazy, out, ref
|
||||
parseTypeRef();
|
||||
valueParameter.done(VALUE_PARAMETER);
|
||||
}
|
||||
}
|
||||
else {
|
||||
parseValueParameter();
|
||||
}
|
||||
if (at(COMMA)) {
|
||||
advance(); // COMMA
|
||||
}
|
||||
else if (!atSet(VALUE_PARAMETER_FIRST)) break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1803,29 +1779,6 @@ public class JetParsing extends AbstractJetParsing {
|
||||
return noErrors;
|
||||
}
|
||||
|
||||
/*
|
||||
* "<#<" expression ">#>"
|
||||
*/
|
||||
boolean parseIdeTemplate() {
|
||||
@Nullable JetNodeType nodeType = IDE_TEMPLATE_EXPRESSION;
|
||||
if (at(IDE_TEMPLATE_START)) {
|
||||
PsiBuilder.Marker mark = null;
|
||||
if (nodeType != null) {
|
||||
mark = mark();
|
||||
}
|
||||
advance();
|
||||
expect(IDENTIFIER, "Expecting identifier inside template");
|
||||
expect(IDE_TEMPLATE_END, "Expecting IDE template end after identifier");
|
||||
if (nodeType != null) {
|
||||
mark.done(nodeType);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JetParsing create(SemanticWhitespaceAwarePsiBuilder builder) {
|
||||
return createForTopLevel(builder);
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.lang.psi;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lexer.JetTokens;
|
||||
|
||||
public class JetIdeTemplate extends JetElementImpl {
|
||||
public JetIdeTemplate(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(@NotNull JetVisitorVoid visitor) {
|
||||
visitor.visitIdeTemplate(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, D> R accept(@NotNull JetVisitor<R, D> visitor, D data) {
|
||||
return visitor.visitIdeTemplate(this, data);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getPlaceholderText() {
|
||||
PsiElement idElement = findChildByType(JetTokens.IDENTIFIER);
|
||||
return idElement == null ? null : idElement.getText();
|
||||
}
|
||||
}
|
||||
@@ -273,10 +273,6 @@ public class JetVisitor<R, D> extends PsiElementVisitor {
|
||||
return visitExpression(expression, data);
|
||||
}
|
||||
|
||||
public R visitIdeTemplate(JetIdeTemplate expression, D data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public R visitCatchSection(JetCatchClause catchClause, D data) {
|
||||
return visitJetElement(catchClause, data);
|
||||
}
|
||||
|
||||
@@ -263,9 +263,6 @@ public class JetVisitorVoid extends PsiElementVisitor {
|
||||
visitExpression(expression);
|
||||
}
|
||||
|
||||
public void visitIdeTemplate(JetIdeTemplate expression) {
|
||||
}
|
||||
|
||||
public void visitCatchSection(JetCatchClause catchClause) {
|
||||
visitJetElement(catchClause);
|
||||
}
|
||||
|
||||
@@ -17,16 +17,13 @@
|
||||
package org.jetbrains.jet.lang.resolve;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.PsiErrorElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.diagnostics.Diagnostic;
|
||||
import org.jetbrains.jet.lang.diagnostics.DiagnosticHolder;
|
||||
import org.jetbrains.jet.lang.diagnostics.DiagnosticUtils;
|
||||
import org.jetbrains.jet.lang.psi.JetIdeTemplate;
|
||||
import org.jetbrains.jet.lang.psi.JetTreeVisitorVoid;
|
||||
import org.jetbrains.jet.lang.psi.JetVisitorVoid;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
-5
@@ -33,11 +33,6 @@ import static org.jetbrains.jet.lang.diagnostics.Errors.TYPECHECKER_HAS_RUN_INTO
|
||||
|
||||
public class ExpressionTypingVisitorDispatcher extends JetVisitor<JetTypeInfo, ExpressionTypingContext> implements ExpressionTypingInternals {
|
||||
|
||||
@Override
|
||||
public JetTypeInfo visitIdeTemplate(JetIdeTemplate expression, ExpressionTypingContext data) {
|
||||
return basic.visitIdeTemplate(expression, data);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static ExpressionTypingFacade create(@NotNull PlatformToKotlinClassMap platformToKotlinClassMap) {
|
||||
return new ExpressionTypingVisitorDispatcher(platformToKotlinClassMap, null);
|
||||
|
||||
@@ -268,8 +268,6 @@ LONG_TEMPLATE_ENTRY_END=\}
|
||||
\!in{IDENTIFIER_PART} { yypushback(3); return JetTokens.EXCL; }
|
||||
\!is{IDENTIFIER_PART} { yypushback(3); return JetTokens.EXCL; }
|
||||
|
||||
"<#<" { return JetTokens.IDE_TEMPLATE_START ; }
|
||||
">#>" { return JetTokens.IDE_TEMPLATE_END ; }
|
||||
"===" { return JetTokens.EQEQEQ ; }
|
||||
"!==" { return JetTokens.EXCLEQEQEQ; }
|
||||
"!in" { return JetTokens.NOT_IN; }
|
||||
|
||||
@@ -132,9 +132,6 @@ public interface JetTokens {
|
||||
JetToken AT = new JetToken("AT");
|
||||
JetToken ATAT = new JetToken("ATAT");
|
||||
|
||||
JetToken IDE_TEMPLATE_START = new JetToken("IDE_TEMPLATE_START");
|
||||
JetToken IDE_TEMPLATE_END = new JetToken("IDE_TEMPLATE_END");
|
||||
|
||||
TokenSet LABELS = TokenSet.create(AT, ATAT, LABEL_IDENTIFIER);
|
||||
|
||||
JetToken COMMA = new JetToken("COMMA");
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,41 +0,0 @@
|
||||
fun main(args : Array<String>) {
|
||||
if (<#<condition>#>) {
|
||||
<#<block>#>
|
||||
} else {
|
||||
<#<block>#>
|
||||
}
|
||||
|
||||
fun <#<name>#>(<#<params>#>) : <#<returnType>#> {
|
||||
<#<body>#>
|
||||
}
|
||||
|
||||
for (<#<i>#> in <#<elements>#>) {
|
||||
<#<body>#>
|
||||
}
|
||||
|
||||
when (<#<expression>#>) {
|
||||
<#<condition>#> -> <#<value>#>
|
||||
else -> <#<elseValue>#>
|
||||
}
|
||||
|
||||
var <#<name>#> = <#<value>#>
|
||||
|
||||
class <#<name>#> {
|
||||
<#<body>#>
|
||||
}
|
||||
|
||||
class <#<name>#> {
|
||||
var <#<name>#> : <#<varType>#>
|
||||
get() {
|
||||
<#<body>#>
|
||||
}
|
||||
set(value) {
|
||||
<#<body>#>
|
||||
}
|
||||
|
||||
val <#<name>#> : <#<valType>#>
|
||||
get() {
|
||||
<#<body>#>
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (2, 9) Unresolved IDE template: condition
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (3, 9) Unresolved IDE template: block
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (5, 9) Unresolved IDE template: block
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (8, 9) Unresolved IDE template: name
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (8, 20) Unresolved IDE template: params
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (8, 36) Unresolved IDE template: returnType
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (9, 9) Unresolved IDE template: body
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (12, 10) Unresolved IDE template: i
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (12, 21) Unresolved IDE template: elements
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (13, 9) Unresolved IDE template: body
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (16, 11) Unresolved IDE template: expression
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (17, 9) Unresolved IDE template: condition
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (17, 28) Unresolved IDE template: value
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (18, 17) Unresolved IDE template: elseValue
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (21, 9) Unresolved IDE template: name
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (21, 22) Unresolved IDE template: value
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (23, 11) Unresolved IDE template: name
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (24, 9) Unresolved IDE template: body
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (27, 11) Unresolved IDE template: name
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (28, 13) Unresolved IDE template: name
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (28, 26) Unresolved IDE template: varType
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (30, 13) Unresolved IDE template: body
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (33, 13) Unresolved IDE template: body
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (36, 13) Unresolved IDE template: name
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (36, 26) Unresolved IDE template: valType
|
||||
ERROR: $TESTDATA_DIR$/ideTemplates.kt: (38, 13) Unresolved IDE template: body
|
||||
COMPILATION_ERROR
|
||||
@@ -1,42 +0,0 @@
|
||||
fun main(args : Array<String>) {
|
||||
if (<#<condition>#>) {
|
||||
<#<block>#>
|
||||
} else {
|
||||
<#<block>#>
|
||||
}
|
||||
|
||||
fun <#<name>#>(<#<params>#>) : <#<returnType>#> {
|
||||
<#<body>#>
|
||||
}
|
||||
|
||||
for (<#<i>#> in <#<elements>#>) {
|
||||
<#<body>#>
|
||||
}
|
||||
|
||||
when (<#<expression>#>) {
|
||||
<#<condition>#> -> <#<value>#>
|
||||
else -> <#<elseValue>#>
|
||||
}
|
||||
|
||||
var <#<name>#> = <#<value>#>
|
||||
|
||||
class <#<name>#> {
|
||||
<#<body>#>
|
||||
}
|
||||
|
||||
class <#<name>#> {
|
||||
var <#<name>#> : <#<varType>#>
|
||||
get() {
|
||||
<#<body>#>
|
||||
}
|
||||
set(value) {
|
||||
<#<body>#>
|
||||
}
|
||||
|
||||
val <#<name>#> : <#<valType>#>
|
||||
get() {
|
||||
<#<body>#>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,294 +0,0 @@
|
||||
JetFile: IdeTemplates.jet
|
||||
NAMESPACE_HEADER
|
||||
<empty list>
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('main')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('args')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Array')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('String')
|
||||
PsiElement(GT)('>')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
IF
|
||||
PsiElement(if)('if')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(LPAR)('(')
|
||||
CONDITION
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('condition')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
THEN
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('block')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(else)('else')
|
||||
PsiWhiteSpace(' ')
|
||||
ELSE
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('block')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('name')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('params')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('returnType')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('body')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
FOR
|
||||
PsiElement(for)('for')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(LPAR)('(')
|
||||
LOOP_PARAMETER
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('i')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(in)('in')
|
||||
PsiWhiteSpace(' ')
|
||||
LOOP_RANGE
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('elements')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BODY
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('body')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
WHEN
|
||||
PsiElement(when)('when')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(LPAR)('(')
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('expression')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
WHEN_ENTRY
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('condition')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('value')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiWhiteSpace('\n ')
|
||||
WHEN_ENTRY
|
||||
PsiElement(else)('else')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('elseValue')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PROPERTY
|
||||
PsiElement(var)('var')
|
||||
PsiWhiteSpace(' ')
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('name')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('value')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('name')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_PARAMETER_LIST
|
||||
<empty list>
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('body')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('name')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_PARAMETER_LIST
|
||||
<empty list>
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
PROPERTY
|
||||
PsiElement(var)('var')
|
||||
PsiWhiteSpace(' ')
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('name')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('varType')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiWhiteSpace('\n ')
|
||||
PROPERTY_ACCESSOR
|
||||
PsiElement(get)('get')
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('body')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
PROPERTY_ACCESSOR
|
||||
PsiElement(set)('set')
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER_LIST
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('value')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('body')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('name')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('valType')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiWhiteSpace('\n ')
|
||||
PROPERTY_ACCESSOR
|
||||
PsiElement(get)('get')
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
IDE_TEMPLATE_EXPRESSION
|
||||
PsiElement(IDE_TEMPLATE_START)('<#<')
|
||||
PsiElement(IDENTIFIER)('body')
|
||||
PsiElement(IDE_TEMPLATE_END)('>#>')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -152,11 +152,6 @@ public class CliTest {
|
||||
executeCompilerCompareOutput(new String[]{ "-script", "compiler/testData/cli/script.ktscript", "hi", "there" });
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ideTemplates() {
|
||||
executeCompilerCompareOutput(new String[]{ "-src", "compiler/testData/cli/ideTemplates.kt", "-output", tmpdir.getTmpDir().getPath()});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void wrongArgument() {
|
||||
executeCompilerCompareOutput(new String[] { "-wrongArgument" });
|
||||
|
||||
@@ -31,7 +31,6 @@ import org.jetbrains.jet.JetTestCaseBuilder;
|
||||
import org.jetbrains.jet.lang.parsing.JetParserDefinition;
|
||||
import org.jetbrains.jet.lang.psi.IfNotParsed;
|
||||
import org.jetbrains.jet.lang.psi.JetElement;
|
||||
import org.jetbrains.jet.lang.psi.JetIdeTemplate;
|
||||
import org.jetbrains.jet.lang.psi.JetVisitorVoid;
|
||||
|
||||
import java.io.File;
|
||||
@@ -102,11 +101,10 @@ public class JetParsingTest extends ParsingTestCase {
|
||||
if (result == null) {
|
||||
for (Annotation annotation : method.getDeclaredAnnotations()) {
|
||||
if (annotation instanceof IfNotParsed) {
|
||||
assertTrue(
|
||||
assertNotNull(
|
||||
"Incomplete operation in parsed OK test, method " + methodName +
|
||||
" in " + declaringClass.getSimpleName() + " returns null. Element text: \n" + elem.getText(),
|
||||
PsiTreeUtil.findChildOfType(elem, PsiErrorElement.class) == null
|
||||
|| PsiTreeUtil.findChildOfType(elem, JetIdeTemplate.class) == null);
|
||||
PsiTreeUtil.findChildOfType(elem, PsiErrorElement.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user