public override object TrackedVisitIdentifierExpression(IdentifierExpression identifierExpression, object data) { if (identifierExpression.Parent is InvocationExpression) return null; IList staticTypes = new ArrayList(); staticTypes.Add("java.lang.String"); staticTypes.Add("java.lang.Object"); string type = GetStaticFullName(identifierExpression.Identifier, identifierExpression); if (type != null) { if (!staticTypes.Contains(type) && CodeBase.Mappings.Contains(type)) { string mappedType = CodeBase.Mappings[type].Target; TypeReferenceExpression rpe = new TypeReferenceExpression(mappedType); rpe.Parent = identifierExpression.Parent; ReplaceCurrentNode(rpe); } else if (CodeBase.Types.Contains(type)) { if (!UsedTypes.Contains(type)) UsedTypes.Add(type); } } return null; }
public override object TrackedVisitFieldReferenceExpression(FieldReferenceExpression fieldReferenceExpression, object data) { string targetString; if (projectTypes) { targetString = GetTargetString(fieldReferenceExpression); if (CodeBase.Mappings.Contains(targetString)) { TypeReferenceExpression typeExpression = new TypeReferenceExpression(targetString); typeExpression.Parent = fieldReferenceExpression.Parent; ReplaceCurrentNode(typeExpression); return null; } } else if (!IsMethodInvocation(fieldReferenceExpression) && ReachToInvocation(fieldReferenceExpression)) { targetString = GetTargetString(fieldReferenceExpression); if (targetString.StartsWith("id")) return null; string suffix = "__"; if (targetString.IndexOf(suffix) != -1) { if (targetString.EndsWith(suffix)) targetString = targetString.Substring(0, targetString.Length - suffix.Length); else return base.TrackedVisitFieldReferenceExpression(fieldReferenceExpression, data); } TypeReferenceExpression typeExpression = new TypeReferenceExpression(targetString); typeExpression.Parent = fieldReferenceExpression.Parent; ReplaceCurrentNode(typeExpression); return null; } return base.TrackedVisitFieldReferenceExpression(fieldReferenceExpression, data); }
public override object TrackedVisitIdentifierExpression(IdentifierExpression identifierExpression, object data) { if (identifierExpression.Identifier == "System") { TypeReferenceExpression typeReferenceExpression = new TypeReferenceExpression("java.lang.System"); ReplaceCurrentNode(typeReferenceExpression); } return base.TrackedVisitIdentifierExpression(identifierExpression, data); }
public override object TrackedVisitIdentifierExpression(IdentifierExpression identifierExpression, object data) { if (similarTypes.Contains(identifierExpression.Identifier)) { string fullTypeName = (string) similarTypes[identifierExpression.Identifier]; TypeReferenceExpression typeReferenceExpression = new TypeReferenceExpression(fullTypeName); ReplaceCurrentNode(typeReferenceExpression); } return base.TrackedVisitIdentifierExpression(identifierExpression, data); }
public override object TrackedVisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) { TypeReference typeReference = typeReferenceExpression.TypeReference; if (typeReference.Kind == TypeReferenceKind.DotClass) { Expression replacedExpression = GetReplacedExpression(typeReference); ReplaceCurrentNode(replacedExpression); } return base.TrackedVisitTypeReferenceExpression(typeReferenceExpression, data); }
public override object TrackedVisitMethodDeclaration(MethodDeclaration methodDeclaration, object data) { if (AstUtil.ContainsModifier(methodDeclaration, Modifiers.Synchronized)) { List<Expression> positionalArgs = new List<Expression>(); TypeReferenceExpression system = new TypeReferenceExpression("System.Runtime.CompilerServices.MethodImplOptions"); FieldReferenceExpression attributeArgument = new FieldReferenceExpression(system, "Synchronized"); positionalArgs.Add(attributeArgument); AttributeSection attributeSection = CreateAttributeSection("System.Runtime.CompilerServices.MethodImplAttribute", positionalArgs); MethodDeclaration replacedMethod = methodDeclaration; replacedMethod.Attributes.Add(attributeSection); attributeSection.Parent = replacedMethod; ReplaceCurrentNode(replacedMethod); } return base.TrackedVisitMethodDeclaration(methodDeclaration, data); }
public override object TrackedVisitIdentifierExpression(IdentifierExpression identifierExpression, object data) { string identifier = ContainsIdentifier(identifierExpression); if (identifier != null) { TypeReferenceExpression replacedIdentifier = new TypeReferenceExpression(identifier); replacedIdentifier.Parent = identifierExpression.Parent; ReplaceCurrentNode(replacedIdentifier); } else { TypeDeclaration typeDeclaration = (TypeDeclaration) AstUtil.GetParentOfType(identifierExpression, typeof(TypeDeclaration)); if (typeDeclaration != null) CheckThroughParents(typeDeclaration, identifierExpression); } return null; }
public object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) { typeReferenceExpression.TypeReference.AcceptVisitor (this, data); return data; }
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); }
private void CheckThroughParents(TypeDeclaration typeDeclaration, IdentifierExpression identifierExpression) { if (typeDeclaration.Parent is TypeDeclaration) { TypeDeclaration parent = (TypeDeclaration) typeDeclaration.Parent; CheckThroughParents(parent, identifierExpression); } if (typeDeclaration.BaseTypes.Count > 0) { foreach (TypeReference baseType in typeDeclaration.BaseTypes) { string fullName = GetFullName(baseType); if (CodeBase.References.Contains(fullName)) { string referedBaseType = (string) CodeBase.References[fullName]; TypeReference newBaseType = AstUtil.GetTypeReference(referedBaseType, baseType.Parent); string referenceBaseType = GetFullName(newBaseType); TypeDeclaration baseTypeDeclaration = (TypeDeclaration) CodeBase.Types[referenceBaseType]; if (baseTypeDeclaration != null) { if (DefinedInFieldsClass(baseTypeDeclaration, identifierExpression.Identifier)) { TypeReferenceExpression id = new TypeReferenceExpression(referedBaseType); FieldReferenceExpression replaced = new FieldReferenceExpression(id, identifierExpression.Identifier); replaced.Parent = identifierExpression.Parent; ReplaceCurrentNode(replaced); } else { TypeDeclaration type = (TypeDeclaration) CodeBase.Types[fullName]; CheckThroughParents(type, identifierExpression); } } } else if (CodeBase.Types.Contains(fullName)) { TypeDeclaration baseTypeDeclaration = (TypeDeclaration) CodeBase.Types[fullName]; CheckThroughParents(baseTypeDeclaration, identifierExpression); } } } }
// RG: CodeTypeReferenceExpression public override object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) { return new CodeTypeReferenceExpression(ConvType(typeReferenceExpression.TypeReference)); }
public override object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) { string[] types = typeReferenceExpression.TypeReference.Type.Split ('.'); if (types == null || types.Length == 0) return null; if (types.Length == 1) { ResolveResult result = resolver.ResolveIdentifier (this, typeReferenceExpression.TypeReference.Type); if (result == null) result = CreateResult (typeReferenceExpression.TypeReference); result.StaticResolve = true; return result; } Expression expr = new IdentifierExpression (types[0]); for (int i = 1; i < types.Length; i++) { if (types[i] != "?") expr = new MemberReferenceExpression (expr, types[i]); } return expr.AcceptVisitor (this, data); }
public override object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) { TypeReference reference = typeReferenceExpression.TypeReference; ResolveResult rr = CreateTypeResolveResult(TypeVisitor.CreateReturnType(reference, resolver)); if (rr == null && reference.GenericTypes.Count == 0 && !reference.IsArrayType) { // reference to namespace is possible if (reference.IsGlobal) { if (resolver.ProjectContent.NamespaceExists(reference.Type)) return new NamespaceResolveResult(resolver.CallingClass, resolver.CallingMember, reference.Type); } else { string name = resolver.SearchNamespace(reference.Type, typeReferenceExpression.StartLocation); if (name != null) return new NamespaceResolveResult(resolver.CallingClass, resolver.CallingMember, name); } } if (rr != null) { return rr; } else { return new UnknownIdentifierResolveResult(resolver.CallingClass, resolver.CallingMember, reference.Type); } }
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 TrackedVisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) { this.Append(this.GetTypeName(typeReferenceExpression.TypeReference)); return null; }
public override object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) { return CreateReturnType(typeReferenceExpression.TypeReference); }
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); }
public virtual object TrackedVisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) { return base.VisitTypeReferenceExpression(typeReferenceExpression, data); }
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 static Expression AppendMemberReference(this Expression expresion, IDebugMemberInfo memberInfo, params Expression[] args) { Expression target; if (memberInfo.IsStatic) { target = new TypeReferenceExpression() { Type = memberInfo.DeclaringType.GetTypeReference() }; } else { target = CastTo(expresion, (DebugType)memberInfo.DeclaringType); } if (memberInfo is DebugFieldInfo) { if (args.Length > 0) { throw new DebuggerException("No arguments expected for a field"); } var mre = new MemberReferenceExpression() { Target = target.Clone(), MemberName = memberInfo.Name }; return(mre.SetStaticType(memberInfo.MemberType)); } if (memberInfo is MethodInfo) { var mre = new MemberReferenceExpression() { Target = target, MemberName = memberInfo.Name }; var ie = new InvocationExpression() { Target = mre.Clone() }; ie.Arguments.AddRange(AddExplicitTypes((MethodInfo)memberInfo, args)); return(ie.SetStaticType(memberInfo.MemberType)); } if (memberInfo is PropertyInfo) { PropertyInfo propInfo = (PropertyInfo)memberInfo; if (args.Length > 0) { if (memberInfo.Name != "Item") { throw new DebuggerException("Arguments expected only for the Item property"); } var ie = new IndexerExpression() { Target = target.Clone() }; ie.Arguments.AddRange(AddExplicitTypes(propInfo.GetGetMethod() ?? propInfo.GetSetMethod(), args)); return(ie.SetStaticType(memberInfo.MemberType)); } else { return((new MemberReferenceExpression() { Target = target.Clone(), MemberName = memberInfo.Name }).SetStaticType(memberInfo.MemberType)); } } throw new DebuggerException("Unknown member type " + memberInfo.GetType().FullName); }
private bool IsMatch(TypeReferenceExpression left, TypeReferenceExpression right) { return true; }
public override object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) { return base.VisitTypeReferenceExpression(typeReferenceExpression, data); }
public virtual bool VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object d) { if ((typeReferenceExpression == null)) { return SetFailure(); } if ((d == null)) { return SetFailure(); } if ((typeReferenceExpression.TypeReference == null)) { return SetFailure(); } if(typeReferenceExpression.GetType() != d.GetType()) {return SetFailure();} var data = (TypeReferenceExpression)d; if (!IsMatch(typeReferenceExpression, data)) { return SetFailure(); } return typeReferenceExpression.TypeReference.AcceptVisitor(this, data.TypeReference); }
void MemberAccess( #line 2034 "cs.ATG" out Expression expr, Expression target) { #line 2035 "cs.ATG" List<TypeReference> typeList; #line 2037 "cs.ATG" if (ShouldConvertTargetExpressionToTypeReference(target)) { TypeReference type = GetTypeReferenceFromExpression(target); if (type != null) { target = new TypeReferenceExpression(type) { StartLocation = t.Location, EndLocation = t.EndLocation }; } } Expect(15); #line 2044 "cs.ATG" Location startLocation = t.Location; Identifier(); #line 2046 "cs.ATG" expr = new MemberReferenceExpression(target, t.val); expr.StartLocation = startLocation; expr.EndLocation = t.EndLocation; if ( #line 2047 "cs.ATG" IsGenericInSimpleNameOrMemberAccess()) { TypeArgumentList( #line 2048 "cs.ATG" out typeList, false); #line 2049 "cs.ATG" ((MemberReferenceExpression)expr).TypeArguments = typeList; } }
public virtual object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) { Debug.Assert((typeReferenceExpression != null)); Debug.Assert((typeReferenceExpression.TypeReference != null)); return typeReferenceExpression.TypeReference.AcceptVisitor(this, data); }
public virtual object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) { throw new global::System.NotImplementedException("TypeReferenceExpression"); }
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 sealed override object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) { this.BeginVisit(typeReferenceExpression); object result = this.TrackedVisitTypeReferenceExpression(typeReferenceExpression, data); this.EndVisit(typeReferenceExpression); return result; }
public virtual object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) { Debug.Assert((typeReferenceExpression != null)); Debug.Assert((typeReferenceExpression.TypeReference != null)); nodeStack.Push(typeReferenceExpression.TypeReference); typeReferenceExpression.TypeReference.AcceptVisitor(this, data); typeReferenceExpression.TypeReference = ((TypeReference)(nodeStack.Pop())); return null; }
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; } }
public virtual object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) { throw CreateException(typeReferenceExpression); }