public override void OutAAssignmentExp(AAssignmentExp node) { if (Util.GetAncestor<PStm>(node) == null) { errors.Add(new ErrorCollection.Error(node.GetToken(), currentSourceFile, LocRM.GetString("ErrorText186"))); node.ReplaceBy(node.GetExp()); return; } base.OutAAssignmentExp(node); }
public override void CaseAAssignmentExp(AAssignmentExp node) { InAAssignmentExp(node); if (node.GetExp() != null) { node.GetExp().Apply(this); } if (node.GetLvalue() != null) { node.GetLvalue().Apply(this); } if (node.GetToken() != null) { node.GetToken().Apply(this); } OutAAssignmentExp(node); }
public override void OutAAssignmentExp(AAssignmentExp node) { PType from = data.ExpTypes[node.GetExp()]; PType to = data.LvalueTypes[node.GetLvalue()]; if (!Assignable(from, to)) { if (ImplicitAssignable(from, to)) { ANamedType namedTo = (ANamedType) to; ACastExp cast = new ACastExp(new TLParen("("), new ANamedType(new TIdentifier(((AAName)namedTo.GetName()).AsString()), null), node.GetExp()); node.SetExp(cast); OutACastExp(cast); //to = from; } else errors.Add(new ErrorCollection.Error(node.GetToken(), currentSourceFile, LocRM.GetString("ErrorText151") + Util.TypeToString(from) + LocRM.GetString("ErrorText152") + Util.TypeToString(to))); } data.ExpTypes[node] = to; if (node.GetLvalue() is ALocalLvalue) { assignedToOutParams.Add(data.LocalLinks[(ALocalLvalue) node.GetLvalue()]); } if (node.GetLvalue() is AStructLvalue && data.StructFieldLinks.ContainsKey((AStructLvalue) node.GetLvalue())) { AALocalDecl decl = data.StructFieldLinks[(AStructLvalue) node.GetLvalue()]; if (decl.GetConst() != null) errors.Add(new ErrorCollection.Error(node.GetToken(), LocRM.GetString("ErrorText153"))); } if (node.GetLvalue() is AStructFieldLvalue && data.StructMethodFieldLinks.ContainsKey((AStructFieldLvalue)node.GetLvalue())) { AALocalDecl decl = data.StructMethodFieldLinks[(AStructFieldLvalue)node.GetLvalue()]; if (decl.GetConst() != null) errors.Add(new ErrorCollection.Error(node.GetToken(), LocRM.GetString("ErrorText153"))); } base.OutAAssignmentExp(node); }