Return-Path: X-Original-To: apmail-flex-commits-archive@www.apache.org Delivered-To: apmail-flex-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 166B210A8B for ; Fri, 17 Oct 2014 05:45:33 +0000 (UTC) Received: (qmail 91247 invoked by uid 500); 17 Oct 2014 05:45:32 -0000 Delivered-To: apmail-flex-commits-archive@flex.apache.org Received: (qmail 91097 invoked by uid 500); 17 Oct 2014 05:45:32 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 91045 invoked by uid 99); 17 Oct 2014 05:45:31 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Oct 2014 05:45:31 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id B0C55A097B7; Fri, 17 Oct 2014 05:45:31 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aharui@apache.org To: commits@flex.apache.org Date: Fri, 17 Oct 2014 05:45:33 -0000 Message-Id: <9d1e561a515340b9a1003876cd73e378@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [3/3] git commit: [flex-falcon] [refs/heads/develop] - handle bindings as values of state-specific properties. The value has to get set on the SetProperty, not on the actual property handle bindings as values of state-specific properties. The value has to get set on the SetProperty, not on the actual property Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/c932239c Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/c932239c Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/c932239c Branch: refs/heads/develop Commit: c932239cf893b78c85667d819950b8ac338fa92f Parents: cfb9242 Author: Alex Harui Authored: Thu Oct 16 22:45:12 2014 -0700 Committer: Alex Harui Committed: Thu Oct 16 22:45:12 2014 -0700 ---------------------------------------------------------------------- .../as/codegen/MXMLClassDirectiveProcessor.java | 26 ++++++++++++++++++-- .../codegen/databinding/BindingDatabase.java | 5 ++-- .../codegen/databinding/BindingInfo.java | 8 ++++++ .../databinding/MXMLBindingDirectiveHelper.java | 5 ++-- 4 files changed, 37 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c932239c/compiler/src/org/apache/flex/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java b/compiler/src/org/apache/flex/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java index 8602fdf..50fe14a 100644 --- a/compiler/src/org/apache/flex/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java +++ b/compiler/src/org/apache/flex/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java @@ -138,6 +138,7 @@ import org.apache.flex.compiler.definitions.references.ReferenceFactory; import org.apache.flex.compiler.exceptions.CodegenInterruptedException; import org.apache.flex.compiler.internal.abc.FunctionGeneratorHelper; import org.apache.flex.compiler.internal.caches.CSSDocumentCache; +import org.apache.flex.compiler.internal.codegen.databinding.BindingInfo; import org.apache.flex.compiler.internal.codegen.databinding.MXMLBindingDirectiveHelper; import org.apache.flex.compiler.internal.css.codegen.CSSCompilationSession; import org.apache.flex.compiler.internal.css.codegen.CSSReducer; @@ -286,6 +287,11 @@ public class MXMLClassDirectiveProcessor extends ClassDirectiveProcessor private static final String INSTANCE_INITIALIZER_NAME_BASE = "i"; /** + * Autogenerated bindable overrides are named _bo0, _bo1, etc. + */ + private static final String BINDABLE_OVERRIDE_NAME_BASE = "_bo"; + + /** * constants used to generate old-style XMLNode's from the XML tag */ private static final Object[] CONSTRUCT_XML_LIST_OPERANDS = new Object[] { ABCGeneratingReducer.xmlListType, 1 }; @@ -476,6 +482,12 @@ public class MXMLClassDirectiveProcessor extends ClassDirectiveProcessor /** * An incrementing counter used to create the names of the + * auto-generated bindable overrides. + */ + private int bindableOverrideCounter = 0; + + /** + * An incrementing counter used to create the names of the * auto-generated event handler methods. */ private int eventHandlerCounter = 0; @@ -4403,7 +4415,7 @@ public class MXMLClassDirectiveProcessor extends ClassDirectiveProcessor context.addInstruction(OP_getproperty, overrideName); boolean valueIsDataBound = isDataBindingNode(propertyOrStyleNode.getChild(0)); - context.pushNumericConstant(valueIsDataBound ? 2 : 3); + context.pushNumericConstant(3); // Set its 'target' property to the id of the object // whose property or style this override will set. context.addInstruction(OP_pushstring, "target"); @@ -4424,12 +4436,22 @@ public class MXMLClassDirectiveProcessor extends ClassDirectiveProcessor context.addInstruction(OP_pushstring, "value"); processNode(propertyOrStyleValueNode, context); // push value } + else + { + String overrideID = BINDABLE_OVERRIDE_NAME_BASE + Integer.toString(bindableOverrideCounter++); + context.addInstruction(OP_pushstring, "id"); + context.addInstruction(OP_pushtrue); + context.addInstruction(OP_pushstring, overrideID); + addVariableTrait(new Name(overrideID), overrideName); + BindingInfo bi = bindingDirectiveHelper.visitNode((IMXMLDataBindingNode)propertyOrStyleNode.getChild(0)); + bi.setDestinationString(overrideID + ".value"); + } context.pushNumericConstant(0); // styles context.pushNumericConstant(0); // effects context.pushNumericConstant(0); // events context.addInstruction(OP_pushnull); - context.incrementCounter(IL.MXML_OVERRIDE_PROPERTIES, valueIsDataBound ? 12 : 15); + context.incrementCounter(IL.MXML_OVERRIDE_PROPERTIES, 15); } else http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c932239c/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/BindingDatabase.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/BindingDatabase.java b/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/BindingDatabase.java index ff66319..9158b9e 100644 --- a/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/BindingDatabase.java +++ b/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/BindingDatabase.java @@ -117,14 +117,15 @@ public class BindingDatabase * May find bindings and watchers already marked for creation by other nodes and re-use them. * */ - public void analyze(IMXMLDataBindingNode node, Collection problems, MXMLClassDirectiveProcessor host) + public BindingInfo analyze(IMXMLDataBindingNode node, Collection problems, MXMLClassDirectiveProcessor host) { BindingInfo bindingInfo = BindingAnalyzer.analyze(node, this, problems, this.bindingInfoSet.size(), host); this.bindingInfoSet.add(bindingInfo); // now watchers WatcherAnalyzer watcherAnalyzer = new WatcherAnalyzer(this, problems, bindingInfo, host.getProject()); - watcherAnalyzer.analyze(); + watcherAnalyzer.analyze(); + return bindingInfo; } /** http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c932239c/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/BindingInfo.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/BindingInfo.java b/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/BindingInfo.java index daf1fc6..7267f13 100644 --- a/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/BindingInfo.java +++ b/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/BindingInfo.java @@ -228,6 +228,14 @@ public class BindingInfo implements Comparable } /** + * param the name of the binding destination property + */ + public void setDestinationString(String newDestString) + { + destinationString = newDestString; + } + + /** * just for debugging */ @Override http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c932239c/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/MXMLBindingDirectiveHelper.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/MXMLBindingDirectiveHelper.java b/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/MXMLBindingDirectiveHelper.java index 9366f25..08573c0 100644 --- a/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/MXMLBindingDirectiveHelper.java +++ b/compiler/src/org/apache/flex/compiler/internal/codegen/databinding/MXMLBindingDirectiveHelper.java @@ -110,11 +110,10 @@ public class MXMLBindingDirectiveHelper /** * host should visit all the databinding nodes before trying to codegen them */ - public void visitNode(IMXMLDataBindingNode node) + public BindingInfo visitNode(IMXMLDataBindingNode node) { // analyze the node for later CG - bindingDataBase.analyze(node, host.getProblems(), host); - + return bindingDataBase.analyze(node, host.getProblems(), host); } /**