示例#1
0
文件: 变量.cs 项目: qipa/InnerC
        public 变量声明和初始化 Get_变量声明()
        {
            变量声明和初始化 变量声明 = this.作用域.Get_变量声明_查找_当前作用域_上级作用域_全局变量(this.name);

            if (变量声明 == null)
            {
                throw new Exception("找不到名为 \"" + this.name + "\" 的 变量/参数/全局变量 。");
            }

            return(变量声明);
        }
示例#2
0
        public override void 类型和语法检查(List <语法错误> list语法错误)
        {
            变量声明和初始化 变量声明 = this.作用域.Get_变量声明_查找_当前作用域_上级作用域_全局变量(this.name);

            if (变量声明 == null)
            {
                list语法错误.Add(new 语法错误("找不到名为 \"" + this.name + "\" 的 变量/参数/全局变量 。", this.chars, this.iLeft));
            }

            //throw new NotImplementedException("不需要调用 变量.类型和语法检查() 方法。变量 的 类型和语法检查 就是 检查 变量 是否已声明。使用到 变量 的 表达式 一定会进行相关的 类型检查,此时会调用 变量.Get_变量声明() 方法 来获得 变量声明,若 变量 未声明,则会在 变量.Get_变量声明() 方法 中 抛出异常 。");
        }