Changeset View
Changeset View
Standalone View
Standalone View
parser/astbuilder.cpp
Context not available. | |||||
398 | }; | 398 | }; | ||
---|---|---|---|---|---|
399 | }; | 399 | }; | ||
400 | 400 | | |||
401 | #undef arg // Python defines one, but I want to use QString::arg here | ||||
402 | | ||||
403 | class LambdaIdVisitor : public AstDefaultVisitor { | ||||
404 | public: | ||||
405 | using AstDefaultVisitor::AstDefaultVisitor; | ||||
406 | void visitLambda(Python::LambdaAst* node) override { | ||||
407 | AstDefaultVisitor::visitLambda(node); | ||||
408 | // The tooltip breaks with colons, hence '|'. Not worth fixing; shouldn't really be shown at all. | ||||
409 | auto id = QStringLiteral("<lambda|%1|%2>").arg(node->startLine).arg(node->startCol); | ||||
410 | node->lambda_id = new Identifier(id); | ||||
411 | node->lambda_id->parent = node; | ||||
412 | node->lambda_id->startLine = node->lambda_id->endLine = node->startLine; | ||||
413 | node->lambda_id->startCol = node->startCol; | ||||
414 | node->lambda_id->endCol = node->startCol + 5; // len("lambda") - 1 | ||||
415 | }; | ||||
416 | }; | ||||
417 | | ||||
401 | #include "generated.h" | 418 | #include "generated.h" | ||
402 | 419 | | |||
403 | QMutex AstBuilder::pyInitLock; | 420 | QMutex AstBuilder::pyInitLock; | ||
Context not available. | |||||
706 | 723 | | |||
707 | cythonSyntaxRemover.fixAstRanges(t.ast); | 724 | cythonSyntaxRemover.fixAstRanges(t.ast); | ||
708 | 725 | | |||
726 | LambdaIdVisitor lambdaVisitor; | ||||
727 | lambdaVisitor.visitNode(t.ast); | ||||
728 | | ||||
709 | return CodeAst::Ptr(t.ast); | 729 | return CodeAst::Ptr(t.ast); | ||
710 | } | 730 | } | ||
711 | 731 | | |||
Context not available. |