コード例 #1
0
        public override ASTNode VisitExternFunctionDecl(DaedalusParser.ExternFunctionDeclContext context)
        {
            NameNode typeNameNode = new NameNode(GetLocation(context.dataType()), context.dataType().GetText());
            NameNode nameNode     = new NameNode(GetLocation(context.nameNode()), context.nameNode().GetText());

            List <ParameterDeclarationNode> varDeclarationNodes = new List <ParameterDeclarationNode>();

            foreach (DaedalusParser.ParameterDeclContext parameterDeclContext in context.parameterList().parameterDecl())
            {
                varDeclarationNodes.Add((ParameterDeclarationNode)VisitParameterDecl(parameterDeclContext));
            }

            return(new FunctionDefinitionNode(GetLocation(context), typeNameNode, nameNode, varDeclarationNodes, new List <StatementNode>(), true));
        }
コード例 #2
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="DaedalusParser.externFunctionDecl"/>.
 /// <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 VisitExternFunctionDecl([NotNull] DaedalusParser.ExternFunctionDeclContext context)
 {
     return(VisitChildren(context));
 }