private async Task ProcessReturnMessageAsync(ReturnMessage returnMesssage) { Logger.Instance.Log("MethodEntityProcessor", "ProcessReturnMessageAsync", "{0} in method {1}", returnMesssage, this.MethodEntity.MethodDescriptor); var retMsgInfo = returnMesssage.ReturnMessageInfo; // Propagate types from the callee (RTA) this.MethodEntity.InstantiatedTypes .UnionWith(Demarshaler.Demarshal(retMsgInfo.InstatiatedTypes)); // "Event" handler: Do the propagation of callee info await HandleReturnEventAsync(retMsgInfo); }
/// <summary> /// Async versions of DispachReturnMessage /// </summary> /// <param name="context"></param> /// <param name="returnVariable"></param> /// <param name="propKind"></param> /// <returns></returns> internal async Task DispachReturnMessageAsync(CallContext context, VariableNode returnVariable, PropagationKind propKind) { var caller = context.Caller; var lhs = context.CallLHS; var types = returnVariable != null ? GetTypes(returnVariable, propKind) : new HashSet<TypeDescriptor>(); // Diego TO-DO, different treatment for adding and removal if (propKind == PropagationKind.ADD_TYPES && types.Count() == 0 && returnVariable != null) { var instTypes = new HashSet<TypeDescriptor>(); foreach (var iType in this.MethodEntity.InstantiatedTypes) { var isSubtype = await codeProvider.IsSubtypeAsync(iType,returnVariable.Type); if (isSubtype) { instTypes.Add(iType); } } //instTypes.UnionWith( // this.MethodEntity.InstantiatedTypes // .Where(iType => codeProvider.IsSubtypeAsync(iType,returnVariable.Type).Result)); //// .Where(iType => iType.IsSubtype(returnVariable.Type))); foreach (var t in instTypes) { types.Add(t); } } // Jump to caller var destination = EntityFactory.Create(caller,this.dispatcher); var retMessageInfo = new ReturnMessageInfo( lhs, types, propKind, this.MethodEntity.InstantiatedTypes, context.Invocation); var returnMessage = new ReturnMessage(this.MethodEntity.EntityDescriptor, retMessageInfo); //if (lhs != null) { await this.SendMessageAsync(destination, returnMessage); } //else //{ // return new Task(() => { }); //} }
private void ProcessReturnMessage(ReturnMessage returnMessage) { var retMsgInfo = returnMessage.ReturnMessageInfo; // Propagate types from the callee (RTA) this.MethodEntity.InstantiatedTypes .UnionWith(Demarshaler.Demarshal(retMsgInfo.InstatiatedTypes)); // "Event" handler: Do the propagation of callee info HandleReturnEvent(retMsgInfo); }