-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[2020.3 compat] remove obsolete
StatementParsing.FUTURE
flag from s…
…dkcompat The flag is nonexistent in the sdk for 2020.3. The flag has been used previously for Python 2.6 support of `__future__` imports of `print_function` but [is obsolete](JetBrains/intellij-community@7ec52fb) since 2.6 support has been dropped [since 2019.1](https://github.com/JetBrains/intellij-community/blob/a251e6a423baa93fc6fd85038ec9ccec63fc2797/python/python-psi-api/src/com/jetbrains/python/psi/LanguageLevel.java) For reasons of having a simple implementation of compatibility with old sdks and reducing the maintenance burden we chose to pass the StatementParsing.FUTURE as null for versions < 203. PiperOrigin-RevId: 357909336
- Loading branch information
1 parent
a43003d
commit f1c5601
Showing
8 changed files
with
104 additions
and
27 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
sdkcompat/v193/com/google/idea/sdkcompat/python/ParsingContextAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.google.idea.sdkcompat.python; | ||
|
||
import com.intellij.lang.PsiBuilder; | ||
import com.jetbrains.python.parsing.ParsingContext; | ||
import com.jetbrains.python.psi.LanguageLevel; | ||
|
||
/** Compatibility adapter for {@link ParsingContext}. #api202 */ | ||
public class ParsingContextAdapter extends ParsingContext { | ||
/** #api202: Constructor does NOT accept the additional futureFlag parameter anymore in 2020.3 */ | ||
public ParsingContextAdapter(PsiBuilder builder, LanguageLevel languageLevel) { | ||
// For reasons of having a simple implementation of compatibility with old sdks and reducing the | ||
// maintenance burden we chose to pass the StatementParsing.FUTURE as null for versions < 203. | ||
// we expect this to only impact python versions below 2.7. | ||
// Python 2.67, the last version below 2.7, is officially unsupported | ||
// and a potential security risk context: https://www.python.org/downloads/release/python-267/ | ||
|
||
super(builder, languageLevel, /* futureFlag= */ null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
sdkcompat/v201/com/google/idea/sdkcompat/python/ParsingContextAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.google.idea.sdkcompat.python; | ||
|
||
import com.intellij.lang.PsiBuilder; | ||
import com.jetbrains.python.parsing.ParsingContext; | ||
import com.jetbrains.python.psi.LanguageLevel; | ||
|
||
/** Compatibility adapter for {@link ParsingContext}. #api202 */ | ||
public class ParsingContextAdapter extends ParsingContext { | ||
/** #api202: Constructor does NOT accept the additional futureFlag parameter anymore in 2020.3 */ | ||
public ParsingContextAdapter(PsiBuilder builder, LanguageLevel languageLevel) { | ||
// For reasons of having a simple implementation of compatibility with old sdks and reducing the | ||
// maintenance burden we chose to pass the StatementParsing.FUTURE as null for versions < 203. | ||
// we expect this to only impact python versions below 2.7. | ||
// Python 2.67, the last version below 2.7, is officially unsupported | ||
// and a potential security risk context: https://www.python.org/downloads/release/python-267/ | ||
|
||
super(builder, languageLevel, /* futureFlag= */ null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
sdkcompat/v202/com/google/idea/sdkcompat/python/ParsingContextAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.google.idea.sdkcompat.python; | ||
|
||
import com.intellij.lang.SyntaxTreeBuilder; | ||
import com.jetbrains.python.parsing.ParsingContext; | ||
import com.jetbrains.python.psi.LanguageLevel; | ||
|
||
/** Compatibility adapter for {@link ParsingContext}. #api202 */ | ||
public class ParsingContextAdapter extends ParsingContext { | ||
/** #api202: Constructor does NOT accept the additional futureFlag parameter anymore in 2020.3 */ | ||
public ParsingContextAdapter(SyntaxTreeBuilder builder, LanguageLevel languageLevel) { | ||
// For reasons of having a simple implementation of compatibility with old sdks and reducing the | ||
// maintenance burden we chose to pass the StatementParsing.FUTURE as null for versions < 203. | ||
// we expect this to only impact python versions below 2.7. | ||
// Python 2.67, the last version below 2.7, is officially unsupported | ||
// and a potential security risk context: https://www.python.org/downloads/release/python-267/ | ||
|
||
super(builder, languageLevel, /* futureFlag= */ null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
sdkcompat/v203/com/google/idea/sdkcompat/python/ParsingContextAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.google.idea.sdkcompat.python; | ||
|
||
import com.intellij.lang.SyntaxTreeBuilder; | ||
import com.jetbrains.python.parsing.ParsingContext; | ||
import com.jetbrains.python.psi.LanguageLevel; | ||
|
||
/** Compatibility adapter for {@link ParsingContext}. #api202 */ | ||
public class ParsingContextAdapter extends ParsingContext { | ||
/** #api202: Constructor does NOT accept the additional futureFlag parameter anymore in 2020.3 */ | ||
public ParsingContextAdapter(SyntaxTreeBuilder builder, LanguageLevel languageLevel) { | ||
super(builder, languageLevel); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters