public override Stmt Analy() { ForeachListExp = ParseAnalyRawExp(Raw.ListExp); CreateEachSymbols(); var ForeachToken = Raw.LoopToken; var ListExp = Raw.ListExp; var ItemToken = Raw.ItemToken; if (ListExp == null) { Errorf(ForeachToken.Position, "'循环每一个语句'不存在要循环的列表"); } if (ItemToken == null) { Errorf(ForeachToken.Position, "'循环每一个语句'不存在成员名称"); } if (ListExp == null || ItemToken == null) { return(null); } if (!checkCanForeach(ForeachListExp.RetType)) { Errorf(ForeachToken.Position, "该结果不能用作循环每一个"); return(null); } if (ZTypeUtil.IsExtends(ForeachListExp.RetType, typeof(列表 <>))) { startIndex = 1; compareMethod = typeof(Calculater).GetMethod("LEInt", new Type[] { typeof(int), typeof(int) }); } else { startIndex = 0; compareMethod = typeof(Calculater).GetMethod("LTInt", new Type[] { typeof(int), typeof(int) }); } StmtBody.Analy(); //Body.ProcContext = this.ProcContext; //Body.Analy(); return(this); }
private Exp AnalyNewExpOrQiangDiao() { int argsCount = BracketExp.Count; if (argsCount != 1) { return(AnalyNewExp()); } else { Exp argExp = BracketExp.GetSubExps()[0]; if (ZTypeUtil.IsExtends(argExp.RetType, TypeExp.RetType)) { return(argExp); } else { return(AnalyNewExpOneArg()); } } }