Add isAsync method to PyWithStatement

This commit is contained in:
Semyon Proshev
2016-12-20 18:21:49 +03:00
committed by Semyon Proshev
parent 437d7ad5fc
commit f54070028a
2 changed files with 10 additions and 2 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -20,4 +20,6 @@ package com.jetbrains.python.psi;
*/
public interface PyWithStatement extends PyStatement, PyNamedElementContainer, PyStatementListContainer {
PyWithItem[] getWithItems();
boolean isAsync();
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -20,6 +20,7 @@ import com.intellij.psi.PsiNamedElement;
import com.intellij.psi.tree.TokenSet;
import com.intellij.psi.util.PsiTreeUtil;
import com.jetbrains.python.PyElementTypes;
import com.jetbrains.python.PyTokenTypes;
import com.jetbrains.python.psi.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -75,4 +76,9 @@ public class PyWithStatementImpl extends PyElementImpl implements PyWithStatemen
assert statementList != null : "Statement list missing for with statement " + getText();
return statementList;
}
@Override
public boolean isAsync() {
return getNode().findChildByType(PyTokenTypes.ASYNC_KEYWORD) != null;
}
}