Наследование: ICSharpCode.NRefactory.Ast.Expression
Пример #1
0
		public virtual object VisitCheckedExpression(CheckedExpression checkedExpression, object data) {
			throw new global::System.NotImplementedException("CheckedExpression");
		}
		public sealed override object VisitCheckedExpression(CheckedExpression checkedExpression, object data) {
			this.BeginVisit(checkedExpression);
			object result = this.TrackedVisitCheckedExpression(checkedExpression, data);
			this.EndVisit(checkedExpression);
			return result;
		}
Пример #3
0
		public override object VisitCheckedExpression (CheckedExpression checkedExpression, object data)
		{
			return Resolve (checkedExpression.Expression);
		}
Пример #4
0
	void PrimaryExpr(
#line  1895 "cs.ATG" 
out Expression pexpr) {

#line  1897 "cs.ATG" 
		TypeReference type = null;
		Expression expr;
		pexpr = null;
		

#line  1902 "cs.ATG" 
		Location startLocation = la.Location; 
		if (la.kind == 113) {
			lexer.NextToken();

#line  1904 "cs.ATG" 
			pexpr = new PrimitiveExpression(true, "true");  
		} else if (la.kind == 72) {
			lexer.NextToken();

#line  1905 "cs.ATG" 
			pexpr = new PrimitiveExpression(false, "false"); 
		} else if (la.kind == 90) {
			lexer.NextToken();

#line  1906 "cs.ATG" 
			pexpr = new PrimitiveExpression(null, "null");  
		} else if (la.kind == 2) {
			lexer.NextToken();

#line  1907 "cs.ATG" 
			pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };  
		} else if (
#line  1908 "cs.ATG" 
StartOfQueryExpression()) {
			QueryExpression(
#line  1909 "cs.ATG" 
out pexpr);
		} else if (
#line  1910 "cs.ATG" 
IdentAndDoubleColon()) {
			Identifier();

#line  1911 "cs.ATG" 
			type = new TypeReference(t.val); 
			Expect(10);

#line  1912 "cs.ATG" 
			pexpr = new TypeReferenceExpression(type); 
			Identifier();

#line  1913 "cs.ATG" 
			if (type.Type == "global") { type.IsGlobal = true; type.Type = t.val ?? "?"; } else type.Type += "." + (t.val ?? "?"); 
		} else if (la.kind == 64) {
			lexer.NextToken();
			AnonymousMethodExpr(
#line  1915 "cs.ATG" 
out expr);

#line  1915 "cs.ATG" 
			pexpr = expr; 
		} else if (
#line  1916 "cs.ATG" 
la.kind == Tokens.Async && Peek(1).kind == Tokens.Delegate) {
			Expect(145);
			Expect(64);
			AnonymousMethodExpr(
#line  1917 "cs.ATG" 
out expr);

#line  1917 "cs.ATG" 
			pexpr = expr; 

#line  1918 "cs.ATG" 
			((AnonymousMethodExpression)expr).IsAsync = true; 
		} else if (
#line  1920 "cs.ATG" 
la.kind == Tokens.Async && Peek(1).kind == Tokens.OpenParenthesis) {
			Expect(145);
			LambdaExpression(
#line  1922 "cs.ATG" 
out pexpr);

#line  1923 "cs.ATG" 
			((LambdaExpression)pexpr).IsAsync = true; 
		} else if (
#line  1925 "cs.ATG" 
la.kind == Tokens.Async && IsIdentifierToken(Peek(1))) {
			Expect(145);
			Identifier();

#line  1927 "cs.ATG" 
			pexpr = new IdentifierExpression(t.val); 
			ShortedLambdaExpression(
#line  1928 "cs.ATG" 
(IdentifierExpression)pexpr, out pexpr);

#line  1929 "cs.ATG" 
			((LambdaExpression)pexpr).IsAsync = true; 
		} else if (StartOf(18)) {
			Identifier();

#line  1933 "cs.ATG" 
			pexpr = new IdentifierExpression(t.val); 
			if (la.kind == 48 || 
#line  1936 "cs.ATG" 
IsGenericInSimpleNameOrMemberAccess()) {
				if (la.kind == 48) {
					ShortedLambdaExpression(
#line  1935 "cs.ATG" 
(IdentifierExpression)pexpr, out pexpr);
				} else {

#line  1937 "cs.ATG" 
					List<TypeReference> typeList; 
					TypeArgumentList(
#line  1938 "cs.ATG" 
out typeList, false);

#line  1939 "cs.ATG" 
					((IdentifierExpression)pexpr).TypeArguments = typeList; 
				}
			}
		} else if (
#line  1942 "cs.ATG" 
IsLambdaExpression()) {
			LambdaExpression(
#line  1943 "cs.ATG" 
out pexpr);
		} else if (la.kind == 20) {
			lexer.NextToken();
			Expr(
#line  1946 "cs.ATG" 
out expr);
			Expect(21);

#line  1946 "cs.ATG" 
			pexpr = new ParenthesizedExpression(expr); 
		} else if (StartOf(34)) {

#line  1949 "cs.ATG" 
			string val = null; 
			switch (la.kind) {
			case 52: {
				lexer.NextToken();

#line  1950 "cs.ATG" 
				val = "System.Boolean"; 
				break;
			}
			case 54: {
				lexer.NextToken();

#line  1951 "cs.ATG" 
				val = "System.Byte"; 
				break;
			}
			case 57: {
				lexer.NextToken();

#line  1952 "cs.ATG" 
				val = "System.Char"; 
				break;
			}
			case 62: {
				lexer.NextToken();

#line  1953 "cs.ATG" 
				val = "System.Decimal"; 
				break;
			}
			case 66: {
				lexer.NextToken();

#line  1954 "cs.ATG" 
				val = "System.Double"; 
				break;
			}
			case 75: {
				lexer.NextToken();

#line  1955 "cs.ATG" 
				val = "System.Single"; 
				break;
			}
			case 82: {
				lexer.NextToken();

#line  1956 "cs.ATG" 
				val = "System.Int32"; 
				break;
			}
			case 87: {
				lexer.NextToken();

#line  1957 "cs.ATG" 
				val = "System.Int64"; 
				break;
			}
			case 91: {
				lexer.NextToken();

#line  1958 "cs.ATG" 
				val = "System.Object"; 
				break;
			}
			case 102: {
				lexer.NextToken();

#line  1959 "cs.ATG" 
				val = "System.SByte"; 
				break;
			}
			case 104: {
				lexer.NextToken();

#line  1960 "cs.ATG" 
				val = "System.Int16"; 
				break;
			}
			case 108: {
				lexer.NextToken();

#line  1961 "cs.ATG" 
				val = "System.String"; 
				break;
			}
			case 116: {
				lexer.NextToken();

#line  1962 "cs.ATG" 
				val = "System.UInt32"; 
				break;
			}
			case 117: {
				lexer.NextToken();

#line  1963 "cs.ATG" 
				val = "System.UInt64"; 
				break;
			}
			case 120: {
				lexer.NextToken();

#line  1964 "cs.ATG" 
				val = "System.UInt16"; 
				break;
			}
			case 123: {
				lexer.NextToken();

#line  1965 "cs.ATG" 
				val = "System.Void"; 
				break;
			}
			}

#line  1967 "cs.ATG" 
			pexpr = new TypeReferenceExpression(new TypeReference(val, true)) { StartLocation = t.Location, EndLocation = t.EndLocation }; 
		} else if (la.kind == 111) {
			lexer.NextToken();

#line  1970 "cs.ATG" 
			pexpr = new ThisReferenceExpression(); pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation; 
		} else if (la.kind == 51) {
			lexer.NextToken();

#line  1972 "cs.ATG" 
			pexpr = new BaseReferenceExpression(); pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation; 
		} else if (la.kind == 89) {
			NewExpression(
#line  1975 "cs.ATG" 
out pexpr);
		} else if (la.kind == 115) {
			lexer.NextToken();
			Expect(20);
			if (
#line  1979 "cs.ATG" 
NotVoidPointer()) {
				Expect(123);

#line  1979 "cs.ATG" 
				type = new TypeReference("System.Void", true); 
			} else if (StartOf(10)) {
				TypeWithRestriction(
#line  1980 "cs.ATG" 
out type, true, true);
			} else SynErr(208);
			Expect(21);

#line  1982 "cs.ATG" 
			pexpr = new TypeOfExpression(type); 
		} else if (la.kind == 63) {
			lexer.NextToken();
			Expect(20);
			Type(
#line  1984 "cs.ATG" 
out type);
			Expect(21);

#line  1984 "cs.ATG" 
			pexpr = new DefaultValueExpression(type); 
		} else if (la.kind == 105) {
			lexer.NextToken();
			Expect(20);
			Type(
#line  1985 "cs.ATG" 
out type);
			Expect(21);

#line  1985 "cs.ATG" 
			pexpr = new SizeOfExpression(type); 
		} else if (la.kind == 58) {
			lexer.NextToken();
			Expect(20);
			Expr(
#line  1986 "cs.ATG" 
out expr);
			Expect(21);

#line  1986 "cs.ATG" 
			pexpr = new CheckedExpression(expr); 
		} else if (la.kind == 118) {
			lexer.NextToken();
			Expect(20);
			Expr(
#line  1987 "cs.ATG" 
out expr);
			Expect(21);

#line  1987 "cs.ATG" 
			pexpr = new UncheckedExpression(expr); 
		} else SynErr(209);

