本文整理汇总了C#中IASTNode.GetFirstChild方法的典型用法代码示例。如果您正苦于以下问题:C# IASTNode.GetFirstChild方法的具体用法?C# IASTNode.GetFirstChild怎么用?C# IASTNode.GetFirstChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IASTNode
的用法示例。
在下文中一共展示了IASTNode.GetFirstChild方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssignmentSpecification
public AssignmentSpecification(IASTNode eq, IQueryable persister)
{
if (eq.Type != HqlSqlWalker.EQ)
{
throw new QueryException("assignment in set-clause not associated with equals");
}
_eq = eq;
_factory = persister.Factory;
// Needed to bump this up to DotNode, because that is the only thing which currently
// knows about the property-ref path in the correct format; it is either this, or
// recurse over the DotNodes constructing the property path just like DotNode does
// internally
DotNode lhs;
try
{
lhs = (DotNode)eq.GetFirstChild();
}
catch (InvalidCastException e)
{
throw new QueryException(
string.Format("Left side of assigment should be a case sensitive property or a field (depending on mapping); found '{0}'", eq.GetFirstChild()), e);
}
var rhs = (SqlNode)lhs.NextSibling;
ValidateLhs(lhs);
string propertyPath = lhs.PropertyPath;
var temp = new HashedSet<string>();
// yuck!
var usep = persister as UnionSubclassEntityPersister;
if (usep!=null)
{
temp.AddAll(persister.ConstraintOrderedTableNameClosure);
}
else
{
temp.Add(persister.GetSubclassTableName(persister.GetSubclassPropertyTableNumber(propertyPath)));
}
_tableNames = new ImmutableSet<string>(temp);
if (rhs == null)
{
_hqlParameters = new IParameterSpecification[0];
}
else if (IsParam(rhs))
{
_hqlParameters = new[] { ((ParameterNode)rhs).HqlParameterSpecification };
}
else
{
var parameterList = ASTUtil.CollectChildren(rhs, IsParam);
_hqlParameters = new IParameterSpecification[parameterList.Count];
int i = 0;
foreach (ParameterNode parameterNode in parameterList)
{
_hqlParameters[i++] = parameterNode.HqlParameterSpecification;
}
}
}
示例2: VisitPropertySpecNodes
private void VisitPropertySpecNodes(IASTNode propertyNode, ICollection<IType> types)
{
if (propertyNode == null)
{
return;
}
// TODO : we really need to be able to deal with component paths here also;
// this is difficult because the hql-sql grammar expects all those node types
// to be FromReferenceNodes. One potential fix here would be to convert the
// IntoClause to just use a FromClause/FromElement combo (as a child of the
// InsertStatement) and move all this logic into the InsertStatement. That's
// probably the easiest approach (read: least amount of changes to the grammar
// and code), but just doesn't feel right as then an insert would contain
// 2 from-clauses
string name = propertyNode.Text;
if (IsSuperclassProperty(name))
{
throw new QueryException("INSERT statements cannot refer to superclass/joined properties [" + name + "]");
}
if (name == _persister.IdentifierPropertyName)
{
_explicitIdInsertion = true;
}
if (_persister.IsVersioned)
{
if (name == _persister.PropertyNames[_persister.VersionProperty])
{
_explicitVersionInsertion = true;
}
}
string[] columnNames = _persister.ToColumns(name);
RenderColumns(columnNames);
types.Add(_persister.ToType(name));
// visit width-first, then depth
VisitPropertySpecNodes(propertyNode.NextSibling, types);
VisitPropertySpecNodes(propertyNode.GetFirstChild(), types);
}
示例3: Resolve
public override void Resolve(bool generateJoin, bool implicitJoin, string classAlias, IASTNode parent)
{
if (!IsResolved)
{
if (Walker.CurrentFromClause.IsFromElementAlias(Text))
{
if (ResolveAsAlias())
{
IsResolved = true;
// We represent a from-clause alias
}
}
else if (parent != null && parent.Type == HqlSqlWalker.DOT)
{
DotNode dot = (DotNode)parent;
if (parent.GetFirstChild() == this)
{
if (ResolveAsNakedComponentPropertyRefLhs(dot))
{
// we are the LHS of the DOT representing a naked comp-prop-ref
IsResolved = true;
}
}
else
{
if (ResolveAsNakedComponentPropertyRefRhs(dot))
{
// we are the RHS of the DOT representing a naked comp-prop-ref
IsResolved = true;
}
}
}
else
{
int result = ResolveAsNakedPropertyRef();
if (result == PropertyRef)
{
// we represent a naked (simple) prop-ref
IsResolved = true;
}
else if (result == ComponentRef)
{
// EARLY EXIT!!! return so the resolve call explicitly coming from DotNode can
// resolve this...
return;
}
}
// if we are still not resolved, we might represent a constant.
// needed to add this here because the allowance of
// naked-prop-refs in the grammar collides with the
// definition of literals/constants ("nondeterminism").
// TODO: cleanup the grammar so that "processConstants" is always just handled from here
if (!IsResolved)
{
try
{
Walker.LiteralProcessor.ProcessConstant(this, false);
}
catch (Exception)
{
// just ignore it for now, it'll get resolved later...
}
}
}
}