_Core/Lang/AST/Statements/Stmt.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ComLib.Lang
{
    /// <summary>
    /// Base class for statements.
    /// </summary>
    public class Stmt : AstNode
    {
        /// <summary>
        /// Parent of this statement
        /// </summary>
        public Stmt Parent { get; set; }


        /// <summary>
        /// The symbol scope associated w/ this instance.
        /// </summary>
        public ISymbols SymScope { get; set; }


        /// <summary>
        /// Whether or not this statement can be executed immediately at parsing time
        /// e.g. useful for function declaration statements among other future planned features.
        /// </summary>
        public bool IsImmediatelyExecutable { get; set; }


        /// <summary>
        /// Internal method to wrap statement executions around the callbacks.
        /// </summary>
        public virtual void DoExecute()
        {            
        }


        /// <summary>
        /// Executes the statement.
        /// </summary>
        public virtual void Execute()
        {           
            if (this.Ctx != null && this.Ctx.Callbacks.HasAny)
            {
                Ctx.Callbacks.Notify("statement-on-before-execute", this, this);
                DoExecute();
                Ctx.Callbacks.Notify("statement-on-after-execute", this, this);
                return;
            }
            DoExecute();
        }


        /// <summary>
        /// Finds the first parent that is of type T.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
后面还有 39 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。