#line  1989 "cs.ATG" 
		if (pexpr != null) {
		if (pexpr.StartLocation.IsEmpty)
			pexpr.StartLocation = startLocation;
		if (pexpr.EndLocation.IsEmpty)
			pexpr.EndLocation = t.EndLocation;
		}
		
		while (StartOf(35)) {

#line  1997 "cs.ATG" 
			startLocation = la.Location; 
			switch (la.kind) {
			case 31: {
				lexer.NextToken();

#line  1999 "cs.ATG" 
				pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostIncrement); 
				break;
			}
			case 32: {
				lexer.NextToken();

#line  2001 "cs.ATG" 
				pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostDecrement); 
				break;
			}
			case 47: {
				PointerMemberAccess(
#line  2003 "cs.ATG" 
out pexpr, pexpr);
				break;
			}
			case 15: {
				MemberAccess(
#line  2004 "cs.ATG" 
out pexpr, pexpr);
				break;
			}
			case 20: {
				lexer.NextToken();

#line  2008 "cs.ATG" 
				List<Expression> parameters = new List<Expression>(); 

#line  2009 "cs.ATG" 
				pexpr = new InvocationExpression(pexpr, parameters); 
				if (StartOf(25)) {
					Argument(
#line  2010 "cs.ATG" 
out expr);

#line  2010 "cs.ATG" 
					SafeAdd(pexpr, parameters, expr); 
					while (la.kind == 14) {
						lexer.NextToken();
						Argument(
#line  2011 "cs.ATG" 
out expr);

#line  2011 "cs.ATG" 
						SafeAdd(pexpr, parameters, expr); 
					}
				}
				Expect(21);
				break;
			}
			case 18: {

#line  2017 "cs.ATG" 
				List<Expression> indices = new List<Expression>();
				pexpr = new IndexerExpression(pexpr, indices);
				
				lexer.NextToken();
				Expr(
#line  2020 "cs.ATG" 
out expr);

#line  2020 "cs.ATG" 
				SafeAdd(pexpr, indices, expr); 
				while (la.kind == 14) {
					lexer.NextToken();
					Expr(
#line  2021 "cs.ATG" 
out expr);

#line  2021 "cs.ATG" 
					SafeAdd(pexpr, indices, expr); 
				}
				Expect(19);
				break;
			}
			}

