You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by sl...@apache.org on 2019/06/24 11:23:07 UTC

[incubator-daffodil] branch master updated: Pass findPropertyOption through a ChoiceBranchImpliedSequence to the underlying Term

This is an automated email from the ASF dual-hosted git repository.

slawrence pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-daffodil.git


The following commit(s) were added to refs/heads/master by this push:
     new 3e46570  Pass findPropertyOption through a ChoiceBranchImpliedSequence to the underlying Term
3e46570 is described below

commit 3e4657059e2c351681a11bc71ac49b9a4684f0ca
Author: Steve Lawrence <sl...@apache.org>
AuthorDate: Fri Jun 21 14:26:08 2019 -0400

    Pass findPropertyOption through a ChoiceBranchImpliedSequence to the underlying Term
    
    The ChoiceCombinator asks all of its child Terms for the choiceBranchKey
    property (and other properties related to direct dispatch) to build the
    dispatch mappings. This means that property lookup results are cached on
    the implied sequence instead of on the Term that the properties actually
    appear. This leads to the Term thinking the property wasn't used because
    its access didn't appear it its cache, and leads it an incorrect
    warning.
    
    Instead, pass through the findPropertyOption function to the underlying
    Term so that look ups happen and are cached on the Term, getting rid of
    the false warnings.
    
    DAFFODIL-2162
---
 .../src/main/scala/org/apache/daffodil/dsom/SequenceGroup.scala        | 2 ++
 .../org/apache/daffodil/schema/annotation/props/PropertyScoping.scala  | 3 +--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/SequenceGroup.scala b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/SequenceGroup.scala
index 996c688..b79b4fd 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/SequenceGroup.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/SequenceGroup.scala
@@ -382,6 +382,8 @@ final class ChoiceBranchImpliedSequence(rawGM: Term)
 
   override def checkHiddenSequenceIsDefaultableOrOVC: Unit = ()
 
+  override def findPropertyOption(pname: String): PropertyLookupResult = rawGM.findPropertyOption(pname)
+
   override lazy val sequenceRuntimeData: SequenceRuntimeData = {
     new SequenceRuntimeData(
       schemaSet.variableMap,
diff --git a/daffodil-lib/src/main/scala/org/apache/daffodil/schema/annotation/props/PropertyScoping.scala b/daffodil-lib/src/main/scala/org/apache/daffodil/schema/annotation/props/PropertyScoping.scala
index 424a927..5083b92 100644
--- a/daffodil-lib/src/main/scala/org/apache/daffodil/schema/annotation/props/PropertyScoping.scala
+++ b/daffodil-lib/src/main/scala/org/apache/daffodil/schema/annotation/props/PropertyScoping.scala
@@ -120,8 +120,7 @@ trait FindPropertyMixin extends PropTypes {
   
   val propCache = new scala.collection.mutable.LinkedHashMap[String, PropertyLookupResult]
 
-  final def findPropertyOption(pname: String): PropertyLookupResult = {
-
+  def findPropertyOption(pname: String): PropertyLookupResult = {
     val propCacheResult = propCache.get(pname)
     val propRes =
       propCacheResult match {