Skip to content

Commit

Permalink
Add support for type alias syntax.
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioz committed Oct 20, 2024
1 parent 65c7c63 commit 17618c3
Show file tree
Hide file tree
Showing 20 changed files with 2,874 additions and 2,470 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,8 @@ public Object visitLambda(org.python.pydev.parser.jython.ast.Lambda node) throws
@Override
public Object visitNameTok(NameTok nameTok) throws Exception {
unhandled_node(nameTok);
if (nameTok.ctx == NameTok.VarArg || nameTok.ctx == NameTok.KwArg || nameTok.ctx == NameTok.TypeVarName) {
if (nameTok.ctx == NameTok.VarArg || nameTok.ctx == NameTok.KwArg || nameTok.ctx == NameTok.TypeVarName
|| nameTok.ctx == NameTok.TypeAliasName) {
SourceToken token = AbstractVisitor.makeToken(nameTok, moduleName, nature, this.current);
scope.addToken(token, token, (nameTok).id);
if (checkCurrentScopeForAssignmentsToBuiltins()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
import org.python.pydev.parser.jython.ast.Suite;
import org.python.pydev.parser.jython.ast.TryExcept;
import org.python.pydev.parser.jython.ast.TryFinally;
import org.python.pydev.parser.jython.ast.TypeAlias;
import org.python.pydev.parser.jython.ast.TypeParamsSuite;
import org.python.pydev.parser.jython.ast.TypeVar;
import org.python.pydev.parser.jython.ast.TypeVarTuple;
Expand Down Expand Up @@ -886,4 +887,13 @@ public Object visitTypeParamsSuite(TypeParamsSuite node) throws Exception {
}
return null;
}

@Override
public Object visitTypeAlias(TypeAlias node) throws Exception {
boolean ret = unhandled_node(node);
if (ret) {
traverse(node);
}
return null;
}
}
Loading

0 comments on commit 17618c3

Please sign in to comment.