#line  2024 "cs.ATG" 
			if (pexpr != null) {
			if (pexpr.StartLocation.IsEmpty)
				pexpr.StartLocation = startLocation;
			if (pexpr.EndLocation.IsEmpty)
				pexpr.EndLocation = t.EndLocation;
			}
			
		}
	}
		public virtual object VisitCheckedExpression(CheckedExpression checkedExpression, object data) {
			Debug.Assert((checkedExpression != null));
			Debug.Assert((checkedExpression.Expression != null));
			nodeStack.Push(checkedExpression.Expression);
			checkedExpression.Expression.AcceptVisitor(this, data);
			checkedExpression.Expression = ((Expression)(nodeStack.Pop()));
			return null;
		}
Пример #6
0
 public virtual object VisitCheckedExpression(CheckedExpression checkedExpression, object data) {
     throw CreateException(checkedExpression);
 }
Пример #7
0
 public virtual object VisitCheckedExpression(CheckedExpression checkedExpression, object data)
 {
     Debug.Assert((checkedExpression != null));
     Debug.Assert((checkedExpression.Expression != null));
     return checkedExpression.Expression.AcceptVisitor(this, data);
 }
		public object VisitCheckedExpression(CheckedExpression checkedExpression, object data)
		{
			AddError(checkedExpression, "Using 'checked' inside an expression is not supported by boo, " +
			         "use the checked {} block instead.");
			return MakeMethodCall("checked", ConvertExpression(checkedExpression.Expression));
		}
 public virtual bool VisitCheckedExpression(CheckedExpression checkedExpression, object d)
 {
     if ((checkedExpression == null)) {
         return SetFailure();
     }
     if ((d == null)) {
         return SetFailure();
     }
     if ((checkedExpression.Expression == null)) {
         return SetFailure();
     }
     if(checkedExpression.GetType() != d.GetType()) {return SetFailure();}
     var data = (CheckedExpression)d;
     if (!IsMatch(checkedExpression, data)) {
         return SetFailure();
     }
     return checkedExpression.Expression.AcceptVisitor(this, data.Expression);
 }
 public object VisitCheckedExpression(CheckedExpression checkedExpression, object data)
 {
     throw new NotImplementedException ();
 }
