From users-return-1436-apmail-groovy-users-archive=groovy.apache.org@groovy.apache.org Thu Mar 3 08:26:53 2016 Return-Path: X-Original-To: apmail-groovy-users-archive@minotaur.apache.org Delivered-To: apmail-groovy-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E04C0181F0 for ; Thu, 3 Mar 2016 08:26:52 +0000 (UTC) Received: (qmail 13527 invoked by uid 500); 3 Mar 2016 08:26:52 -0000 Delivered-To: apmail-groovy-users-archive@groovy.apache.org Received: (qmail 13492 invoked by uid 500); 3 Mar 2016 08:26:52 -0000 Mailing-List: contact users-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@groovy.apache.org Delivered-To: mailing list users@groovy.apache.org Received: (qmail 13482 invoked by uid 99); 3 Mar 2016 08:26:52 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Mar 2016 08:26:52 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 452C2C02CB for ; Thu, 3 Mar 2016 08:26:52 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.486 X-Spam-Level: *** X-Spam-Status: No, score=3.486 tagged_above=-999 required=6.31 tests=[DKIM_ADSP_CUSTOM_MED=0.001, NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_NONE=-0.0001, SPF_SOFTFAIL=0.972, URI_HEX=1.313] autolearn=disabled Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id AYTg2wSJljpL for ; Thu, 3 Mar 2016 08:26:51 +0000 (UTC) Received: from mbob.nabble.com (mbob.nabble.com [162.253.133.15]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with ESMTP id 667C95F571 for ; Thu, 3 Mar 2016 08:26:51 +0000 (UTC) Received: from msam.nabble.com (unknown [162.253.133.85]) by mbob.nabble.com (Postfix) with ESMTP id 1E32C2210F99 for ; Thu, 3 Mar 2016 00:18:35 -0800 (PST) Date: Thu, 3 Mar 2016 01:26:50 -0700 (MST) From: polbotinka To: users@groovy.incubator.apache.org Message-ID: <1456993610912-5731547.post@n5.nabble.com> Subject: AST transformation in CLASS_GENERATION phase MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, I'm working on a custom AST transformation that needs a static type data. Basically want i want to do is to add an assignment expression that takes the closure inferred return type and set it to some field: I'm getting a closure return type using: But the problem is that it's populated with return type during INSTRUCTION_SELECTION phase. Therefore I'm applying my AST during next phase which is CLASS_GENERATION. I'm adding the ExpressionStatement but it doesn't seem to work. If I change the CompilePhase to SEMANTIC_ANALYSIS the assignment expression works but I don't have StaticTypesMarker.INFERRED_RETURN_TYPE populated for closure. The questions are: 1. I would like to know if it is possible to add expression statements to the AST during CLASS_GENERATION phase? I doesn't seem to work for me. Documentation is not clear here: 2. If it is not possible to modify AST during CLASS_GENERATION then is it legal to use StaticTypeCheckingVisitor.visitClosure to get closure inferred return type during SEMANTIC_ANALYSIS phase? 3. Are there any other options I might have missed? -- View this message in context: http://groovy.329449.n5.nabble.com/AST-transformation-in-CLASS-GENERATION-phase-tp5731547.html Sent from the Groovy Users mailing list archive at Nabble.com.