private void LinkMethod(IMethod method, IAbcTraitProvider owner, bool isGlobal) { var instance = owner as AbcInstance; if (instance != null && method.IsConstructor && !isGlobal) { LinkCtor(method, instance); return; } if (!isGlobal) { if (LinkEvent(method, instance)) { return; } } if (!ShouldLink(method)) { return; } var t = GetTrait(method, owner); if (t != null) { LinkMethod(method, t.Method); return; } var abcMethod = isGlobal ? FindGlobalMethod(method) : FindMethod(instance, method); LinkMethod(method, abcMethod); }
private void LinkMethods(IType type, IAbcTraitProvider owner, bool isGlobal) { foreach (var method in type.Methods) { LinkMethod(method, owner, isGlobal); } }
private void ImportTraits(IAbcTraitProvider from, IAbcTraitProvider to) { foreach (var trait in from.Traits) { var t2 = ImportTrait(trait); to.Traits.Add(t2); } }
public AbcTraitCollection(IAbcTraitProvider owner) { if (owner == null) { throw new ArgumentNullException("owner"); } _owner = owner; }
private void ImportTraits(IAbcTraitProvider from, IAbcTraitProvider to, ref AbcMethod importMethod) { foreach (var trait in from.Traits) { var t2 = ImportTrait(trait); if (trait.Method == importMethod) { importMethod = t2.Method; } to.Traits.Add(t2); } }
void EnsureTraits(IAbcTraitProvider tp) { foreach (var trait in tp.Traits) { if (!IsDefined(trait.Name)) { throw Errors.ABC.BadFormat.CreateException(); } //CheckQName(trait.Name); if (trait.IsField) { trait.SlotType = ImportConst(trait.SlotType); } } }
private AbcTrait GetTrait(ICustomAttributeProvider cp, IAbcTraitProvider owner) { foreach (var attr in cp.CustomAttributes) { switch (attr.TypeName) { case Attrs.AbcInstanceTrait: { int index = GetIndex(attr); return(owner.Traits[index]); } case Attrs.AbcClassTrait: { int index = GetIndex(attr); return(((AbcInstance)owner).Class.Traits[index]); } case Attrs.AbcScriptTrait: { var abc = GetAbcFileCore(cp); if (abc == null) { return(null); } var scriptAttr = cp.FindAttribute(Attrs.AbcScript); if (scriptAttr == null) { return(null); } int scriptIndex = GetIndex(scriptAttr); int index = GetIndex(attr); return(abc.Scripts[scriptIndex].Traits[index]); } } } return(null); }