public override void ExitXppproperty([NotNull] XP.XpppropertyContext context) { context.SetSequencePoint(context.M, context.end.Stop); }
public override void EnterXppproperty([NotNull] XP.XpppropertyContext context) { // When [VAR <VarName>] is missing then this is a declaration of an ACCESS or ASSIGN method. // In that case treat implementation like VO Access/assign // When VAR is available then the property name = the VAR name and the method names should be called // in the getter and setter // XPP allows to declare an ACCESS METHOD and then declare the method body without ACCESS prefix ! // The method is called with an optional parameter (the value from the property) // In the method body the user needs to check for the type to see if the getter or setter is called. // // /* * // example from XbZLog.prg * Class XbZ_LogWriter * Var cLogPath * Var lLogActive * Sync Method Open * Sync Method Stop * Access Assign Method Path * EndClass * Method XbZ_LogWriter:Path(cPath) * if PCount() == 1 .and. ValType(cPath) == 'C' * ::cLogPath := alltrim(iif(empty(cPath), left(AppName(.t.), RAt('\', AppName(.t.))), cPath)) * ::cLogPath += iif(right(::cLogPath, 1) == '\', '', '\') * if ::lLogActive .and. ::Stop(.t.) * ::Open() * endif * endif * return (::cLogPath) */ string name = context.Id.GetText(); bool hasVarName = context.VarName != null; if (hasVarName) { name = context.VarName.GetText(); } _currentClass.AddProperty(name); // it is allowed to have a separate line for ACCESS and ASSIGN and map them to different methods var declInfo = _currentClass.Methods.Where(x => x.Name == name && x.IsProperty).FirstOrDefault(); if (declInfo == null) { declInfo = new XppDeclaredMethodInfo() { Name = name, Declaration = context, IsProperty = true, Visibility = _currentClass.CurrentVisibility }; _currentClass.Methods.Add(declInfo); } declInfo.HasVarName = hasVarName; // check to see if we have a declaration if (context.Access != null) { declInfo.AccessMethod = context.Id.GetText(); } if (context.Assign != null) { declInfo.AssignMethod = context.Id.GetText(); } }