Skip to content

Commit

Permalink
deprecate unneeded ILazyParseableElementType#parseLight
Browse files Browse the repository at this point in the history
A follow up for:
c2bdba9416046e6ca347e0131ad5672b818da6ea
drop TraverserBasedASTNode and ReadOnlyASTNode Gregory.Shrago 18.11.2019, 16:44

(cherry picked from commit 7a4c5ee275e6d8329ba76b23f146655afb83b3fd)

GitOrigin-RevId: 530dea297a88a557660a2bad1b2fa3d5ef2493b6
  • Loading branch information
gregsh authored and intellij-monorepo-bot committed Feb 12, 2020
1 parent 8edbd0c commit 6f819f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class RegExpFileElementType extends IFileElementType {
}

@Override
public PsiBuilder parseLight(ASTNode chameleon) {
protected ASTNode doParseContents(@NotNull ASTNode chameleon, @NotNull PsiElement outerPsi) {
PsiElement psi = chameleon.getPsi();
Project project = psi.getProject();
Language languageForParser = getLanguageForParser(psi);
Expand All @@ -27,7 +27,7 @@ public PsiBuilder parseLight(ASTNode chameleon) {
PsiParser parser = definition.createParser(project, capabilities);
PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, lexer, languageForParser, chameleon.getChars());
((LightPsiParser)parser).parseLight(this, builder);
return builder;
return builder.getTreeBuilt().getFirstChildNode();
}

@NotNull
Expand All @@ -38,9 +38,4 @@ private static EnumSet<RegExpCapability> setupCapabilities(PsiElement psi, @NotN
RegExpCapabilitiesProvider provider = language == null ? null : RegExpCapabilitiesProvider.EP.forLanguage(language);
return provider == null ? capabilities : EnumSet.copyOf(provider.setup(host, capabilities));
}

@Override
protected ASTNode doParseContents(@NotNull ASTNode chameleon, @NotNull PsiElement psi) {
return parseLight(chameleon).getTreeBuilt().getFirstChildNode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -48,7 +49,12 @@ public ILazyParseableElementType(@NotNull @NonNls final String debugName, @Nulla
*
* @param chameleon the node to parse.
* @return the parsed contents of the node in the form PsiBuilder.
*
* @deprecated Not needed anymore, override {@link ILazyParseableElementType#parseContents(ASTNode)}
* or implement {@link ILightLazyParseableElementType} instead.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2020.3")
public PsiBuilder parseLight(ASTNode chameleon) {
throw new UnsupportedOperationException(String.valueOf(chameleon));
}
Expand Down

0 comments on commit 6f819f9

Please sign in to comment.