public override object VisitDotExpression([NotNull] DoshikParser.DotExpressionContext context) { SetWholeExpression(context); VisitChildren(context); _compilationContext.SetParsingAntlrContext(context); var node = new DotExpressionNode(context); node.Left = Sequence.FindExpressionByAntlrContext(context.left); if (node.Left is IdentifierExpressionNode leftIdentifier) { // Устанавливаем флаг того, что этот идентификатор был упомянут как левая часть в dot expression // это нужно, т.к. далее при преобразовании ноды в expression (expression tree domain) в случае если этот идентификатор // является левой часть dot выражения, значит его стоит в первую очередь пытаться воспринять как тип а во вторую очередь как имя переменной // во всех остальных же случаях это всегда должно быть имя переменной leftIdentifier.IsLeftOfDotExpression = true; } if (context.rightIdentifier != null) { node.RightIdentifier = context.rightIdentifier.Text; } else { node.RightMethodCallData = new MethodCallExpressionNodeData(); GetMethodCallData(context.rightMethodCall, node.RightMethodCallData); } Sequence.Sequence.Add(node); return(null); }
/// <summary> /// Visit a parse tree produced by the <c>dotExpression</c> /// labeled alternative in <see cref="DoshikParser.expression"/>. /// <para> /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/> /// on <paramref name="context"/>. /// </para> /// </summary> /// <param name="context">The parse tree.</param> /// <return>The visitor result.</return> public virtual Result VisitDotExpression([NotNull] DoshikParser.DotExpressionContext context) { return(VisitChildren(context)); }
/// <summary> /// Exit a parse tree produced by the <c>dotExpression</c> /// labeled alternative in <see cref="DoshikParser.expression"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitDotExpression([NotNull] DoshikParser.DotExpressionContext context) { }