コード例 #1
0
		public virtual object VisitTypeOfExpression(TypeOfExpression typeOfExpression, object data) {
			throw new global::System.NotImplementedException("TypeOfExpression");
		}
コード例 #2
0
		public virtual object VisitTypeOfExpression(TypeOfExpression typeOfExpression, object data) {
			Debug.Assert((typeOfExpression != null));
			Debug.Assert((typeOfExpression.TypeReference != null));
			return typeOfExpression.TypeReference.AcceptVisitor(this, data);
		}
コード例 #3
0
		public virtual object VisitTypeOfExpression(TypeOfExpression typeOfExpression, object data) {
			Debug.Assert((typeOfExpression != null));
			Debug.Assert((typeOfExpression.TypeReference != null));
			nodeStack.Push(typeOfExpression.TypeReference);
			typeOfExpression.TypeReference.AcceptVisitor(this, data);
			typeOfExpression.TypeReference = ((TypeReference)(nodeStack.Pop()));
			return null;
		}
コード例 #4
0
ファイル: Parser.cs プロジェクト: ThomasZitzler/ILSpy
	void SimpleNonInvocationExpression(out Expression pexpr) {
		Expression expr;
		CollectionInitializerExpression cie;
		TypeReference type = null;
		string name = String.Empty;
		Location startLocation = la.Location;
		pexpr = null;

		if (StartOf(34)) {
			switch (la.kind) {
			case 3: {
				Get();
				pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; 
				break;
			}
			case 4: {
				Get();
				pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; 
				break;
			}
			case 7: {
				Get();
				pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; 
				break;
			}
			case 6: {
				Get();
				pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; 
				break;
			}
			case 5: {
				Get();
				pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; 
				break;
			}
			case 9: {
				Get();
				pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; 
				break;
			}
			case 8: {
				Get();
				pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; 
				break;
			}
			case 217: {
				Get();
				pexpr = new PrimitiveExpression(true, "true"); 
				break;
			}
			case 122: {
				Get();
				pexpr = new PrimitiveExpression(false, "false");
				break;
			}
			case 165: {
				Get();
				pexpr = new PrimitiveExpression(null, "null"); 
				break;
			}
			case 37: {
				Get();
				Expr(out expr);
				Expect(38);
				pexpr = new ParenthesizedExpression(expr);
				break;
			}
			case 2: case 58: case 62: case 64: case 65: case 66: case 67: case 70: case 87: case 98: case 104: case 107: case 116: case 121: case 126: case 133: case 139: case 143: case 146: case 147: case 170: case 176: case 178: case 184: case 203: case 212: case 213: case 223: case 224: case 230: {
				Identifier();
				pexpr = new IdentifierExpression(t.val);
					pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation;

				if (la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) {
					Expect(37);
					Expect(169);
					TypeArgumentList(((IdentifierExpression)pexpr).TypeArguments);
					Expect(38);
				}
				break;
			}
			case 68: case 71: case 82: case 99: case 100: case 109: case 141: case 151: case 168: case 196: case 201: case 202: case 208: case 221: case 222: case 225: {
				string val = String.Empty;
				if (StartOf(13)) {
					PrimitiveTypeName(out val);
				} else {
					Get();
					val = "System.Object";
				}
				pexpr = new TypeReferenceExpression(new TypeReference(val, true));
				break;
			}
			case 153: {
				Get();
				pexpr = new ThisReferenceExpression();
				break;
			}
			case 158: case 159: {
				Expression retExpr = null;
				if (la.kind == 158) {
					Get();
					retExpr = new BaseReferenceExpression() { StartLocation = t.Location, EndLocation = t.EndLocation };
				} else {
					Get();
					retExpr = new ClassReferenceExpression() { StartLocation = t.Location, EndLocation = t.EndLocation };
				}
				Expect(26);
				IdentifierOrKeyword(out name);
				pexpr = new MemberReferenceExpression(retExpr, name) { StartLocation = startLocation, EndLocation = t.EndLocation };
				break;
			}
			case 130: {
				Get();
				Expect(26);
				Identifier();
				type = new TypeReference(t.val ?? "");
				type.IsGlobal = true;
				pexpr = new TypeReferenceExpression(type);
				break;
			}
			case 162: {
				ObjectCreateExpression(out expr);
				pexpr = expr;
				break;
			}
			case 35: {
				CollectionInitializer(out cie);
				pexpr = cie;
				break;
			}
			case 94: case 106: case 219: {
				CastType castType = CastType.Cast;
				if (la.kind == 106) {
					Get();
				} else if (la.kind == 94) {
					Get();
					castType = CastType.Conversion;
				} else {
					Get();
					castType = CastType.TryCast;
				}
				Expect(37);
				Expr(out expr);
				Expect(22);
				TypeName(out type);
				Expect(38);
				pexpr = new CastExpression(type, expr, castType);
				break;
			}
			case 76: case 77: case 78: case 79: case 80: case 81: case 83: case 85: case 86: case 90: case 91: case 92: case 93: case 95: case 96: case 97: {
				CastTarget(out type);
				Expect(37);
				Expr(out expr);
				Expect(38);
				pexpr = new CastExpression(type, expr, CastType.PrimitiveConversion);
				break;
			}
			case 57: {
				Get();
				SimpleExpr(out expr);
				pexpr = new AddressOfExpression(expr);
				break;
			}
			case 129: {
				Get();
				Expect(37);
				GetTypeTypeName(out type);
				Expect(38);
				pexpr = new TypeOfExpression(type);
				break;
			}
			case 220: {
				Get();
				SimpleExpr(out expr);
				Expect(144);
				TypeName(out type);
				pexpr = new TypeOfIsExpression(expr, type);
				break;
			}
			case 135: {
				ConditionalExpression(out pexpr);
				break;
			}
			case 10: case 16: case 17: case 18: case 19: {
				XmlLiteralExpression(out pexpr);
				break;
			}
			}
		} else if (StartOf(35)) {
			if (la.kind == 26) {
				Get();
				if (la.kind == 10) {
					Get();
					IdentifierOrKeyword(out name);
					Expect(11);
					pexpr = new XmlMemberAccessExpression(null, XmlAxisType.Element, name, true) { StartLocation = startLocation, EndLocation = t.EndLocation };
				} else if (StartOf(33)) {
					IdentifierOrKeyword(out name);
					pexpr = new MemberReferenceExpression(null, name) { StartLocation = startLocation, EndLocation = t.EndLocation };
				} else SynErr(281);
			} else if (la.kind == 29) {
				Get();
				IdentifierOrKeyword(out name);
				pexpr = new BinaryOperatorExpression(null, BinaryOperatorType.DictionaryAccess, new PrimitiveExpression(name, name) { StartLocation = t.Location, EndLocation = t.EndLocation });
			} else {
				XmlAxisType axisType = XmlAxisType.Element; bool isXmlIdentifier = false;
				if (la.kind == 27) {
					Get();
					axisType = XmlAxisType.Descendents;
				} else {
					Get();
					axisType = XmlAxisType.Attribute;
				}
				if (la.kind == 10) {
					Get();
					isXmlIdentifier = true;
				}
				IdentifierOrKeyword(out name);
				if (la.kind == 11) {
					Get();
				}
				pexpr = new XmlMemberAccessExpression(null, axisType, name, isXmlIdentifier);
			}
		} else SynErr(282);
		if (pexpr != null) {
				pexpr.StartLocation = startLocation;
				pexpr.EndLocation = t.EndLocation;
			}

	}
コード例 #5
0
		public sealed override object VisitTypeOfExpression(TypeOfExpression typeOfExpression, object data) {
			this.BeginVisit(typeOfExpression);
			object result = this.TrackedVisitTypeOfExpression(typeOfExpression, data);
			this.EndVisit(typeOfExpression);
			return result;
		}
コード例 #6
0
		public virtual object TrackedVisitTypeOfExpression(TypeOfExpression typeOfExpression, object data) {
			return base.VisitTypeOfExpression(typeOfExpression, data);
		}
コード例 #7
0
		public override object VisitTypeOfExpression(TypeOfExpression typeOfExpression, object data)
		{
			return new CodeTypeOfExpression(ConvType(typeOfExpression.TypeReference));
		}