protected override void ProcessMethodInvocation(MethodInvocationExpression node, IMethod method) { base.ProcessMethodInvocation(node, method); if (UtilitiesModule.IsPossibleStartCoroutineInvocationForm(node)) { UnityScript.TypeSystem.UnityScriptTypeSystem unityScriptTypeSystem = this.UnityScriptTypeSystem; if (unityScriptTypeSystem.IsScriptType(method.DeclaringType) && unityScriptTypeSystem.IsGenerator(method)) { if (this.CurrentMethod.IsStatic) { this.Warnings.Add(UnityScriptWarnings.CannotStartCoroutineFromStaticFunction(node.LexicalInfo, method.Name)); } else { node.ParentNode.Replace(node, this.CodeBuilder.CreateMethodInvocation(this.CodeBuilder.CreateSelfReference(node.LexicalInfo, this.CurrentType), this._StartCoroutine, node)); } } } }
public Block PrepareEvaluationContextInitialization(IType evaluationContextType) { this._evaluationContextLocal = this.CodeBuilder.DeclareTempLocal(this.CurrentMethodNode, evaluationContextType); Block block = new Block(); block.Add(this.CodeBuilder.CreateAssignment(this.CreateEvaluationContextReference(), this.CodeBuilder.CreateConstructorInvocation(UtilitiesModule.ConstructorTakingNArgumentsFor(evaluationContextType, 1), this.EvaluationDomainProviderReference()))); foreach (ParameterDeclaration declaration in this.CurrentMethodNode.Parameters) { block.Add(this.CodeBuilder.CreateAssignment(this.CreateEvaluationContextFieldReference(this.GetEvaluationContextField(declaration)), this.CodeBuilder.CreateReference(declaration))); } return(block); }