public virtual object VisitUsingDirective(UsingDirectiveNode @using, object data) { stackMap.Push(@using); if (@using.AliasName != null) { @using.AliasName.AcceptVisitor(this, data); } @using.Target.AcceptVisitor(this, data); stackMap.Pop(); return(null); }
private void ParseUsingDirectives() { do { Advance(); UsingDirectiveNode node = new UsingDirectiveNode(curtok); QualifiedIdentifierExpression nameOrAlias = ParseQualifiedIdentifier(true, false, false); if (curtok.ID == TokenID.Equal) { Advance(); // an alias could be write like // using alias = path.identifier // // or like // using alias = path.identifier<object> // // is not possible to know before if this a type or an qualified identifier // so we always parse it as a Qualified expression, and if the result is not a type // we keep only the identifier part QualifiedIdentifierExpression target = ParseQualifiedIdentifier(true, false, false); if (target.IsType) { node.Target = new TypeNode( target ); } else { // it does not mean that this is not a type. // it only means that actually we can not resolve the type // but in a next stage, we wiil probably resolve it as a type. node.Target = target; } node.AliasName = nameOrAlias; } else { node.Target = nameOrAlias; } AssertAndAdvance(TokenID.Semi); namespaceStack.Peek().UsingDirectives.Add(node); this.currentContext.AddUsingDirective(node); } while (curtok.ID == TokenID.Using); }
public virtual object VisitUsingDirective(UsingDirectiveNode @using, object data) { stackMap.Push(@using); if (@using.AliasName != null) { @using.AliasName.AcceptVisitor(this, data); } @using.Target.AcceptVisitor(this, data); stackMap.Pop(); return null; }