Пример #11
0
		public override object VisitCheckedExpression(CheckedExpression checkedExpression, object data)
		{
			return base.VisitCheckedExpression(checkedExpression, data);
		}
 private bool IsMatch(CheckedExpression left, CheckedExpression right)
 {
     return false;
 }
Пример #13
0
		public override object VisitCheckedExpression(CheckedExpression checkedExpression, object data)
		{
			return checkedExpression.Expression.AcceptVisitor(this, data);
		}
		public virtual object TrackedVisitCheckedExpression(CheckedExpression checkedExpression, object data) {
			return base.VisitCheckedExpression(checkedExpression, data);
		}
Пример #15
0
	void PrimaryExpr(
#line  1849 "cs.ATG" 
out Expression pexpr) {

#line  1851 "cs.ATG" 
		TypeReference type = null;
		Expression expr;
		pexpr = null;
		

#line  1856 "cs.ATG" 
		Location startLocation = la.Location; 
		if (la.kind == 113) {
			lexer.NextToken();

#line  1858 "cs.ATG" 
			pexpr = new PrimitiveExpression(true, "true");  
		} else if (la.kind == 72) {
			lexer.NextToken();

#line  1859 "cs.ATG" 
			pexpr = new PrimitiveExpression(false, "false"); 
		} else if (la.kind == 90) {
			lexer.NextToken();

#line  1860 "cs.ATG" 
			pexpr = new PrimitiveExpression(null, "null");  
		} else if (la.kind == 2) {
			lexer.NextToken();

#line  1861 "cs.ATG" 
            PrimitiveExpression primitiveExpression = new PrimitiveExpression(t.literalValue, t.val);
            primitiveExpression.LiteralFormat = t.literalFormat;
            pexpr = primitiveExpression;
            
		} else if (
#line  1862 "cs.ATG" 
StartOfQueryExpression()) {
			QueryExpression(
#line  1863 "cs.ATG" 
out pexpr);
		} else if (
#line  1864 "cs.ATG" 
IdentAndDoubleColon()) {
			Identifier();

#line  1865 "cs.ATG" 
			type = new TypeReference(t.val); 
			Expect(10);

#line  1866 "cs.ATG" 
			pexpr = new TypeReferenceExpression(type); 
			Identifier();

#line  1867 "cs.ATG" 
			if (type.Type == "global") { type.IsGlobal = true; type.Type = t.val ?? "?"; } else type.Type += "." + (t.val ?? "?"); 
		} else if (StartOf(19)) {
			Identifier();

#line  1871 "cs.ATG" 
			pexpr = new IdentifierExpression(t.val); 
			if (la.kind == 48 || 
#line  1874 "cs.ATG" 
IsGenericInSimpleNameOrMemberAccess()) {
				if (la.kind == 48) {
					ShortedLambdaExpression(
#line  1873 "cs.ATG" 
(IdentifierExpression)pexpr, out pexpr);
				} else {

#line  1875 "cs.ATG" 
					List<TypeReference> typeList; 
					TypeArgumentList(
#line  1876 "cs.ATG" 
out typeList, false);

#line  1877 "cs.ATG" 
					((IdentifierExpression)pexpr).TypeArguments = typeList; 
				}
			}
		} else if (
#line  1879 "cs.ATG" 
IsLambdaExpression()) {
			LambdaExpression(
#line  1880 "cs.ATG" 
out pexpr);
		} else if (la.kind == 20) {
			lexer.NextToken();
			Expr(
#line  1883 "cs.ATG" 
out expr);
			Expect(21);

#line  1883 "cs.ATG" 
			pexpr = new ParenthesizedExpression(expr); 
		} else if (StartOf(35)) {

#line  1886 "cs.ATG" 
			string val = null; 
			switch (la.kind) {
			case 52: {
				lexer.NextToken();

#line  1887 "cs.ATG" 
				val = "System.Boolean"; 
				break;
			}
			case 54: {
				lexer.NextToken();

#line  1888 "cs.ATG" 
				val = "System.Byte"; 
				break;
			}
			case 57: {
				lexer.NextToken();

#line  1889 "cs.ATG" 
				val = "System.Char"; 
				break;
			}
			case 62: {
				lexer.NextToken();

#line  1890 "cs.ATG" 
				val = "System.Decimal"; 
				break;
			}
			case 66: {
				lexer.NextToken();

#line  1891 "cs.ATG" 
				val = "System.Double"; 
				break;
			}
			case 75: {
				lexer.NextToken();

#line  1892 "cs.ATG" 
				val = "System.Single"; 
				break;
			}
			case 82: {
				lexer.NextToken();

#line  1893 "cs.ATG" 
				val = "System.Int32"; 
				break;
			}
			case 87: {
				lexer.NextToken();

#line  1894 "cs.ATG" 
				val = "System.Int64"; 
				break;
			}
			case 91: {
				lexer.NextToken();

#line  1895 "cs.ATG" 
				val = "System.Object"; 
				break;
			}
			case 102: {
				lexer.NextToken();

#line  1896 "cs.ATG" 
				val = "System.SByte"; 
				break;
			}
			case 104: {
				lexer.NextToken();

#line  1897 "cs.ATG" 
				val = "System.Int16"; 
				break;
			}
			case 108: {
				lexer.NextToken();

#line  1898 "cs.ATG" 
				val = "System.String"; 
				break;
			}
			case 116: {
				lexer.NextToken();

#line  1899 "cs.ATG" 
				val = "System.UInt32"; 
				break;
			}
			case 117: {
				lexer.NextToken();

#line  1900 "cs.ATG" 
				val = "System.UInt64"; 
				break;
			}
			case 120: {
				lexer.NextToken();

#line  1901 "cs.ATG" 
				val = "System.UInt16"; 
				break;
			}
			case 123: {
				lexer.NextToken();

#line  1902 "cs.ATG" 
				val = "System.Void"; 
				break;
			}
			}

#line  1904 "cs.ATG" 
			pexpr = new TypeReferenceExpression(new TypeReference(val, true));
            pexpr.StartLocation = t.Location;
            pexpr.EndLocation = t.EndLocation; 
		} else if (la.kind == 111) {
			lexer.NextToken();

#line  1907 "cs.ATG" 
			pexpr = new ThisReferenceExpression(); pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation; 
		} else if (la.kind == 51) {
			lexer.NextToken();

#line  1909 "cs.ATG" 
			pexpr = new BaseReferenceExpression(); pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation; 
		} else if (la.kind == 89) {
			NewExpression(
#line  1912 "cs.ATG" 
out pexpr);
		} else if (la.kind == 115) {
			lexer.NextToken();
			Expect(20);
			if (
#line  1916 "cs.ATG" 
NotVoidPointer()) {
				Expect(123);

#line  1916 "cs.ATG" 
				type = new TypeReference("System.Void", true); 
			} else if (StartOf(10)) {
				TypeWithRestriction(
#line  1917 "cs.ATG" 
out type, true, true);
			} else SynErr(207);
			Expect(21);

#line  1919 "cs.ATG" 
			pexpr = new TypeOfExpression(type); 
		} else if (la.kind == 63) {
			lexer.NextToken();
			Expect(20);
			Type(
#line  1921 "cs.ATG" 
out type);
			Expect(21);

#line  1921 "cs.ATG" 
			pexpr = new DefaultValueExpression(type); 
		} else if (la.kind == 105) {
			lexer.NextToken();
			Expect(20);
			Type(
#line  1922 "cs.ATG" 
out type);
			Expect(21);

#line  1922 "cs.ATG" 
			pexpr = new SizeOfExpression(type); 
		} else if (la.kind == 58) {
			lexer.NextToken();
			Expect(20);
			Expr(
#line  1923 "cs.ATG" 
out expr);
			Expect(21);

#line  1923 "cs.ATG" 
			pexpr = new CheckedExpression(expr); 
		} else if (la.kind == 118) {
			lexer.NextToken();
			Expect(20);
			Expr(
#line  1924 "cs.ATG" 
out expr);
			Expect(21);

#line  1924 "cs.ATG" 
			pexpr = new UncheckedExpression(expr); 
		} else if (la.kind == 64) {
			lexer.NextToken();
			AnonymousMethodExpr(
#line  1925 "cs.ATG" 
out expr);

#line  1925 "cs.ATG" 
			pexpr = expr; 
		} else SynErr(208);

#line  1927 "cs.ATG" 
		if (pexpr != null) {
		if (pexpr.StartLocation.IsEmpty)
			pexpr.StartLocation = startLocation;
		if (pexpr.EndLocation.IsEmpty)
			pexpr.EndLocation = t.EndLocation;
		}
		
		while (StartOf(36)) {

#line  1935 "cs.ATG" 
			startLocation = la.Location; 
			switch (la.kind) {
			case 31: {
				lexer.NextToken();

#line  1937 "cs.ATG" 
				pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostIncrement); 
				break;
			}
			case 32: {
				lexer.NextToken();

#line  1939 "cs.ATG" 
				pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostDecrement); 
				break;
			}
			case 47: {
				PointerMemberAccess(
#line  1941 "cs.ATG" 
out pexpr, pexpr);
				break;
			}
			case 15: {
				MemberAccess(
#line  1942 "cs.ATG" 
out pexpr, pexpr);
				break;
			}
			case 20: {
				lexer.NextToken();

#line  1946 "cs.ATG" 
				List<Expression> parameters = new List<Expression>(); 

#line  1947 "cs.ATG" 
				pexpr = new InvocationExpression(pexpr, parameters); 
				if (StartOf(26)) {
					Argument(
#line  1948 "cs.ATG" 
out expr);

#line  1948 "cs.ATG" 
					SafeAdd(pexpr, parameters, expr); 
					while (la.kind == 14) {
						lexer.NextToken();
						Argument(
#line  1949 "cs.ATG" 
out expr);

#line  1949 "cs.ATG" 
						SafeAdd(pexpr, parameters, expr); 
					}
				}
				Expect(21);
				break;
			}
			case 18: {

#line  1955 "cs.ATG" 
				List<Expression> indices = new List<Expression>();
				pexpr = new IndexerExpression(pexpr, indices);
				
				lexer.NextToken();
				Expr(
#line  1958 "cs.ATG" 
out expr);

#line  1958 "cs.ATG" 
				SafeAdd(pexpr, indices, expr); 
				while (la.kind == 14) {
					lexer.NextToken();
					Expr(
#line  1959 "cs.ATG" 
out expr);

#line  1959 "cs.ATG" 
					SafeAdd(pexpr, indices, expr); 
				}
				Expect(19);
				break;
			}
			}

