internal ResolvedTraitSet AddResolvedTraitsApplied(ResolvedTraitSetBuilder rtsb, ResolveOptions resOpt) { int l = this.AppliedTraits.Count; for (int i = 0; i < l; i++) { rtsb.MergeTraits(this.AppliedTraits[i].FetchResolvedTraits(resOpt)); } // dynamic applied on use return(rtsb.ResolvedTraitSet); }
internal ResolvedTraitSet AddResolvedTraitsApplied(ResolvedTraitSetBuilder rtsb, ResolveOptions resOpt) { Action <CdmTraitCollection> addAppliedTraits = (ats) => { if (ats != null) { int l = ats.Count; for (int i = 0; i < l; i++) { rtsb.MergeTraits(ats.AllItems[i].FetchResolvedTraits(resOpt)); } } }; addAppliedTraits(this.AppliedTraits); // dynamic applied on use return(rtsb.ResolvedTraitSet); }
internal override void ConstructResolvedTraits(ResolvedTraitSetBuilder rtsb, ResolveOptions resOpt) { // get only the elevated traits from attribute first, then add in all traits from this definition if (this.Members != null) { ResolvedTraitSet rtsElevated = new ResolvedTraitSet(resOpt); for (int i = 0; i < this.Members.Count; i++) { dynamic att = this.Members.AllItems[i]; ResolvedTraitSet rtsAtt = att.FetchResolvedTraits(resOpt); if (rtsAtt?.HasElevated == true) { rtsElevated = rtsElevated.MergeSet(rtsAtt, true); } } rtsb.MergeTraits(rtsElevated); } this.ConstructResolvedTraitsDef(null, rtsb, resOpt); }
internal override void ConstructResolvedTraits(ResolvedTraitSetBuilder rtsb, ResolveOptions resOpt) { // // get from datatype if (this.DataType != null) rtsb.TakeReference(this.DataType.FetchResolvedTraits(resOpt)); // // get from purpose if (this.Purpose != null) rtsb.MergeTraits(this.Purpose.FetchResolvedTraits(resOpt)); this.AddResolvedTraitsApplied(rtsb, resOpt); // special case for attributes, replace a default "this.attribute" with this attribute on traits that elevate attribute if (rtsb.ResolvedTraitSet?.HasElevated == true) { CdmAttributeReference replacement = new CdmAttributeReference(this.Ctx, this.Name, true) { Ctx = this.Ctx, ExplicitReference = this }; rtsb.ReplaceTraitParameterValue(resOpt, "does.elevateAttribute", "attribute", "this.attribute", replacement); } //rtsb.CleanUp(); }