~zorba-coders/zorba/bugs-912586-912593-912722

« back to all changes in this revision

Viewing changes to src/types/typeimpl.cpp

  • Committer: Cezar Andrei
  • Date: 2012-03-28 15:42:12 UTC
  • mfrom: (10606.1.129 zorba)
  • Revision ID: cezar.lp@cezarandrei.com-20120328154212-jh2heq49xcqjppce
Merge from trunck and resolve ChangeLog conflict.

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
};
94
94
 
95
95
 
96
 
const char *AtomicXQType::ATOMIC_TYPE_CODE_STRINGS[TypeConstants::ATOMIC_TYPE_CODE_LIST_SIZE] =
 
96
const char* AtomicXQType::ATOMIC_TYPE_CODE_STRINGS[store::XS_LAST] =
97
97
{
98
98
  "xs:anyAtomicType",
99
99
  "xs:string",
361
361
 
362
362
 
363
363
bool NodeXQType::is_subtype(
364
 
    const TypeManager* tm, 
 
364
    const TypeManager* tm,
365
365
    const NodeXQType& supertype,
366
366
    const QueryLoc& loc) const
367
367
{
443
443
 
444
444
 
445
445
bool NodeXQType::is_supertype(
446
 
    const TypeManager* tm, 
 
446
    const TypeManager* tm,
447
447
    const store::Item* subitem,
448
448
    const QueryLoc& loc) const
449
449
{
488
488
    }
489
489
  }
490
490
 
491
 
  if (m_node_kind != store::StoreConsts::elementNode && 
492
 
      m_node_kind != store::StoreConsts::attributeNode)
 
491
  // document-node( E ) matches any document node that contains exactly one element
 
492
  // node, optionally accompanied by one or more comment and processing instruction
 
493
  // nodes, if E is an ElementTest or SchemaElementTest that matches the element node.
 
494
  bool is_element_test = (
 
495
      m_node_kind == store::StoreConsts::documentNode &&
 
496
      m_content_type != NULL &&
 
497
      m_content_type->type_kind() == XQType::NODE_TYPE_KIND &&
 
498
      dynamic_cast<const NodeXQType*>(m_content_type.getp())->m_schema_test == false);
 
499
 
 
500
  if (m_node_kind != store::StoreConsts::elementNode &&
 
501
      m_node_kind != store::StoreConsts::attributeNode &&
 
502
      !is_element_test)
493
503
    return true;
494
504
 
495
505
  if (m_content_type == NULL ||
496
506
      m_content_type->type_kind() == XQType::ANY_TYPE_KIND)
497
507
    return true;
498
508
 
 
509
  if (is_element_test)
 
510
  {
 
511
    xqtref_t documentNodeType = tm->create_value_type(subitem, loc);
 
512
    return TypeOps::is_subtype(tm, *documentNodeType, *this);
 
513
  }
 
514
 
499
515
  xqtref_t subContentType = tm->create_named_type(subitem->getType(),
500
516
                                                  TypeConstants::QUANT_ONE,
501
517
                                                  loc,