public override void GenerateCode(List<AbstractNode> nodes, IList items) { TypeReference intReference = new TypeReference("System.Int32"); MethodDeclaration method = new MethodDeclaration("GetHashCode", Modifiers.Public | Modifiers.Override, intReference, null, null); Expression expr = CallGetHashCode(new IdentifierExpression(currentClass.Fields[0].Name)); for (int i = 1; i < currentClass.Fields.Count; i++) { IdentifierExpression identifier = new IdentifierExpression(currentClass.Fields[i].Name); expr = new BinaryOperatorExpression(expr, BinaryOperatorType.ExclusiveOr, CallGetHashCode(identifier)); } method.Body = new BlockStatement(); method.Body.AddChild(new ReturnStatement(expr)); nodes.Add(method); TypeReference boolReference = new TypeReference("System.Boolean"); TypeReference objectReference = new TypeReference("System.Object"); method = new MethodDeclaration("Equals", Modifiers.Public | Modifiers.Override, boolReference, null, null); method.Parameters.Add(new ParameterDeclarationExpression(objectReference, "obj")); method.Body = new BlockStatement(); TypeReference currentType = ConvertType(currentClass.DefaultReturnType); expr = new TypeOfIsExpression(new IdentifierExpression("obj"), currentType); expr = new ParenthesizedExpression(expr); expr = new UnaryOperatorExpression(expr, UnaryOperatorType.Not); method.Body.AddChild(new IfElseStatement(expr, new ReturnStatement(new PrimitiveExpression(false, "false")))); expr = new BinaryOperatorExpression(new ThisReferenceExpression(), BinaryOperatorType.Equality, new IdentifierExpression("obj")); method.Body.AddChild(new IfElseStatement(expr, new ReturnStatement(new PrimitiveExpression(true, "true")))); VariableDeclaration var = new VariableDeclaration("my" + currentClass.Name, new CastExpression(currentType, new IdentifierExpression("obj"), CastType.Cast), currentType); method.Body.AddChild(new LocalVariableDeclaration(var)); expr = TestEquality(var.Name, currentClass.Fields[0]); for (int i = 1; i < currentClass.Fields.Count; i++) { expr = new BinaryOperatorExpression(expr, BinaryOperatorType.LogicalAnd, TestEquality(var.Name, currentClass.Fields[i])); } method.Body.AddChild(new ReturnStatement(expr)); nodes.Add(method); }
public override object VisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) { return CreateResolveResult(resolver.ProjectContent.SystemTypes.Boolean); }
public object VisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) { return new B.BinaryExpression(GetLexicalInfo(typeOfIsExpression), B.BinaryOperatorType.TypeTest, ConvertExpression(typeOfIsExpression.Expression), new B.TypeofExpression(GetLexicalInfo(typeOfIsExpression), ConvertTypeReference(typeOfIsExpression.TypeReference))); }
public override object TrackedVisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) { Console.WriteLine("VisitTypeOfIsExpression"); return null; }
public virtual object TrackedVisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) { return base.VisitTypeOfIsExpression(typeOfIsExpression, data); }
void SimpleNonInvocationExpression( #line 1645 "VBNET.ATG" out Expression pexpr) { #line 1647 "VBNET.ATG" Expression expr; TypeReference type = null; string name = String.Empty; pexpr = null; if (StartOf(32)) { switch (la.kind) { case 3: { lexer.NextToken(); #line 1655 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 4: { lexer.NextToken(); #line 1656 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 7: { lexer.NextToken(); #line 1657 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 6: { lexer.NextToken(); #line 1658 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 5: { lexer.NextToken(); #line 1659 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 9: { lexer.NextToken(); #line 1660 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 8: { lexer.NextToken(); #line 1661 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 202: { lexer.NextToken(); #line 1663 "VBNET.ATG" pexpr = new PrimitiveExpression(true, "true"); break; } case 109: { lexer.NextToken(); #line 1664 "VBNET.ATG" pexpr = new PrimitiveExpression(false, "false"); break; } case 151: { lexer.NextToken(); #line 1665 "VBNET.ATG" pexpr = new PrimitiveExpression(null, "null"); break; } case 25: { lexer.NextToken(); Expr( #line 1666 "VBNET.ATG" out expr); Expect(26); #line 1666 "VBNET.ATG" pexpr = new ParenthesizedExpression(expr); break; } case 2: case 45: case 49: case 51: case 52: case 53: case 54: case 57: case 74: case 85: case 91: case 94: case 103: case 108: case 113: case 120: case 126: case 130: case 133: case 156: case 162: case 169: case 188: case 197: case 198: case 208: case 209: case 215: { Identifier(); #line 1668 "VBNET.ATG" pexpr = new IdentifierExpression(t.val); pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation; if ( #line 1671 "VBNET.ATG" la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) { lexer.NextToken(); Expect(155); TypeArgumentList( #line 1672 "VBNET.ATG" ((IdentifierExpression)pexpr).TypeArguments); Expect(26); } break; } case 55: case 58: case 69: case 86: case 87: case 96: case 128: case 137: case 154: case 181: case 186: case 187: case 193: case 206: case 207: case 210: { #line 1674 "VBNET.ATG" string val = String.Empty; if (StartOf(11)) { PrimitiveTypeName( #line 1675 "VBNET.ATG" out val); } else if (la.kind == 154) { lexer.NextToken(); #line 1675 "VBNET.ATG" val = "System.Object"; } else SynErr(257); #line 1676 "VBNET.ATG" pexpr = new TypeReferenceExpression(new TypeReference(val, true)); break; } case 139: { lexer.NextToken(); #line 1677 "VBNET.ATG" pexpr = new ThisReferenceExpression(); break; } case 144: case 145: { #line 1678 "VBNET.ATG" Expression retExpr = null; if (la.kind == 144) { lexer.NextToken(); #line 1679 "VBNET.ATG" retExpr = new BaseReferenceExpression(); } else if (la.kind == 145) { lexer.NextToken(); #line 1680 "VBNET.ATG" retExpr = new ClassReferenceExpression(); } else SynErr(258); Expect(16); IdentifierOrKeyword( #line 1682 "VBNET.ATG" out name); #line 1682 "VBNET.ATG" pexpr = new MemberReferenceExpression(retExpr, name); break; } case 117: { lexer.NextToken(); Expect(16); Identifier(); #line 1684 "VBNET.ATG" type = new TypeReference(t.val ?? ""); #line 1686 "VBNET.ATG" type.IsGlobal = true; #line 1687 "VBNET.ATG" pexpr = new TypeReferenceExpression(type); break; } case 148: { ObjectCreateExpression( #line 1688 "VBNET.ATG" out expr); #line 1688 "VBNET.ATG" pexpr = expr; break; } case 81: case 93: case 204: { #line 1690 "VBNET.ATG" CastType castType = CastType.Cast; if (la.kind == 93) { lexer.NextToken(); } else if (la.kind == 81) { lexer.NextToken(); #line 1692 "VBNET.ATG" castType = CastType.Conversion; } else if (la.kind == 204) { lexer.NextToken(); #line 1693 "VBNET.ATG" castType = CastType.TryCast; } else SynErr(259); Expect(25); Expr( #line 1695 "VBNET.ATG" out expr); Expect(12); TypeName( #line 1695 "VBNET.ATG" out type); Expect(26); #line 1696 "VBNET.ATG" pexpr = new CastExpression(type, expr, castType); break; } case 63: case 64: case 65: case 66: case 67: case 68: case 70: case 72: case 73: case 77: case 78: case 79: case 80: case 82: case 83: case 84: { CastTarget( #line 1697 "VBNET.ATG" out type); Expect(25); Expr( #line 1697 "VBNET.ATG" out expr); Expect(26); #line 1697 "VBNET.ATG" pexpr = new CastExpression(type, expr, CastType.PrimitiveConversion); break; } case 44: { lexer.NextToken(); Expr( #line 1698 "VBNET.ATG" out expr); #line 1698 "VBNET.ATG" pexpr = new AddressOfExpression(expr); break; } case 116: { lexer.NextToken(); Expect(25); GetTypeTypeName( #line 1699 "VBNET.ATG" out type); Expect(26); #line 1699 "VBNET.ATG" pexpr = new TypeOfExpression(type); break; } case 205: { lexer.NextToken(); SimpleExpr( #line 1700 "VBNET.ATG" out expr); Expect(131); TypeName( #line 1700 "VBNET.ATG" out type); #line 1700 "VBNET.ATG" pexpr = new TypeOfIsExpression(expr, type); break; } case 122: { ConditionalExpression( #line 1701 "VBNET.ATG" out pexpr); break; } } } else if (la.kind == 16) { lexer.NextToken(); IdentifierOrKeyword( #line 1705 "VBNET.ATG" out name); #line 1705 "VBNET.ATG" pexpr = new MemberReferenceExpression(null, name); } else SynErr(260); }
void RelationalExpr( #line 2251 "cs.ATG" ref Expression outExpr) { #line 2253 "cs.ATG" TypeReference type; Expression expr; BinaryOperatorType op = BinaryOperatorType.None; Location startLocation = la.Location; ShiftExpr( #line 2259 "cs.ATG" ref outExpr); while (StartOf(37)) { if (StartOf(38)) { if (la.kind == 23) { lexer.NextToken(); #line 2261 "cs.ATG" op = BinaryOperatorType.LessThan; } else if (la.kind == 22) { lexer.NextToken(); #line 2262 "cs.ATG" op = BinaryOperatorType.GreaterThan; } else if (la.kind == 36) { lexer.NextToken(); #line 2263 "cs.ATG" op = BinaryOperatorType.LessThanOrEqual; } else if (la.kind == 35) { lexer.NextToken(); #line 2264 "cs.ATG" op = BinaryOperatorType.GreaterThanOrEqual; } else SynErr(215); UnaryExpr( #line 2266 "cs.ATG" out expr); ShiftExpr( #line 2267 "cs.ATG" ref expr); #line 2268 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr) { StartLocation = startLocation, EndLocation = t.EndLocation }; } else { if (la.kind == 85) { lexer.NextToken(); TypeWithRestriction( #line 2271 "cs.ATG" out type, false, false); if ( #line 2272 "cs.ATG" la.kind == Tokens.Question && !IsPossibleExpressionStart(Peek(1).kind)) { NullableQuestionMark( #line 2273 "cs.ATG" ref type); } #line 2274 "cs.ATG" outExpr = new TypeOfIsExpression(outExpr, type) { StartLocation = startLocation, EndLocation = t.EndLocation }; } else if (la.kind == 50) { lexer.NextToken(); TypeWithRestriction( #line 2276 "cs.ATG" out type, false, false); if ( #line 2277 "cs.ATG" la.kind == Tokens.Question && !IsPossibleExpressionStart(Peek(1).kind)) { NullableQuestionMark( #line 2278 "cs.ATG" ref type); } #line 2279 "cs.ATG" outExpr = new CastExpression(type, outExpr, CastType.TryCast) { StartLocation = startLocation, EndLocation = t.EndLocation }; } else SynErr(216); } } }
void RelationalExpr( //#line 2213 "cs.ATG" ref Expression outExpr) { //#line 2215 "cs.ATG" TypeReference type; Expression expr; BinaryOperatorType op = BinaryOperatorType.None; ShiftExpr( //#line 2220 "cs.ATG" ref outExpr); while (StartOf(37)) { if (StartOf(38)) { if (la.kind == 23) { lexer.NextToken(); //#line 2222 "cs.ATG" op = BinaryOperatorType.LessThan; } else if (la.kind == 22) { lexer.NextToken(); //#line 2223 "cs.ATG" op = BinaryOperatorType.GreaterThan; } else if (la.kind == 36) { lexer.NextToken(); //#line 2224 "cs.ATG" op = BinaryOperatorType.LessThanOrEqual; } else if (la.kind == 35) { lexer.NextToken(); //#line 2225 "cs.ATG" op = BinaryOperatorType.GreaterThanOrEqual; } else SynErr(213); UnaryExpr( //#line 2227 "cs.ATG" out expr); ShiftExpr( //#line 2228 "cs.ATG" ref expr); //#line 2229 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } else { if (la.kind == 85) { lexer.NextToken(); TypeWithRestriction( //#line 2232 "cs.ATG" out type, false, false); if ( //#line 2233 "cs.ATG" la.kind == Tokens.Question && !IsPossibleExpressionStart(Peek(1).kind)) { NullableQuestionMark( //#line 2234 "cs.ATG" ref type); } //#line 2235 "cs.ATG" outExpr = new TypeOfIsExpression(outExpr, type); } else if (la.kind == 50) { lexer.NextToken(); TypeWithRestriction( //#line 2237 "cs.ATG" out type, false, false); if ( //#line 2238 "cs.ATG" la.kind == Tokens.Question && !IsPossibleExpressionStart(Peek(1).kind)) { NullableQuestionMark( //#line 2239 "cs.ATG" ref type); } //#line 2240 "cs.ATG" outExpr = new CastExpression(type, outExpr, CastType.TryCast); } else SynErr(214); } } }
public virtual bool VisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object d) { if ((typeOfIsExpression == null)) { return SetFailure(); } if ((d == null)) { return SetFailure(); } if ((typeOfIsExpression.Expression == null)) { return SetFailure(); } if ((typeOfIsExpression.TypeReference == null)) { return SetFailure(); } if(typeOfIsExpression.GetType() != d.GetType()) {return SetFailure();} var data = (TypeOfIsExpression)d; if (!IsMatch(typeOfIsExpression, data)) { return SetFailure(); } typeOfIsExpression.Expression.AcceptVisitor(this, data.Expression); return typeOfIsExpression.TypeReference.AcceptVisitor(this, data.TypeReference); }
List<MethodDeclaration> CreateEqualsOverrides(IClass currentClass) { List<MethodDeclaration> methods = new List<MethodDeclaration>(); TypeReference boolReference = new TypeReference("System.Boolean", true); TypeReference objectReference = new TypeReference("System.Object", true); MethodDeclaration method = new MethodDeclaration { Name = "Equals", Modifier = Modifiers.Public | Modifiers.Override, TypeReference = boolReference }; method.Parameters.Add(new ParameterDeclarationExpression(objectReference, "obj")); method.Body = new BlockStatement(); TypeReference currentType = ConvertType(currentClass.DefaultReturnType); Expression expr = null; if (currentClass.ClassType == Dom.ClassType.Struct) { // return obj is CurrentType && Equals((CurrentType)obj); expr = new TypeOfIsExpression(new IdentifierExpression("obj"), currentType); expr = new ParenthesizedExpression(expr); expr = new BinaryOperatorExpression( expr, BinaryOperatorType.LogicalAnd, new InvocationExpression( new IdentifierExpression("Equals"), new List<Expression> { new CastExpression(currentType, new IdentifierExpression("obj"), CastType.Cast) })); method.Body.AddChild(new ReturnStatement(expr)); methods.Add(method); // IEquatable implementation: method = new MethodDeclaration { Name = "Equals", Modifier = Modifiers.Public, TypeReference = boolReference }; method.Parameters.Add(new ParameterDeclarationExpression(currentType, "other")); method.Body = new BlockStatement(); } else { method.Body.AddChild(new LocalVariableDeclaration(new VariableDeclaration( "other", new CastExpression(currentType, new IdentifierExpression("obj"), CastType.TryCast), currentType))); method.Body.AddChild(new IfElseStatement( new BinaryOperatorExpression(new IdentifierExpression("other"), BinaryOperatorType.ReferenceEquality, new PrimitiveExpression(null, "null")), new ReturnStatement(new PrimitiveExpression(false, "false")))); // expr = new BinaryOperatorExpression(new ThisReferenceExpression(), // BinaryOperatorType.ReferenceEquality, // new IdentifierExpression("obj")); // method.Body.AddChild(new IfElseStatement(expr, new ReturnStatement(new PrimitiveExpression(true, "true")))); } expr = null; foreach (IField field in currentClass.Fields) { if (field.IsStatic) continue; if (expr == null) { expr = TestEquality("other", field); } else { expr = new BinaryOperatorExpression(expr, BinaryOperatorType.LogicalAnd, TestEquality("other", field)); } } foreach (IProperty property in currentClass.Properties) { if (property.IsStatic || !property.IsAutoImplemented()) continue; if (expr == null) { expr = TestEquality("other", property); } else { expr = new BinaryOperatorExpression(expr, BinaryOperatorType.LogicalAnd, TestEquality("other", property)); } } method.Body.AddChild(new ReturnStatement(expr ?? new PrimitiveExpression(true, "true"))); methods.Add(method); return methods; }
void RelationalExpr( #line 2177 "cs.ATG" ref Expression outExpr) { #line 2179 "cs.ATG" TypeReference type; Expression expr; BinaryOperatorType op = BinaryOperatorType.None; ShiftExpr( #line 2184 "cs.ATG" ref outExpr); while (StartOf(37)) { if (StartOf(38)) { if (la.kind == 23) { lexer.NextToken(); #line 2186 "cs.ATG" op = BinaryOperatorType.LessThan; } else if (la.kind == 22) { lexer.NextToken(); #line 2187 "cs.ATG" op = BinaryOperatorType.GreaterThan; } else if (la.kind == 36) { lexer.NextToken(); #line 2188 "cs.ATG" op = BinaryOperatorType.LessThanOrEqual; } else if (la.kind == 35) { lexer.NextToken(); #line 2189 "cs.ATG" op = BinaryOperatorType.GreaterThanOrEqual; } else SynErr(216); UnaryExpr( #line 2191 "cs.ATG" out expr); ShiftExpr( #line 2192 "cs.ATG" ref expr); #line 2193 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } else { if (la.kind == 85) { lexer.NextToken(); TypeWithRestriction( #line 2196 "cs.ATG" out type, false, false); if ( #line 2197 "cs.ATG" la.kind == Tokens.Question && !IsPossibleExpressionStart(Peek(1).kind)) { NullableQuestionMark( #line 2198 "cs.ATG" ref type); } #line 2199 "cs.ATG" outExpr = new TypeOfIsExpression(outExpr, type); } else if (la.kind == 50) { lexer.NextToken(); TypeWithRestriction( #line 2201 "cs.ATG" out type, false, false); if ( #line 2202 "cs.ATG" la.kind == Tokens.Question && !IsPossibleExpressionStart(Peek(1).kind)) { NullableQuestionMark( #line 2203 "cs.ATG" ref type); } #line 2204 "cs.ATG" outExpr = new CastExpression(type, outExpr, CastType.TryCast); } else SynErr(217); } } }
private bool IsMatch(TypeOfIsExpression left, TypeOfIsExpression data) { return false; }
public override object VisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) { typeOfIsExpression.Expression.Parent = typeOfIsExpression; typeOfIsExpression.TypeReference.Parent = typeOfIsExpression; return base.VisitTypeOfIsExpression(typeOfIsExpression, data); }
public override void GenerateCode(List<AbstractNode> nodes, IList items) { TypeReference intReference = new TypeReference("System.Int32", true); MethodDeclaration method = new MethodDeclaration { Name = "GetHashCode", Modifier = Modifiers.Public | Modifiers.Override, TypeReference = intReference, Body = new BlockStatement() }; VariableDeclaration var; var = new VariableDeclaration("hashCode", new PrimitiveExpression(0, "0"), intReference); method.Body.AddChild(new LocalVariableDeclaration(var)); bool usePrimeMultiplication = currentClass.ProjectContent.Language == LanguageProperties.CSharp; BlockStatement hashCalculationBlock; if (usePrimeMultiplication) { hashCalculationBlock = new BlockStatement(); method.Body.AddChild(new UncheckedStatement(hashCalculationBlock)); } else { hashCalculationBlock = method.Body; } int fieldIndex = 0; Expression expr; foreach (IField field in currentClass.Fields) { if (field.IsStatic) continue; expr = new InvocationExpression(new MemberReferenceExpression(new IdentifierExpression(field.Name), "GetHashCode")); if (usePrimeMultiplication) { int prime = largePrimes[fieldIndex++ % largePrimes.Length]; expr = new AssignmentExpression( new IdentifierExpression(var.Name), AssignmentOperatorType.Add, new BinaryOperatorExpression(new PrimitiveExpression(prime, prime.ToString()), BinaryOperatorType.Multiply, expr)); } else { expr = new AssignmentExpression(new IdentifierExpression(var.Name), AssignmentOperatorType.ExclusiveOr, expr); } if (IsValueType(field.ReturnType)) { hashCalculationBlock.AddChild(new ExpressionStatement(expr)); } else { hashCalculationBlock.AddChild(new IfElseStatement( new BinaryOperatorExpression(new IdentifierExpression(field.Name), BinaryOperatorType.ReferenceInequality, new PrimitiveExpression(null, "null")), new ExpressionStatement(expr) )); } } method.Body.AddChild(new ReturnStatement(new IdentifierExpression(var.Name))); nodes.Add(method); TypeReference boolReference = new TypeReference("System.Boolean", true); TypeReference objectReference = new TypeReference("System.Object", true); method = new MethodDeclaration { Name = "Equals", Modifier = Modifiers.Public | Modifiers.Override, TypeReference = boolReference }; method.Parameters.Add(new ParameterDeclarationExpression(objectReference, "obj")); method.Body = new BlockStatement(); TypeReference currentType = ConvertType(currentClass.DefaultReturnType); if (currentClass.ClassType == Dom.ClassType.Struct) { // return obj is CurrentType && Equals((CurrentType)obj); expr = new TypeOfIsExpression(new IdentifierExpression("obj"), currentType); expr = new ParenthesizedExpression(expr); expr = new BinaryOperatorExpression( expr, BinaryOperatorType.LogicalAnd, new InvocationExpression( new IdentifierExpression("Equals"), new List<Expression> { new CastExpression(currentType, new IdentifierExpression("obj"), CastType.Cast) })); method.Body.AddChild(new ReturnStatement(expr)); nodes.Add(method); // IEquatable implementation: method = new MethodDeclaration { Name = "Equals", Modifier = Modifiers.Public | Modifiers.Override, TypeReference = boolReference }; method.Parameters.Add(new ParameterDeclarationExpression(currentType, "other")); method.Body = new BlockStatement(); } else { method.Body.AddChild(new LocalVariableDeclaration(new VariableDeclaration( "other", new CastExpression(currentType, new IdentifierExpression("obj"), CastType.TryCast), currentType))); method.Body.AddChild(new IfElseStatement( new BinaryOperatorExpression(new IdentifierExpression("other"), BinaryOperatorType.ReferenceEquality, new PrimitiveExpression(null, "null")), new ReturnStatement(new PrimitiveExpression(false, "false")))); // expr = new BinaryOperatorExpression(new ThisReferenceExpression(), // BinaryOperatorType.ReferenceEquality, // new IdentifierExpression("obj")); // method.Body.AddChild(new IfElseStatement(expr, new ReturnStatement(new PrimitiveExpression(true, "true")))); } expr = null; foreach (IField field in currentClass.Fields) { if (field.IsStatic) continue; if (expr == null) { expr = TestEquality("other", field); } else { expr = new BinaryOperatorExpression(expr, BinaryOperatorType.LogicalAnd, TestEquality("other", field)); } } method.Body.AddChild(new ReturnStatement(expr ?? new PrimitiveExpression(true, "true"))); nodes.Add(method); }
public override object VisitTypeOfIsExpression (TypeOfIsExpression node, object data) { Write (RUNTIME_HELPER_NAME, ".", IS_NAME, "("); node.Expression.AcceptVisitor (this, null); WriteComma (); node.TypeReference.AcceptVisitor (this, null); Write (")"); return null; }
void SimpleNonInvocationExpression( #line 1730 "VBNET.ATG" out Expression pexpr) { #line 1732 "VBNET.ATG" Expression expr; CollectionInitializerExpression cie; TypeReference type = null; string name = String.Empty; Location startLocation = la.Location; pexpr = null; if (StartOf(35)) { switch (la.kind) { case 3: { lexer.NextToken(); #line 1742 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 4: { lexer.NextToken(); #line 1743 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 7: { lexer.NextToken(); #line 1744 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 6: { lexer.NextToken(); #line 1745 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 5: { lexer.NextToken(); #line 1746 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 9: { lexer.NextToken(); #line 1747 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 8: { lexer.NextToken(); #line 1748 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 220: { lexer.NextToken(); #line 1750 "VBNET.ATG" pexpr = new PrimitiveExpression(true, "true"); break; } case 124: { lexer.NextToken(); #line 1751 "VBNET.ATG" pexpr = new PrimitiveExpression(false, "false"); break; } case 168: { lexer.NextToken(); #line 1752 "VBNET.ATG" pexpr = new PrimitiveExpression(null, "null"); break; } case 37: { lexer.NextToken(); Expr( #line 1753 "VBNET.ATG" out expr); Expect(38); #line 1753 "VBNET.ATG" pexpr = new ParenthesizedExpression(expr); break; } case 2: case 58: case 62: case 64: case 65: case 66: case 67: case 68: case 69: case 72: case 89: case 100: case 106: case 109: case 118: case 123: case 128: case 135: case 141: case 145: case 148: case 149: case 150: case 173: case 179: case 181: case 187: case 206: case 215: case 216: case 226: case 227: case 233: case 240: { Identifier(); #line 1755 "VBNET.ATG" pexpr = new IdentifierExpression(t.val); pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation; if ( #line 1758 "VBNET.ATG" la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) { lexer.NextToken(); Expect(172); TypeArgumentList( #line 1759 "VBNET.ATG" ((IdentifierExpression)pexpr).TypeArguments); Expect(38); } break; } case 70: case 73: case 84: case 101: case 102: case 111: case 143: case 154: case 171: case 199: case 204: case 205: case 211: case 224: case 225: case 228: { #line 1761 "VBNET.ATG" string val = String.Empty; if (StartOf(12)) { PrimitiveTypeName( #line 1762 "VBNET.ATG" out val); } else if (la.kind == 171) { lexer.NextToken(); #line 1762 "VBNET.ATG" val = "System.Object"; } else SynErr(284); #line 1763 "VBNET.ATG" pexpr = new TypeReferenceExpression(new TypeReference(val, true)); break; } case 156: { lexer.NextToken(); #line 1764 "VBNET.ATG" pexpr = new ThisReferenceExpression(); break; } case 161: case 162: { #line 1765 "VBNET.ATG" Expression retExpr = null; if (la.kind == 161) { lexer.NextToken(); #line 1766 "VBNET.ATG" retExpr = new BaseReferenceExpression() { StartLocation = t.Location, EndLocation = t.EndLocation }; } else if (la.kind == 162) { lexer.NextToken(); #line 1767 "VBNET.ATG" retExpr = new ClassReferenceExpression() { StartLocation = t.Location, EndLocation = t.EndLocation }; } else SynErr(285); Expect(26); IdentifierOrKeyword( #line 1769 "VBNET.ATG" out name); #line 1769 "VBNET.ATG" pexpr = new MemberReferenceExpression(retExpr, name) { StartLocation = startLocation, EndLocation = t.EndLocation }; break; } case 132: { lexer.NextToken(); Expect(26); Identifier(); #line 1771 "VBNET.ATG" type = new TypeReference(t.val ?? ""); #line 1773 "VBNET.ATG" type.IsGlobal = true; #line 1774 "VBNET.ATG" pexpr = new TypeReferenceExpression(type); break; } case 165: { ObjectCreateExpression( #line 1775 "VBNET.ATG" out expr); #line 1775 "VBNET.ATG" pexpr = expr; break; } case 35: { CollectionInitializer( #line 1776 "VBNET.ATG" out cie); #line 1776 "VBNET.ATG" pexpr = cie; break; } case 96: case 108: case 222: { #line 1778 "VBNET.ATG" CastType castType = CastType.Cast; if (la.kind == 108) { lexer.NextToken(); } else if (la.kind == 96) { lexer.NextToken(); #line 1780 "VBNET.ATG" castType = CastType.Conversion; } else if (la.kind == 222) { lexer.NextToken(); #line 1781 "VBNET.ATG" castType = CastType.TryCast; } else SynErr(286); Expect(37); Expr( #line 1783 "VBNET.ATG" out expr); Expect(22); TypeName( #line 1783 "VBNET.ATG" out type); Expect(38); #line 1784 "VBNET.ATG" pexpr = new CastExpression(type, expr, castType); break; } case 78: case 79: case 80: case 81: case 82: case 83: case 85: case 87: case 88: case 92: case 93: case 94: case 95: case 97: case 98: case 99: { CastTarget( #line 1785 "VBNET.ATG" out type); Expect(37); Expr( #line 1785 "VBNET.ATG" out expr); Expect(38); #line 1785 "VBNET.ATG" pexpr = new CastExpression(type, expr, CastType.PrimitiveConversion); break; } case 57: { lexer.NextToken(); Expr( #line 1786 "VBNET.ATG" out expr); #line 1786 "VBNET.ATG" pexpr = new AddressOfExpression(expr); break; } case 131: { lexer.NextToken(); Expect(37); GetTypeTypeName( #line 1787 "VBNET.ATG" out type); Expect(38); #line 1787 "VBNET.ATG" pexpr = new TypeOfExpression(type); break; } case 223: { lexer.NextToken(); SimpleExpr( #line 1788 "VBNET.ATG" out expr); Expect(146); TypeName( #line 1788 "VBNET.ATG" out type); #line 1788 "VBNET.ATG" pexpr = new TypeOfIsExpression(expr, type); break; } case 137: { ConditionalExpression( #line 1789 "VBNET.ATG" out pexpr); break; } case 10: case 16: case 17: case 18: case 19: { XmlLiteralExpression( #line 1790 "VBNET.ATG" out pexpr); break; } } } else if (StartOf(36)) { if (la.kind == 26) { lexer.NextToken(); if (la.kind == 10) { lexer.NextToken(); IdentifierOrKeyword( #line 1796 "VBNET.ATG" out name); Expect(11); #line 1797 "VBNET.ATG" pexpr = new XmlMemberAccessExpression(null, XmlAxisType.Element, name, true) { StartLocation = startLocation, EndLocation = t.EndLocation }; } else if (StartOf(34)) { IdentifierOrKeyword( #line 1798 "VBNET.ATG" out name); #line 1799 "VBNET.ATG" pexpr = new MemberReferenceExpression(null, name) { StartLocation = startLocation, EndLocation = t.EndLocation }; } else SynErr(287); } else if (la.kind == 29) { lexer.NextToken(); IdentifierOrKeyword( #line 1801 "VBNET.ATG" out name); #line 1801 "VBNET.ATG" pexpr = new BinaryOperatorExpression(null, BinaryOperatorType.DictionaryAccess, new PrimitiveExpression(name, name) { StartLocation = t.Location, EndLocation = t.EndLocation }); } else { #line 1802 "VBNET.ATG" XmlAxisType axisType = XmlAxisType.Element; bool isXmlIdentifier = false; if (la.kind == 27) { lexer.NextToken(); #line 1803 "VBNET.ATG" axisType = XmlAxisType.Descendents; } else if (la.kind == 28) { lexer.NextToken(); #line 1803 "VBNET.ATG" axisType = XmlAxisType.Attribute; } else SynErr(288); if (la.kind == 10) { lexer.NextToken(); #line 1804 "VBNET.ATG" isXmlIdentifier = true; } IdentifierOrKeyword( #line 1804 "VBNET.ATG" out name); if (la.kind == 11) { lexer.NextToken(); } #line 1805 "VBNET.ATG" pexpr = new XmlMemberAccessExpression(null, axisType, name, isXmlIdentifier); } } else SynErr(289); #line 1810 "VBNET.ATG" if (pexpr != null) { pexpr.StartLocation = startLocation; pexpr.EndLocation = t.EndLocation; } }
public override object VisitTypeOfIsExpression (TypeOfIsExpression typeOfIsExpression, object data) { return CreateResult (typeof(System.Boolean).FullName); }
public object VisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) { throw new NotImplementedException (); }
void SimpleNonInvocationExpression( #line 1593 "VBNET.ATG" out Expression pexpr) { #line 1595 "VBNET.ATG" Expression expr; TypeReference type = null; string name = String.Empty; pexpr = null; if (StartOf(29)) { switch (la.kind) { case 3: { lexer.NextToken(); #line 1603 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val); break; } case 4: { lexer.NextToken(); #line 1604 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val); break; } case 7: { lexer.NextToken(); #line 1605 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val); break; } case 6: { lexer.NextToken(); #line 1606 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val); break; } case 5: { lexer.NextToken(); #line 1607 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val); break; } case 9: { lexer.NextToken(); #line 1608 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val); break; } case 8: { lexer.NextToken(); #line 1609 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val); break; } case 173: { lexer.NextToken(); #line 1611 "VBNET.ATG" pexpr = new PrimitiveExpression(true, "true"); break; } case 96: { lexer.NextToken(); #line 1612 "VBNET.ATG" pexpr = new PrimitiveExpression(false, "false"); break; } case 130: { lexer.NextToken(); #line 1613 "VBNET.ATG" pexpr = new PrimitiveExpression(null, "null"); break; } case 24: { lexer.NextToken(); Expr( #line 1614 "VBNET.ATG" out expr); Expect(25); #line 1614 "VBNET.ATG" pexpr = new ParenthesizedExpression(expr); break; } case 2: case 47: case 49: case 50: case 51: case 70: case 95: case 134: case 144: case 169: case 176: case 177: case 205: { Identifier(); #line 1616 "VBNET.ATG" pexpr = new IdentifierExpression(t.val); #line 1617 "VBNET.ATG" pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation; break; } case 52: case 54: case 65: case 76: case 77: case 84: case 111: case 117: case 133: case 159: case 160: case 165: case 191: case 192: case 193: case 194: { #line 1618 "VBNET.ATG" string val = String.Empty; if (StartOf(10)) { PrimitiveTypeName( #line 1619 "VBNET.ATG" out val); } else if (la.kind == 133) { lexer.NextToken(); #line 1619 "VBNET.ATG" val = "Object"; } else SynErr(240); Expect(10); #line 1620 "VBNET.ATG" t.val = ""; Identifier(); #line 1620 "VBNET.ATG" pexpr = new MemberReferenceExpression(new TypeReferenceExpression(val), t.val); break; } case 119: { lexer.NextToken(); #line 1621 "VBNET.ATG" pexpr = new ThisReferenceExpression(); break; } case 124: case 125: { #line 1622 "VBNET.ATG" Expression retExpr = null; if (la.kind == 124) { lexer.NextToken(); #line 1623 "VBNET.ATG" retExpr = new BaseReferenceExpression(); } else if (la.kind == 125) { lexer.NextToken(); #line 1624 "VBNET.ATG" retExpr = new ClassReferenceExpression(); } else SynErr(241); Expect(10); IdentifierOrKeyword( #line 1626 "VBNET.ATG" out name); #line 1626 "VBNET.ATG" pexpr = new MemberReferenceExpression(retExpr, name); break; } case 199: { lexer.NextToken(); Expect(10); Identifier(); #line 1628 "VBNET.ATG" type = new TypeReference(t.val ?? ""); #line 1630 "VBNET.ATG" type.IsGlobal = true; #line 1631 "VBNET.ATG" pexpr = new TypeReferenceExpression(type); break; } case 127: { ObjectCreateExpression( #line 1632 "VBNET.ATG" out expr); #line 1632 "VBNET.ATG" pexpr = expr; break; } case 75: case 82: case 200: { #line 1634 "VBNET.ATG" CastType castType = CastType.Cast; if (la.kind == 82) { lexer.NextToken(); } else if (la.kind == 75) { lexer.NextToken(); #line 1636 "VBNET.ATG" castType = CastType.Conversion; } else if (la.kind == 200) { lexer.NextToken(); #line 1637 "VBNET.ATG" castType = CastType.TryCast; } else SynErr(242); Expect(24); Expr( #line 1639 "VBNET.ATG" out expr); Expect(12); TypeName( #line 1639 "VBNET.ATG" out type); Expect(25); #line 1640 "VBNET.ATG" pexpr = new CastExpression(type, expr, castType); break; } case 59: case 60: case 61: case 62: case 63: case 64: case 66: case 68: case 69: case 72: case 73: case 74: case 195: case 196: case 197: case 198: { CastTarget( #line 1641 "VBNET.ATG" out type); Expect(24); Expr( #line 1641 "VBNET.ATG" out expr); Expect(25); #line 1641 "VBNET.ATG" pexpr = new CastExpression(type, expr, CastType.PrimitiveConversion); break; } case 43: { lexer.NextToken(); Expr( #line 1642 "VBNET.ATG" out expr); #line 1642 "VBNET.ATG" pexpr = new AddressOfExpression(expr); break; } case 102: { lexer.NextToken(); Expect(24); GetTypeTypeName( #line 1643 "VBNET.ATG" out type); Expect(25); #line 1643 "VBNET.ATG" pexpr = new TypeOfExpression(type); break; } case 175: { lexer.NextToken(); SimpleExpr( #line 1644 "VBNET.ATG" out expr); Expect(113); TypeName( #line 1644 "VBNET.ATG" out type); #line 1644 "VBNET.ATG" pexpr = new TypeOfIsExpression(expr, type); break; } } } else if (la.kind == 10) { lexer.NextToken(); IdentifierOrKeyword( #line 1648 "VBNET.ATG" out name); #line 1648 "VBNET.ATG" pexpr = new MemberReferenceExpression(null, name); } else SynErr(243); }
public virtual object VisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) { Debug.Assert((typeOfIsExpression != null)); Debug.Assert((typeOfIsExpression.Expression != null)); Debug.Assert((typeOfIsExpression.TypeReference != null)); typeOfIsExpression.Expression.AcceptVisitor(this, data); return typeOfIsExpression.TypeReference.AcceptVisitor(this, data); }
public override object VisitTypeOfIsExpression (TypeOfIsExpression stmt, object data) { Console.WriteLine ("TypeOfIsExpression"); IntegrateTemporaryVariableVisitorOptions options = (IntegrateTemporaryVariableVisitorOptions)data; if (IsExpressionToReplace (stmt.Expression, options)) { if (IsUnary (options.Initializer) || (options.Initializer is BinaryOperatorExpression && IsShiftOrHigher (((BinaryOperatorExpression)options.Initializer).Op))) options.Changes.Add (ReplaceExpression (stmt.Expression, options.Initializer, options)); else options.Changes.Add (ReplaceExpression (stmt.Expression, new ParenthesizedExpression (options.Initializer), options)); return null; } else { return base.VisitTypeOfIsExpression (stmt, data); } }
public override object VisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) { UnlockWith(typeOfIsExpression); return base.VisitTypeOfIsExpression(typeOfIsExpression, data); }
public virtual object VisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) { throw new global::System.NotImplementedException("TypeOfIsExpression"); }
public virtual object VisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) { Debug.Assert((typeOfIsExpression != null)); Debug.Assert((typeOfIsExpression.Expression != null)); Debug.Assert((typeOfIsExpression.TypeReference != null)); nodeStack.Push(typeOfIsExpression.Expression); typeOfIsExpression.Expression.AcceptVisitor(this, data); typeOfIsExpression.Expression = ((Expression)(nodeStack.Pop())); nodeStack.Push(typeOfIsExpression.TypeReference); typeOfIsExpression.TypeReference.AcceptVisitor(this, data); typeOfIsExpression.TypeReference = ((TypeReference)(nodeStack.Pop())); return null; }
public sealed override object VisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) { this.BeginVisit(typeOfIsExpression); object result = this.TrackedVisitTypeOfIsExpression(typeOfIsExpression, data); this.EndVisit(typeOfIsExpression); return result; }
public virtual object VisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) { throw CreateException(typeOfIsExpression); }
void SimpleNonInvocationExpression( //#line 1723 "VBNET.ATG" out Expression pexpr) { //#line 1725 "VBNET.ATG" 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: { lexer.NextToken(); //#line 1735 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 4: { lexer.NextToken(); //#line 1736 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 7: { lexer.NextToken(); //#line 1737 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 6: { lexer.NextToken(); //#line 1738 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 5: { lexer.NextToken(); //#line 1739 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 9: { lexer.NextToken(); //#line 1740 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 8: { lexer.NextToken(); //#line 1741 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 217: { lexer.NextToken(); //#line 1743 "VBNET.ATG" pexpr = new PrimitiveExpression(true, "true"); break; } case 122: { lexer.NextToken(); //#line 1744 "VBNET.ATG" pexpr = new PrimitiveExpression(false, "false"); break; } case 165: { lexer.NextToken(); //#line 1745 "VBNET.ATG" pexpr = new PrimitiveExpression(null, "null"); break; } case 37: { lexer.NextToken(); Expr( //#line 1746 "VBNET.ATG" out expr); Expect(38); //#line 1746 "VBNET.ATG" 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(); //#line 1748 "VBNET.ATG" pexpr = new IdentifierExpression(t.val); pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation; if ( //#line 1751 "VBNET.ATG" la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) { lexer.NextToken(); Expect(169); TypeArgumentList( //#line 1752 "VBNET.ATG" ((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: { //#line 1754 "VBNET.ATG" string val = String.Empty; if (StartOf(12)) { PrimitiveTypeName( //#line 1755 "VBNET.ATG" out val); } else if (la.kind == 168) { lexer.NextToken(); //#line 1755 "VBNET.ATG" val = "System.Object"; } else SynErr(280); //#line 1756 "VBNET.ATG" pexpr = new TypeReferenceExpression(new TypeReference(val, true)); break; } case 153: { lexer.NextToken(); //#line 1757 "VBNET.ATG" pexpr = new ThisReferenceExpression(); break; } case 158: case 159: { //#line 1758 "VBNET.ATG" Expression retExpr = null; if (la.kind == 158) { lexer.NextToken(); //#line 1759 "VBNET.ATG" retExpr = new BaseReferenceExpression() { StartLocation = t.Location, EndLocation = t.EndLocation }; } else if (la.kind == 159) { lexer.NextToken(); //#line 1760 "VBNET.ATG" retExpr = new ClassReferenceExpression() { StartLocation = t.Location, EndLocation = t.EndLocation }; } else SynErr(281); Expect(26); IdentifierOrKeyword( //#line 1762 "VBNET.ATG" out name); //#line 1762 "VBNET.ATG" pexpr = new MemberReferenceExpression(retExpr, name) { StartLocation = startLocation, EndLocation = t.EndLocation }; break; } case 130: { lexer.NextToken(); Expect(26); Identifier(); //#line 1764 "VBNET.ATG" type = new TypeReference(t.val ?? ""); //#line 1766 "VBNET.ATG" type.IsGlobal = true; //#line 1767 "VBNET.ATG" pexpr = new TypeReferenceExpression(type); break; } case 162: { ObjectCreateExpression( //#line 1768 "VBNET.ATG" out expr); //#line 1768 "VBNET.ATG" pexpr = expr; break; } case 35: { CollectionInitializer( //#line 1769 "VBNET.ATG" out cie); //#line 1769 "VBNET.ATG" pexpr = cie; break; } case 94: case 106: case 219: { //#line 1771 "VBNET.ATG" CastType castType = CastType.Cast; if (la.kind == 106) { lexer.NextToken(); } else if (la.kind == 94) { lexer.NextToken(); //#line 1773 "VBNET.ATG" castType = CastType.Conversion; } else if (la.kind == 219) { lexer.NextToken(); //#line 1774 "VBNET.ATG" castType = CastType.TryCast; } else SynErr(282); Expect(37); Expr( //#line 1776 "VBNET.ATG" out expr); Expect(22); TypeName( //#line 1776 "VBNET.ATG" out type); Expect(38); //#line 1777 "VBNET.ATG" 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( //#line 1778 "VBNET.ATG" out type); Expect(37); Expr( //#line 1778 "VBNET.ATG" out expr); Expect(38); //#line 1778 "VBNET.ATG" pexpr = new CastExpression(type, expr, CastType.PrimitiveConversion); break; } case 57: { lexer.NextToken(); Expr( //#line 1779 "VBNET.ATG" out expr); //#line 1779 "VBNET.ATG" pexpr = new AddressOfExpression(expr); break; } case 129: { lexer.NextToken(); Expect(37); GetTypeTypeName( //#line 1780 "VBNET.ATG" out type); Expect(38); //#line 1780 "VBNET.ATG" pexpr = new TypeOfExpression(type); break; } case 220: { lexer.NextToken(); SimpleExpr( //#line 1781 "VBNET.ATG" out expr); Expect(144); TypeName( //#line 1781 "VBNET.ATG" out type); //#line 1781 "VBNET.ATG" pexpr = new TypeOfIsExpression(expr, type); break; } case 135: { ConditionalExpression( //#line 1782 "VBNET.ATG" out pexpr); break; } case 10: case 16: case 17: case 18: case 19: { XmlLiteralExpression( //#line 1783 "VBNET.ATG" out pexpr); break; } } } else if (StartOf(35)) { if (la.kind == 26) { lexer.NextToken(); if (la.kind == 10) { lexer.NextToken(); IdentifierOrKeyword( //#line 1789 "VBNET.ATG" out name); Expect(11); //#line 1790 "VBNET.ATG" pexpr = new XmlMemberAccessExpression(null, XmlAxisType.Element, name, true) { StartLocation = startLocation, EndLocation = t.EndLocation }; } else if (StartOf(33)) { IdentifierOrKeyword( //#line 1791 "VBNET.ATG" out name); //#line 1792 "VBNET.ATG" pexpr = new MemberReferenceExpression(null, name) { StartLocation = startLocation, EndLocation = t.EndLocation }; } else SynErr(283); } else if (la.kind == 29) { lexer.NextToken(); IdentifierOrKeyword( //#line 1794 "VBNET.ATG" out name); //#line 1794 "VBNET.ATG" pexpr = new BinaryOperatorExpression(null, BinaryOperatorType.DictionaryAccess, new PrimitiveExpression(name, name) { StartLocation = t.Location, EndLocation = t.EndLocation }); } else { //#line 1795 "VBNET.ATG" XmlAxisType axisType = XmlAxisType.Element; bool isXmlIdentifier = false; if (la.kind == 27) { lexer.NextToken(); //#line 1796 "VBNET.ATG" axisType = XmlAxisType.Descendents; } else if (la.kind == 28) { lexer.NextToken(); //#line 1796 "VBNET.ATG" axisType = XmlAxisType.Attribute; } else SynErr(284); if (la.kind == 10) { lexer.NextToken(); //#line 1797 "VBNET.ATG" isXmlIdentifier = true; } IdentifierOrKeyword( //#line 1797 "VBNET.ATG" out name); if (la.kind == 11) { lexer.NextToken(); } //#line 1798 "VBNET.ATG" pexpr = new XmlMemberAccessExpression(null, axisType, name, isXmlIdentifier); } } else SynErr(285); //#line 1803 "VBNET.ATG" if (pexpr != null) { pexpr.StartLocation = startLocation; pexpr.EndLocation = t.EndLocation; } }
void RelationalExpr( #line 2237 "Frames/cs.ATG" ref Expression outExpr) { #line 2239 "Frames/cs.ATG" TypeReference type; Expression expr; BinaryOperatorType op = BinaryOperatorType.None; ShiftExpr( #line 2244 "Frames/cs.ATG" ref outExpr); while (StartOf(37)) { if (StartOf(38)) { if (la.kind == 23) { lexer.NextToken(); #line 2246 "Frames/cs.ATG" op = BinaryOperatorType.LessThan; } else if (la.kind == 22) { lexer.NextToken(); #line 2247 "Frames/cs.ATG" op = BinaryOperatorType.GreaterThan; } else if (la.kind == 36) { lexer.NextToken(); #line 2248 "Frames/cs.ATG" op = BinaryOperatorType.LessThanOrEqual; } else if (la.kind == 35) { lexer.NextToken(); #line 2249 "Frames/cs.ATG" op = BinaryOperatorType.GreaterThanOrEqual; } else SynErr(215); UnaryExpr( #line 2251 "Frames/cs.ATG" out expr); ShiftExpr( #line 2252 "Frames/cs.ATG" ref expr); #line 2253 "Frames/cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } else { if (la.kind == 85) { lexer.NextToken(); TypeWithRestriction( #line 2256 "Frames/cs.ATG" out type, false, false); if ( #line 2257 "Frames/cs.ATG" la.kind == Tokens.Question && !IsPossibleExpressionStart(Peek(1).kind)) { NullableQuestionMark( #line 2258 "Frames/cs.ATG" ref type); } #line 2259 "Frames/cs.ATG" outExpr = new TypeOfIsExpression(outExpr, type); } else if (la.kind == 50) { lexer.NextToken(); TypeWithRestriction( #line 2261 "Frames/cs.ATG" out type, false, false); if ( #line 2262 "Frames/cs.ATG" la.kind == Tokens.Question && !IsPossibleExpressionStart(Peek(1).kind)) { NullableQuestionMark( #line 2263 "Frames/cs.ATG" ref type); } #line 2264 "Frames/cs.ATG" outExpr = new CastExpression(type, outExpr, CastType.TryCast); } else SynErr(216); } } }