private void CheckMoveCallResult(List <InitStatus> statusList, Core.InstructionMoveCallResult inst) { ValidateSource(statusList, inst.callTargetSource); for (var i = 0; i < inst.argumentSources.Length; i++) { ValidateSource(statusList, inst.argumentSources[i]); } CheckAndInitDestination(statusList, inst.destination); }
private void ApplyRuleForMoveCallResult(ref bool appliedRule, Core.InstructionMoveCallResult inst) { var destType = TypeResolver.GetDataAccessType(session, funct, inst.destination); var callType = TypeResolver.GetDataAccessType(session, funct, inst.callTargetSource); var callFunct = callType as Core.TypeFunct; if (callFunct == null) { return; } var inferredResult = TypeInferencer.Try(session, callFunct.returnType, ref destType); if (inferredResult) { appliedRule = ApplyToDataAccess(inst.destination, destType); } /*var srcArgumentTypes = new Core.Type[inst.argumentSources.Length]; * for (var i = 0; i < inst.argumentSources.Length; i++) * srcArgumentTypes[i] = GetDataAccessType(inst.argumentSources[i]); * * var srcFunct = Core.TypeFunct.Of(destType, srcArgumentTypes); * var srcType = (Core.Type)srcFunct; * * var inferredFunct = TypeInferencer.Try(session, callType, ref srcType); * var inferredFunctArgs = TypeInferencer.Try(session, srcType, ref callType); * var inferredResult = TypeInferencer.Try(session, callFunct.returnType, ref destType); * var inferredFunctResult = TypeInferencer.Try(session, destType, ref callFunct.returnType);*/ /*if (result) * { * this.appliedAnyRule = true; * * routine.registers[inst.calledSource.registerIndex].type = callType; * routine.registers[inst.destination.registerIndex].type = callFunct.returnType; * * for (var i = 0; i < inst.argumentSources.Count; i++) * { * this.routine.registers[inst.argumentSources[i].registerIndex].type = * srcFunct.argumentTypes[i]; * } * }*/ }
private void CheckMoveCallResult(Core.InstructionMoveCallResult inst) { if (!TypeResolver.ValidateDataAccess(this.session, this.funct, inst.callTargetSource)) { this.foundErrors = true; return; } var destType = TypeResolver.GetDataAccessType(this.session, this.funct, inst.destination); var srcType = TypeResolver.GetDataAccessType(this.session, this.funct, inst.callTargetSource); var srcFunct = srcType as Core.TypeFunct; if (srcFunct == null) { this.foundErrors = true; this.session.AddMessage( Diagnostics.MessageKind.Error, Diagnostics.MessageCode.UncallableType, "calling '" + srcType.GetString(this.session) + "', which is not a funct", inst.callTargetSource.span); return; } if (inst.argumentSources.Length != srcFunct.parameterTypes.Length) { this.foundErrors = true; this.session.AddMessage( Diagnostics.MessageKind.Error, Diagnostics.MessageCode.WrongNumberOfArguments, "passing the wrong number of arguments to '" + srcType.GetString(this.session) + "'", inst.span); return; } for (var i = 0; i < inst.argumentSources.Length; i++) { if (!TypeResolver.ValidateDataAccess(this.session, this.funct, inst.argumentSources[i])) { this.foundErrors = true; return; } var argType = TypeResolver.GetDataAccessType(this.session, this.funct, inst.argumentSources[i]); var paramType = srcFunct.parameterTypes[i]; if (!paramType.IsConvertibleTo(argType) && ShouldDiagnose(paramType) && ShouldDiagnose(argType)) { this.foundErrors = true; this.session.AddMessage( Diagnostics.MessageKind.Error, Diagnostics.MessageCode.IncompatibleTypes, "passing '" + argType.GetString(this.session) + "' " + "into '" + paramType.GetString(this.session) + "' parameter", inst.argumentSources[i].span); } } CheckMove(inst.destination, srcFunct.returnType, inst.span); }