public virtual void Visit(TemplateThisParameter p)
		{
			VisitTemplateParameter (p);
			if (p.FollowParameter != null)
				p.FollowParameter.Accept(this);
		}
		bool Handle(TemplateThisParameter p, ISemantic arg)
		{
			// Only special handling required for method calls
			return Handle(p.FollowParameter,arg);
		}
 bool Handle(TemplateThisParameter p, ISemantic arg)
 {
     // Only special handling required for method calls
     return(Handle(p.FollowParameter, arg));
 }
Beispiel #4
0
		TemplateParameter TemplateParameter(DNode parent)
		{
			CodeLocation startLoc;

			// TemplateThisParameter
			if (laKind == (This))
			{
				Step();

				startLoc = t.Location;
				var end = t.EndLocation;

				var ret= new TemplateThisParameter(TemplateParameter(parent), parent) { Location=startLoc, EndLocation=end };
				LastParsedObject = ret;
				return ret;
			}

			// TemplateTupleParameter
			else if (laKind == (Identifier) && Lexer.CurrentPeekToken.Kind == TripleDot)
			{
				Step();
				startLoc = t.Location;
				var id = t.Value;
				Step();

				var ret=new TemplateTupleParameter(id, startLoc, parent) { Location=startLoc, EndLocation=t.EndLocation	};
				LastParsedObject = ret;
				return ret;
			}

			// TemplateAliasParameter
			else if (laKind == (Alias))
			{
				Step();

				startLoc = t.Location;
				TemplateAliasParameter al;

				if(Expect(Identifier))
					al = new TemplateAliasParameter(t.Value, t.Location, parent);
				else
					al = new TemplateAliasParameter(0, CodeLocation.Empty, parent);
				al.Location = startLoc;
				LastParsedObject = al;

				// TODO?:
				// alias BasicType Declarator TemplateAliasParameterSpecialization_opt TemplateAliasParameterDefault_opt

				// TemplateAliasParameterSpecialization
				if (laKind == (Colon))
				{
					Step();

					AllowWeakTypeParsing=true;
					al.SpecializationType = Type();
					AllowWeakTypeParsing=false;

					if (al.SpecializationType==null)
						al.SpecializationExpression = ConditionalExpression();
				}

				// TemplateAliasParameterDefault
				if (laKind == (Assign))
				{
					Step();

					AllowWeakTypeParsing=true;
					al.DefaultType = Type();
					AllowWeakTypeParsing=false;

					if (al.DefaultType==null)
						al.DefaultExpression = ConditionalExpression();
				}
				al.EndLocation = t.EndLocation;
				return al;
			}

			// TemplateTypeParameter
			else if (laKind == (Identifier) && (Lexer.CurrentPeekToken.Kind == (Colon) || Lexer.CurrentPeekToken.Kind == (Assign) || Lexer.CurrentPeekToken.Kind == (Comma) || Lexer.CurrentPeekToken.Kind == (CloseParenthesis)))
			{
				Expect(Identifier);
				var tt = new TemplateTypeParameter(t.Value, t.Location, parent) { Location = t.Location };
				LastParsedObject = tt;

				if (laKind == Colon)
				{
					Step();
					tt.Specialization = Type();
				}

				if (laKind == Assign)
				{
					Step();
					tt.Default = Type();
				}
				tt.EndLocation = t.EndLocation;
				return tt;
			}

			// TemplateValueParameter
			startLoc = la.Location;
			var bt = BasicType();
			var dv = Declarator(bt,false, null);

			if (dv == null) {
				SynErr (t.Kind, "Declarator expected for parsing template value parameter");
				return null;
			}

			var tv = new TemplateValueParameter(dv.NameHash, dv.NameLocation, parent) { 
				Location=la.Location,
				Type = dv.Type
			};
			LastParsedObject = tv;

			if (laKind == (Colon))
			{
				Step();
				tv.SpecializationExpression = ConditionalExpression();
			}

			if (laKind == (Assign))
			{
				Step();
				tv.DefaultExpression = AssignExpression();
			}
			tv.EndLocation = t.EndLocation;
			return tv;
		}
 public ulong Visit(TemplateThisParameter templateThisParameter)
 {
     return(1002109);
 }