public override void CheckSemantics(TigerScope scope, Report report) { ContainingScope = scope; //Checking children VariableDeclarationNodes.ToList().ForEach(v => v.CheckSemantics(scope, report)); IsOK = true; foreach (var v in VariableDeclarationNodes.Where(v => !v.IsOK && !(v is ExplicitVariableDeclarationNode))) { scope.RemoveVariable(v.IdNode.Name); IsOK = false; } }
public override void CheckSemantics(TigerScope scope, Report report) { ContainingScope = scope; //Cheking children (function body semantics not checked) FunctionDeclarationNodes.ToList().ForEach(f => f.CheckSemantics(scope, report)); //Cheking children function body (notice all functions in block are already declared) FunctionDeclarationNodes.ToList().ForEach(f => f.CheckBodySemantics(scope, report)); foreach (var f in FunctionDeclarationNodes.Where(f => !f.IsOK && f.ReturnTypeNode == null)) { scope.RemoveVariable(f.IdNode.Name); IsOK = false; } if (FunctionDeclarationNodes.All(f => f.IsOK)) { IsOK = true; } }