#line  1962 "cs.ATG" 
			if (pexpr != null) {
			if (pexpr.StartLocation.IsEmpty)
				pexpr.StartLocation = startLocation;
			if (pexpr.EndLocation.IsEmpty)
				pexpr.EndLocation = t.EndLocation;
			}
			
		}
	}
 public override object TrackedVisitCheckedExpression(CheckedExpression checkedExpression, object data)
 {
     Console.WriteLine("VisitCheckedExpression");
     return null;
 }
Пример #17
0
	void PrimaryExpr(
#line  1810 "cs.ATG" 
out Expression pexpr) {

#line  1812 "cs.ATG" 
		TypeReference type = null;
		Expression expr;
		pexpr = null;
		

#line  1817 "cs.ATG" 
		Location startLocation = la.Location; 
		if (la.kind == 113) {
			lexer.NextToken();

#line  1819 "cs.ATG" 
			pexpr = new PrimitiveExpression(true, "true");  
		} else if (la.kind == 72) {
			lexer.NextToken();

#line  1820 "cs.ATG" 
			pexpr = new PrimitiveExpression(false, "false"); 
		} else if (la.kind == 90) {
			lexer.NextToken();

#line  1821 "cs.ATG" 
			pexpr = new PrimitiveExpression(null, "null");  
		} else if (la.kind == 2) {
			lexer.NextToken();

#line  1822 "cs.ATG" 
			pexpr = new PrimitiveExpression(t.literalValue, t.val);  
		} else if (
#line  1823 "cs.ATG" 
StartOfQueryExpression()) {
			QueryExpression(
#line  1824 "cs.ATG" 
out pexpr);
		} else if (
#line  1825 "cs.ATG" 
IdentAndDoubleColon()) {
			Identifier();

#line  1826 "cs.ATG" 
			type = new TypeReference(t.val); 
			Expect(10);

#line  1827 "cs.ATG" 
			pexpr = new TypeReferenceExpression(type); 
			Identifier();

#line  1828 "cs.ATG" 
			if (type.Type == "global") { type.IsGlobal = true; type.Type = (t.val ?? "?"); } else type.Type += "." + (t.val ?? "?"); 
		} else if (StartOf(19)) {
			Identifier();

#line  1832 "cs.ATG" 
			pexpr = new IdentifierExpression(t.val); 
			if (la.kind == 48 || 
#line  1835 "cs.ATG" 
IsGenericInSimpleNameOrMemberAccess()) {
				if (la.kind == 48) {
					ShortedLambdaExpression(
#line  1834 "cs.ATG" 
(IdentifierExpression)pexpr, out pexpr);
				} else {

#line  1836 "cs.ATG" 
					List<TypeReference> typeList; 
					TypeArgumentList(
#line  1837 "cs.ATG" 
out typeList, false);

#line  1838 "cs.ATG" 
					((IdentifierExpression)pexpr).TypeArguments = typeList; 
				}
			}
		} else if (
#line  1840 "cs.ATG" 
IsLambdaExpression()) {
			LambdaExpression(
#line  1841 "cs.ATG" 
out pexpr);
		} else if (la.kind == 20) {
			lexer.NextToken();
			Expr(
#line  1844 "cs.ATG" 
out expr);
			Expect(21);

#line  1844 "cs.ATG" 
			pexpr = new ParenthesizedExpression(expr); 
		} else if (StartOf(35)) {

#line  1847 "cs.ATG" 
			string val = null; 
			switch (la.kind) {
			case 52: {
				lexer.NextToken();

#line  1848 "cs.ATG" 
				val = "bool"; 
				break;
			}
			case 54: {
				lexer.NextToken();

#line  1849 "cs.ATG" 
				val = "byte"; 
				break;
			}
			case 57: {
				lexer.NextToken();

#line  1850 "cs.ATG" 
				val = "char"; 
				break;
			}
			case 62: {
				lexer.NextToken();

#line  1851 "cs.ATG" 
				val = "decimal"; 
				break;
			}
			case 66: {
				lexer.NextToken();

#line  1852 "cs.ATG" 
				val = "double"; 
				break;
			}
			case 75: {
				lexer.NextToken();

#line  1853 "cs.ATG" 
				val = "float"; 
				break;
			}
			case 82: {
				lexer.NextToken();

#line  1854 "cs.ATG" 
				val = "int"; 
				break;
			}
			case 87: {
				lexer.NextToken();

#line  1855 "cs.ATG" 
				val = "long"; 
				break;
			}
			case 91: {
				lexer.NextToken();

#line  1856 "cs.ATG" 
				val = "object"; 
				break;
			}
			case 102: {
				lexer.NextToken();

#line  1857 "cs.ATG" 
				val = "sbyte"; 
				break;
			}
			case 104: {
				lexer.NextToken();

#line  1858 "cs.ATG" 
				val = "short"; 
				break;
			}
			case 108: {
				lexer.NextToken();

#line  1859 "cs.ATG" 
				val = "string"; 
				break;
			}
			case 116: {
				lexer.NextToken();

#line  1860 "cs.ATG" 
				val = "uint"; 
				break;
			}
			case 117: {
				lexer.NextToken();

#line  1861 "cs.ATG" 
				val = "ulong"; 
				break;
			}
			case 120: {
				lexer.NextToken();

#line  1862 "cs.ATG" 
				val = "ushort"; 
				break;
			}
			}
			MemberAccess(
#line  1864 "cs.ATG" 
out pexpr, new TypeReferenceExpression(val) { StartLocation = t.Location, EndLocation = t.EndLocation } );
		} else if (la.kind == 111) {
			lexer.NextToken();

#line  1867 "cs.ATG" 
			pexpr = new ThisReferenceExpression(); 
		} else if (la.kind == 51) {
			lexer.NextToken();

#line  1869 "cs.ATG" 
			pexpr = new BaseReferenceExpression(); 
		} else if (la.kind == 89) {
			NewExpression(
#line  1872 "cs.ATG" 
out pexpr);
		} else if (la.kind == 115) {
			lexer.NextToken();
			Expect(20);
			if (
#line  1876 "cs.ATG" 
NotVoidPointer()) {
				Expect(123);

#line  1876 "cs.ATG" 
				type = new TypeReference("void"); 
			} else if (StartOf(10)) {
				TypeWithRestriction(
#line  1877 "cs.ATG" 
out type, true, true);
			} else SynErr(207);
			Expect(21);

#line  1879 "cs.ATG" 
			pexpr = new TypeOfExpression(type); 
		} else if (la.kind == 63) {
			lexer.NextToken();
			Expect(20);
			Type(
#line  1881 "cs.ATG" 
out type);
			Expect(21);

#line  1881 "cs.ATG" 
			pexpr = new DefaultValueExpression(type); 
		} else if (la.kind == 105) {
			lexer.NextToken();
			Expect(20);
			Type(
#line  1882 "cs.ATG" 
out type);
			Expect(21);

#line  1882 "cs.ATG" 
			pexpr = new SizeOfExpression(type); 
		} else if (la.kind == 58) {
			lexer.NextToken();
			Expect(20);
			Expr(
#line  1883 "cs.ATG" 
out expr);
			Expect(21);

#line  1883 "cs.ATG" 
			pexpr = new CheckedExpression(expr); 
		} else if (la.kind == 118) {
			lexer.NextToken();
			Expect(20);
			Expr(
#line  1884 "cs.ATG" 
out expr);
			Expect(21);

#line  1884 "cs.ATG" 
			pexpr = new UncheckedExpression(expr); 
		} else if (la.kind == 64) {
			lexer.NextToken();
			AnonymousMethodExpr(
#line  1885 "cs.ATG" 
out expr);

#line  1885 "cs.ATG" 
			pexpr = expr; 
		} else SynErr(208);

#line  1887 "cs.ATG" 
		if (pexpr != null) {
		pexpr.StartLocation = startLocation;
		pexpr.EndLocation = t.EndLocation;
		}
		
		while (StartOf(36)) {
			if (la.kind == 31 || la.kind == 32) {

#line  1893 "cs.ATG" 
				startLocation = la.Location; 
				if (la.kind == 31) {
					lexer.NextToken();

#line  1895 "cs.ATG" 
					pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostIncrement); 
				} else if (la.kind == 32) {
					lexer.NextToken();

#line  1896 "cs.ATG" 
					pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostDecrement); 
				} else SynErr(209);
			} else if (la.kind == 47) {
				PointerMemberAccess(
#line  1899 "cs.ATG" 
out pexpr, pexpr);
			} else if (la.kind == 15) {
				MemberAccess(
#line  1900 "cs.ATG" 
out pexpr, pexpr);
			} else if (la.kind == 20) {
				lexer.NextToken();

#line  1903 "cs.ATG" 
				List<Expression> parameters = new List<Expression>(); 
				if (StartOf(26)) {
					Argument(
#line  1904 "cs.ATG" 
out expr);

#line  1904 "cs.ATG" 
					if (expr != null) {parameters.Add(expr);} 
					while (la.kind == 14) {
						lexer.NextToken();
						Argument(
#line  1905 "cs.ATG" 
out expr);

#line  1905 "cs.ATG" 
						if (expr != null) {parameters.Add(expr);} 
					}
				}
				Expect(21);

#line  1908 "cs.ATG" 
				pexpr = new InvocationExpression(pexpr, parameters); 
			} else {

#line  1911 "cs.ATG" 
				List<Expression> indices = new List<Expression>();
				
				lexer.NextToken();
				Expr(
#line  1913 "cs.ATG" 
out expr);

#line  1913 "cs.ATG" 
				if (expr != null) { indices.Add(expr); } 
				while (la.kind == 14) {
					lexer.NextToken();
					Expr(
#line  1914 "cs.ATG" 
out expr);

#line  1914 "cs.ATG" 
					if (expr != null) { indices.Add(expr); } 
				}
				Expect(19);

#line  1915 "cs.ATG" 
				pexpr = new IndexerExpression(pexpr, indices); 

#line  1917 "cs.ATG" 
				if (pexpr != null) {
				pexpr.StartLocation = startLocation;
				pexpr.EndLocation = t.EndLocation;
				}
				
			}
		}
	}