public override bool VisitSizeOfExpression(SizeOfExpression sizeOfExpression) { // C# sizeof(MyStruct) requires unsafe{} // (not for sizeof(int), but that gets constant-folded and thus decompiled to 4) base.VisitSizeOfExpression(sizeOfExpression); return(true); }
public override object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) { ForceSpacesBefore(sizeOfExpression.LParToken, policy.BeforeSizeOfParentheses); ForceSpacesAfter(sizeOfExpression.LParToken, policy.WithinSizeOfParentheses); ForceSpacesBefore(sizeOfExpression.RParToken, policy.WithinSizeOfParentheses); return(base.VisitSizeOfExpression(sizeOfExpression, data)); }
public virtual void VisitSizeOfExpression(SizeOfExpression sizeOfExpression) { if (this.ThrowException) { throw (System.Exception) this.CreateException(sizeOfExpression); } }
public virtual void VisitSizeOfExpression(SizeOfExpression sizeOfExpression) { if (ThrowException) { throw (Exception)CreateException(sizeOfExpression); } }
public virtual object Visit(SizeOfExpression sizeOfExpression, object data) { Debug.Assert(sizeOfExpression != null); Debug.Assert(sizeOfExpression.TypeReference != null); sizeOfExpression.TypeReference.AcceptVisitor(this, data); return(data); }
public virtual object VisitSizeOf(SizeOfExpression node) { var value = node.Value.Accept(this); if (value == null) { return(0); } return(System.Runtime.InteropServices.Marshal.SizeOf(value)); }
public virtual ICodeNode VisitSizeOfExpression(SizeOfExpression node) { return(node); }
public override void VisitSizeOfExpression(SizeOfExpression syntax) { _underlyingVisitor.VisitSizeOfExpression(syntax); }
public Expression VisitSizeOf(SizeOfExpression node) { node.Value.Accept(this); return(node); }
public StringBuilder VisitSizeOfExpression(SizeOfExpression sizeOfExpression, int data) { throw new SLSharpException("SL# has no sizeof operator."); }
public override object Visit(SizeOfExpression sizeOfExpression, object data) { return new ReturnType("System.Int32"); }
public void VisitSizeOfExpression(SizeOfExpression sizeOfExpression) { StartNode(sizeOfExpression); WriteKeyword(SizeOfExpression.SizeofKeywordRole); LPar(); Space(policy.SpacesWithinSizeOfParentheses); sizeOfExpression.Type.AcceptVisitor(this); Space(policy.SpacesWithinSizeOfParentheses); RPar(); EndNode(sizeOfExpression); }
public virtual object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) { throw new global::System.NotImplementedException("SizeOfExpression"); }
public virtual void VisitSizeOfExpression(SizeOfExpression sizeOfExpression) { DebugExpression(sizeOfExpression); StartNode(sizeOfExpression); WriteKeyword(SizeOfExpression.SizeofKeywordRole); var braceHelper = BraceHelper.LeftParen(this, CodeBracesRangeFlags.Parentheses); Space(policy.SpacesWithinSizeOfParentheses); sizeOfExpression.Type.AcceptVisitor(this); Space(policy.SpacesWithinSizeOfParentheses); braceHelper.RightParen(); EndNode(sizeOfExpression); }
void PrimaryExpr( #line 1862 "cs.ATG" out Expression pexpr) { #line 1864 "cs.ATG" TypeReference type = null; Expression expr; pexpr = null; #line 1869 "cs.ATG" Location startLocation = la.Location; if (la.kind == 113) { lexer.NextToken(); #line 1871 "cs.ATG" pexpr = new PrimitiveExpression(true, "true"); } else if (la.kind == 72) { lexer.NextToken(); #line 1872 "cs.ATG" pexpr = new PrimitiveExpression(false, "false"); } else if (la.kind == 90) { lexer.NextToken(); #line 1873 "cs.ATG" pexpr = new PrimitiveExpression(null, "null"); } else if (la.kind == 2) { lexer.NextToken(); #line 1874 "cs.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; } else if ( #line 1875 "cs.ATG" StartOfQueryExpression()) { QueryExpression( #line 1876 "cs.ATG" out pexpr); } else if ( #line 1877 "cs.ATG" IdentAndDoubleColon()) { Identifier(); #line 1878 "cs.ATG" type = new TypeReference(t.val); Expect(10); #line 1879 "cs.ATG" pexpr = new TypeReferenceExpression(type); Identifier(); #line 1880 "cs.ATG" if (type.Type == "global") { type.IsGlobal = true; type.Type = t.val ?? "?"; } else type.Type += "." + (t.val ?? "?"); } else if (StartOf(19)) { Identifier(); #line 1884 "cs.ATG" pexpr = new IdentifierExpression(t.val); if (la.kind == 48 || #line 1887 "cs.ATG" IsGenericInSimpleNameOrMemberAccess()) { if (la.kind == 48) { ShortedLambdaExpression( #line 1886 "cs.ATG" (IdentifierExpression)pexpr, out pexpr); } else { #line 1888 "cs.ATG" List<TypeReference> typeList; TypeArgumentList( #line 1889 "cs.ATG" out typeList, false); #line 1890 "cs.ATG" ((IdentifierExpression)pexpr).TypeArguments = typeList; } } } else if ( #line 1892 "cs.ATG" IsLambdaExpression()) { LambdaExpression( #line 1893 "cs.ATG" out pexpr); } else if (la.kind == 20) { lexer.NextToken(); Expr( #line 1896 "cs.ATG" out expr); Expect(21); #line 1896 "cs.ATG" pexpr = new ParenthesizedExpression(expr); } else if (StartOf(35)) { #line 1899 "cs.ATG" string val = null; switch (la.kind) { case 52: { lexer.NextToken(); #line 1900 "cs.ATG" val = "System.Boolean"; break; } case 54: { lexer.NextToken(); #line 1901 "cs.ATG" val = "System.Byte"; break; } case 57: { lexer.NextToken(); #line 1902 "cs.ATG" val = "System.Char"; break; } case 62: { lexer.NextToken(); #line 1903 "cs.ATG" val = "System.Decimal"; break; } case 66: { lexer.NextToken(); #line 1904 "cs.ATG" val = "System.Double"; break; } case 75: { lexer.NextToken(); #line 1905 "cs.ATG" val = "System.Single"; break; } case 82: { lexer.NextToken(); #line 1906 "cs.ATG" val = "System.Int32"; break; } case 87: { lexer.NextToken(); #line 1907 "cs.ATG" val = "System.Int64"; break; } case 91: { lexer.NextToken(); #line 1908 "cs.ATG" val = "System.Object"; break; } case 102: { lexer.NextToken(); #line 1909 "cs.ATG" val = "System.SByte"; break; } case 104: { lexer.NextToken(); #line 1910 "cs.ATG" val = "System.Int16"; break; } case 108: { lexer.NextToken(); #line 1911 "cs.ATG" val = "System.String"; break; } case 116: { lexer.NextToken(); #line 1912 "cs.ATG" val = "System.UInt32"; break; } case 117: { lexer.NextToken(); #line 1913 "cs.ATG" val = "System.UInt64"; break; } case 120: { lexer.NextToken(); #line 1914 "cs.ATG" val = "System.UInt16"; break; } case 123: { lexer.NextToken(); #line 1915 "cs.ATG" val = "System.Void"; break; } } #line 1917 "cs.ATG" pexpr = new TypeReferenceExpression(new TypeReference(val, true)) { StartLocation = t.Location, EndLocation = t.EndLocation }; } else if (la.kind == 111) { lexer.NextToken(); #line 1920 "cs.ATG" pexpr = new ThisReferenceExpression(); pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation; } else if (la.kind == 51) { lexer.NextToken(); #line 1922 "cs.ATG" pexpr = new BaseReferenceExpression(); pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation; } else if (la.kind == 89) { NewExpression( #line 1925 "cs.ATG" out pexpr); } else if (la.kind == 115) { lexer.NextToken(); Expect(20); if ( #line 1929 "cs.ATG" NotVoidPointer()) { Expect(123); #line 1929 "cs.ATG" type = new TypeReference("System.Void", true); } else if (StartOf(10)) { TypeWithRestriction( #line 1930 "cs.ATG" out type, true, true); } else SynErr(208); Expect(21); #line 1932 "cs.ATG" pexpr = new TypeOfExpression(type); } else if (la.kind == 63) { lexer.NextToken(); Expect(20); Type( #line 1934 "cs.ATG" out type); Expect(21); #line 1934 "cs.ATG" pexpr = new DefaultValueExpression(type); } else if (la.kind == 105) { lexer.NextToken(); Expect(20); Type( #line 1935 "cs.ATG" out type); Expect(21); #line 1935 "cs.ATG" pexpr = new SizeOfExpression(type); } else if (la.kind == 58) { lexer.NextToken(); Expect(20); Expr( #line 1936 "cs.ATG" out expr); Expect(21); #line 1936 "cs.ATG" pexpr = new CheckedExpression(expr); } else if (la.kind == 118) { lexer.NextToken(); Expect(20); Expr( #line 1937 "cs.ATG" out expr); Expect(21); #line 1937 "cs.ATG" pexpr = new UncheckedExpression(expr); } else if (la.kind == 64) { lexer.NextToken(); AnonymousMethodExpr( #line 1938 "cs.ATG" out expr); #line 1938 "cs.ATG" pexpr = expr; } else SynErr(209); #line 1940 "cs.ATG" if (pexpr != null) { if (pexpr.StartLocation.IsEmpty) pexpr.StartLocation = startLocation; if (pexpr.EndLocation.IsEmpty) pexpr.EndLocation = t.EndLocation; } while (StartOf(36)) { if (la.kind == 31 || la.kind == 32) { #line 1948 "cs.ATG" startLocation = la.Location; if (la.kind == 31) { lexer.NextToken(); #line 1950 "cs.ATG" pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostIncrement); } else if (la.kind == 32) { lexer.NextToken(); #line 1951 "cs.ATG" pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostDecrement); } else SynErr(210); } else if (la.kind == 47) { PointerMemberAccess( #line 1954 "cs.ATG" out pexpr, pexpr); } else if (la.kind == 15) { MemberAccess( #line 1955 "cs.ATG" out pexpr, pexpr); } else if (la.kind == 20) { lexer.NextToken(); #line 1959 "cs.ATG" List<Expression> parameters = new List<Expression>(); #line 1960 "cs.ATG" pexpr = new InvocationExpression(pexpr, parameters); if (StartOf(26)) { Argument( #line 1961 "cs.ATG" out expr); #line 1961 "cs.ATG" SafeAdd(pexpr, parameters, expr); while (la.kind == 14) { lexer.NextToken(); Argument( #line 1962 "cs.ATG" out expr); #line 1962 "cs.ATG" SafeAdd(pexpr, parameters, expr); } } Expect(21); } else { #line 1968 "cs.ATG" List<Expression> indices = new List<Expression>(); pexpr = new IndexerExpression(pexpr, indices); lexer.NextToken(); Expr( #line 1971 "cs.ATG" out expr); #line 1971 "cs.ATG" SafeAdd(pexpr, indices, expr); while (la.kind == 14) { lexer.NextToken(); Expr( #line 1972 "cs.ATG" out expr); #line 1972 "cs.ATG" SafeAdd(pexpr, indices, expr); } Expect(19); #line 1975 "cs.ATG" if (pexpr != null) { pexpr.StartLocation = startLocation; pexpr.EndLocation = t.EndLocation; } } } }
public UnifiedElement VisitSizeOfExpression( SizeOfExpression sizeOfExpression, object data) { return(UnifiedSizeof.Create(sizeOfExpression.Type.TryAcceptForExpression(this))); }
public Node VisitSizeOfExpression(SizeOfExpression sizeOfExpression) { return(CreateDummy(sizeOfExpression)); }
public virtual object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) { Debug.Assert((sizeOfExpression != null)); Debug.Assert((sizeOfExpression.TypeReference != null)); return sizeOfExpression.TypeReference.AcceptVisitor(this, data); }
public void VisitSizeOfExpression(SizeOfExpression sizeOfExpression) { JsonObject expression = CreateJsonExpression(sizeOfExpression); AddKeyword(expression, SizeOfExpression.SizeofKeywordRole); expression.AddJsonValue("type-info", GenTypeInfo(sizeOfExpression.Type)); Push(expression); }
public void VisitSizeOfExpression(SizeOfExpression node) { NotSupported(node); }
public virtual void VisitSizeOfExpression(SizeOfExpression sizeOfExpression) { if (this.ThrowException) { throw (Exception)this.CreateException(sizeOfExpression); } }
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { SizeOfExpression o = other as SizeOfExpression; return(o != null && this.Type.DoMatch(o.Type, match)); }
/// <summary> /// Divides expr by the size of 'type'. /// </summary> Expression DivideBySize(Expression expr, TypeReference type) { CastExpression cast = expr as CastExpression; if (cast != null && cast.Type is PrimitiveType && ((PrimitiveType)cast.Type).Keyword == "int") expr = cast.Expression.Detach(); Expression sizeOfExpression; int size = TypeAnalysis.GetInformationAmount(type); switch (size) { case 1: case 8: case 16: case 32: case 64: sizeOfExpression = new PrimitiveExpression(size = (size + 7) / 8); break; default: size = 0; sizeOfExpression = new SizeOfExpression { Type = AstBuilder.ConvertType(type) }; break; } BinaryOperatorExpression boe = expr as BinaryOperatorExpression; if (boe != null && boe.Operator == BinaryOperatorType.Multiply && sizeOfExpression.IsMatch(boe.Right)) return boe.Left.Detach(); if (size == 1) return expr; if (sizeOfExpression.IsMatch(expr)) return new PrimitiveExpression(1); if (size != 0) { var primitive = expr as PrimitiveExpression; if (primitive != null && primitive.Value is int) return new PrimitiveExpression((int)primitive.Value / size); } return new BinaryOperatorExpression(expr, BinaryOperatorType.Divide, sizeOfExpression); }
public virtual void VisitSizeOfExpression (SizeOfExpression sizeOfExpression) { VisitChildren (sizeOfExpression); }
private void Format_SizeOf_Expression(StringBuilder sb, SizeOfExpression expression) { sb.Append("sizeof(").Append(FormatterUtility.FormatDataType(expression.TypeReference, document, controller)).Append(")"); }
public virtual object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) { Debug.Assert((sizeOfExpression != null)); Debug.Assert((sizeOfExpression.TypeReference != null)); nodeStack.Push(sizeOfExpression.TypeReference); sizeOfExpression.TypeReference.AcceptVisitor(this, data); sizeOfExpression.TypeReference = ((TypeReference)(nodeStack.Pop())); return null; }
public override object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) { return(base.VisitSizeOfExpression(sizeOfExpression, data)); }
public override void VisitSizeOfExpression(SizeOfExpression sizeOfExpression) { HandleExpressionNode(sizeOfExpression); }
public override void VisitSizeOfExpression(SizeOfExpression sizeOfExpression) { base.VisitSizeOfExpression(sizeOfExpression); unsafeStateStack.Peek().UseUnsafeConstructs = true; }
public override void VisitSizeOfExpression(SizeOfExpression sizeOfExpression) { }
public void VisitSizeOfExpression(SizeOfExpression sizeOfExpression) { throw new NotImplementedException(); }
public object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) { AddError(sizeOfExpression, "sizeof is not supported."); return(null); }
private void PrimaryExpr(out Expression pexpr) { TypeReference typeReference = null; List<TypeReference> types = null; Expression expression; bool flag = false; pexpr = null; if (this.la.kind == 0x70) { base.lexer.NextToken(); pexpr = new PrimitiveExpression(true, "true"); } else if (this.la.kind == 0x47) { base.lexer.NextToken(); pexpr = new PrimitiveExpression(false, "false"); } else if (this.la.kind == 0x59) { base.lexer.NextToken(); pexpr = new PrimitiveExpression(null, "null"); } else if (this.la.kind == 2) { base.lexer.NextToken(); pexpr = new PrimitiveExpression(this.t.literalValue, this.t.val); } else if ((this.la.kind == 1) && (this.Peek(1).kind == 10)) { base.Expect(1); typeReference = new TypeReference(this.t.val); base.Expect(10); pexpr = new TypeReferenceExpression(typeReference); base.Expect(1); if (typeReference.Type == "global") { typeReference.IsGlobal = true; typeReference.Type = this.t.val ?? "?"; } else { typeReference.Type = typeReference.Type + "." + (this.t.val ?? "?"); } } else if (this.la.kind == 1) { base.lexer.NextToken(); pexpr = new IdentifierExpression(this.t.val); } else if (this.la.kind == 20) { base.lexer.NextToken(); this.Expr(out expression); base.Expect(0x15); pexpr = new ParenthesizedExpression(expression); } else if (!this.StartOf(0x1a)) { if (this.la.kind == 110) { base.lexer.NextToken(); pexpr = new ThisReferenceExpression(); } else if (this.la.kind == 50) { base.lexer.NextToken(); Expression targetObject = new BaseReferenceExpression(); if (this.la.kind == 15) { base.lexer.NextToken(); base.Expect(1); targetObject = new FieldReferenceExpression(targetObject, this.t.val); } else if (this.la.kind == 0x12) { base.lexer.NextToken(); this.Expr(out expression); List<Expression> indices = new List<Expression>(); if (expression != null) { indices.Add(expression); } while (this.la.kind == 14) { base.lexer.NextToken(); this.Expr(out expression); if (expression != null) { indices.Add(expression); } } base.Expect(0x13); targetObject = new IndexerExpression(targetObject, indices); } else { base.SynErr(0xb3); } pexpr = targetObject; } else if (this.la.kind == 0x58) { base.lexer.NextToken(); this.NonArrayType(out typeReference); List<Expression> parameters = new List<Expression>(); if (this.la.kind == 20) { base.lexer.NextToken(); ObjectCreateExpression expression3 = new ObjectCreateExpression(typeReference, parameters); if (this.StartOf(0x15)) { this.Argument(out expression); if (expression != null) { parameters.Add(expression); } while (this.la.kind == 14) { base.lexer.NextToken(); this.Argument(out expression); if (expression != null) { parameters.Add(expression); } } } base.Expect(0x15); pexpr = expression3; } else if (this.la.kind == 0x12) { base.lexer.NextToken(); flag = true; ArrayCreateExpression expression4 = new ArrayCreateExpression(typeReference); pexpr = expression4; int item = 0; List<int> list4 = new List<int>(); if ((this.la.kind == 14) || (this.la.kind == 0x13)) { while (this.la.kind == 14) { base.lexer.NextToken(); item++; } base.Expect(0x13); list4.Add(item); item = 0; while (this.la.kind == 0x12) { base.lexer.NextToken(); while (this.la.kind == 14) { base.lexer.NextToken(); item++; } base.Expect(0x13); list4.Add(item); item = 0; } expression4.CreateType.RankSpecifier = list4.ToArray(); this.ArrayInitializer(out expression); expression4.ArrayInitializer = (ArrayInitializerExpression) expression; } else if (this.StartOf(5)) { this.Expr(out expression); if (expression != null) { parameters.Add(expression); } while (this.la.kind == 14) { base.lexer.NextToken(); item++; this.Expr(out expression); if (expression != null) { parameters.Add(expression); } } base.Expect(0x13); list4.Add(item); expression4.Arguments = parameters; for (item = 0; this.la.kind == 0x12; item = 0) { base.lexer.NextToken(); while (this.la.kind == 14) { base.lexer.NextToken(); item++; } base.Expect(0x13); list4.Add(item); } expression4.CreateType.RankSpecifier = list4.ToArray(); if (this.la.kind == 0x10) { this.ArrayInitializer(out expression); expression4.ArrayInitializer = (ArrayInitializerExpression) expression; } } else { base.SynErr(180); } } else { base.SynErr(0xb5); } } else if (this.la.kind == 0x72) { base.lexer.NextToken(); base.Expect(20); if (this.NotVoidPointer()) { base.Expect(0x7a); typeReference = new TypeReference("void"); } else if (this.StartOf(9)) { this.TypeWithRestriction(out typeReference, true, true); } else { base.SynErr(0xb6); } base.Expect(0x15); pexpr = new TypeOfExpression(typeReference); } else if ((this.la.kind == 0x3e) && (this.Peek(1).kind == 20)) { base.Expect(0x3e); base.Expect(20); this.Type(out typeReference); base.Expect(0x15); pexpr = new DefaultValueExpression(typeReference); } else if (this.la.kind == 0x68) { base.lexer.NextToken(); base.Expect(20); this.Type(out typeReference); base.Expect(0x15); pexpr = new SizeOfExpression(typeReference); } else if (this.la.kind == 0x39) { base.lexer.NextToken(); base.Expect(20); this.Expr(out expression); base.Expect(0x15); pexpr = new CheckedExpression(expression); } else if (this.la.kind == 0x75) { base.lexer.NextToken(); base.Expect(20); this.Expr(out expression); base.Expect(0x15); pexpr = new UncheckedExpression(expression); } else if (this.la.kind == 0x3f) { base.lexer.NextToken(); this.AnonymousMethodExpr(out expression); pexpr = expression; } else { base.SynErr(0xb7); } } else { string typeName = null; switch (this.la.kind) { case 0x3d: base.lexer.NextToken(); typeName = "decimal"; break; case 0x41: base.lexer.NextToken(); typeName = "double"; break; case 0x4a: base.lexer.NextToken(); typeName = "float"; break; case 0x33: base.lexer.NextToken(); typeName = "bool"; break; case 0x35: base.lexer.NextToken(); typeName = "byte"; break; case 0x38: base.lexer.NextToken(); typeName = "char"; break; case 0x51: base.lexer.NextToken(); typeName = "int"; break; case 0x56: base.lexer.NextToken(); typeName = "long"; break; case 90: base.lexer.NextToken(); typeName = "object"; break; case 0x65: base.lexer.NextToken(); typeName = "sbyte"; break; case 0x67: base.lexer.NextToken(); typeName = "short"; break; case 0x6b: base.lexer.NextToken(); typeName = "string"; break; case 0x73: base.lexer.NextToken(); typeName = "uint"; break; case 0x74: base.lexer.NextToken(); typeName = "ulong"; break; case 0x77: base.lexer.NextToken(); typeName = "ushort"; break; } this.t.val = ""; base.Expect(15); base.Expect(1); pexpr = new FieldReferenceExpression(new TypeReferenceExpression(typeName), this.t.val); } while ((this.StartOf(0x1b) || (this.IsGenericFollowedBy(15) && this.IsTypeReferenceExpression(pexpr))) || this.IsGenericFollowedBy(20)) { if ((this.la.kind == 0x1f) || (this.la.kind == 0x20)) { if (this.la.kind == 0x1f) { base.lexer.NextToken(); pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostIncrement); } else if (this.la.kind == 0x20) { base.lexer.NextToken(); pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostDecrement); } else { base.SynErr(0xb8); } } else { if (this.la.kind == 0x2f) { base.lexer.NextToken(); base.Expect(1); pexpr = new PointerReferenceExpression(pexpr, this.t.val); continue; } if (this.la.kind == 15) { base.lexer.NextToken(); base.Expect(1); pexpr = new FieldReferenceExpression(pexpr, this.t.val); continue; } if (this.IsGenericFollowedBy(15) && this.IsTypeReferenceExpression(pexpr)) { this.TypeArgumentList(out types, false); base.Expect(15); base.Expect(1); pexpr = new FieldReferenceExpression(this.GetTypeReferenceExpression(pexpr, types), this.t.val); continue; } if (this.la.kind == 20) { base.lexer.NextToken(); List<Expression> arguments = new List<Expression>(); if (this.StartOf(0x15)) { this.Argument(out expression); if (expression != null) { arguments.Add(expression); } while (this.la.kind == 14) { base.lexer.NextToken(); this.Argument(out expression); if (expression != null) { arguments.Add(expression); } } } base.Expect(0x15); pexpr = new InvocationExpression(pexpr, arguments); continue; } if (this.IsGenericFollowedBy(20)) { this.TypeArgumentList(out types, false); base.Expect(20); List<Expression> list6 = new List<Expression>(); if (this.StartOf(0x15)) { this.Argument(out expression); if (expression != null) { list6.Add(expression); } while (this.la.kind == 14) { base.lexer.NextToken(); this.Argument(out expression); if (expression != null) { list6.Add(expression); } } } base.Expect(0x15); pexpr = new InvocationExpression(pexpr, list6, types); continue; } if (flag) { this.Error("element access not allow on array creation"); } List<Expression> list7 = new List<Expression>(); base.lexer.NextToken(); this.Expr(out expression); if (expression != null) { list7.Add(expression); } while (this.la.kind == 14) { base.lexer.NextToken(); this.Expr(out expression); if (expression != null) { list7.Add(expression); } } base.Expect(0x13); pexpr = new IndexerExpression(pexpr, list7); } } }
public virtual object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) { throw new global::System.NotImplementedException("SizeOfExpression"); }
public StringBuilder VisitSizeOfExpression(SizeOfExpression sizeOfExpression) { throw new NotImplementedException(); }
public override void VisitSizeOfExpression(SizeOfExpression sizeOfExpression) { ForceSpacesBefore(sizeOfExpression.LParToken, policy.SpaceBeforeSizeOfParentheses); ForceSpacesAfter(sizeOfExpression.LParToken, policy.SpacesWithinSizeOfParentheses); ForceSpacesBefore(sizeOfExpression.RParToken, policy.SpacesWithinSizeOfParentheses); base.VisitSizeOfExpression(sizeOfExpression); }
public virtual TReturn Visit(SizeOfExpression node, TParam param) => throw new NotImplementedException();
public virtual void VisitSizeOfExpression(SizeOfExpression node) { }
public void CSharpSizeOfExpressionTest() { SizeOfExpression soe = ParseUtilCSharp.ParseExpression <SizeOfExpression>("sizeof(MyType)"); Assert.AreEqual("MyType", soe.TypeReference.Type); }
public virtual TReturn Visit(SizeOfExpression node, TParam param) { node.SubExpression.Accept(this, param); return(DefaultReturn); }
public override object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) { return(resolver.ProjectContent.SystemTypes.Int32); }
public void SizeOfExpressionTest() { SizeOfExpression soe = ParseUtilCSharp.ParseExpression <SizeOfExpression>("sizeof(MyType)"); Assert.AreEqual("MyType", ((SimpleType)soe.Type).Identifier); }
public JNode VisitSizeOfExpression(SizeOfExpression node) { throw new NotImplementedException(); }
/// <summary> /// Divides expr by the size of 'type'. /// </summary> Expression DivideBySize(Expression expr, TypeReference type) { CastExpression cast = expr as CastExpression; if (cast != null && cast.Type is PrimitiveType && ((PrimitiveType)cast.Type).Keyword == "int") expr = cast.Expression.Detach(); Expression sizeOfExpression; switch (TypeAnalysis.GetInformationAmount(type)) { case 1: case 8: sizeOfExpression = new PrimitiveExpression(1); break; case 16: sizeOfExpression = new PrimitiveExpression(2); break; case 32: sizeOfExpression = new PrimitiveExpression(4); break; case 64: sizeOfExpression = new PrimitiveExpression(8); break; default: sizeOfExpression = new SizeOfExpression { Type = AstBuilder.ConvertType(type) }; break; } BinaryOperatorExpression boe = expr as BinaryOperatorExpression; if (boe != null && boe.Operator == BinaryOperatorType.Multiply && sizeOfExpression.IsMatch(boe.Right)) return boe.Left.Detach(); if (sizeOfExpression.IsMatch(expr)) return new PrimitiveExpression(1); return new BinaryOperatorExpression(expr, BinaryOperatorType.Divide, sizeOfExpression); }
/* * public override void VisitPrimitiveExpression (PrimitiveExpression primitiveExpression) * { * return primitiveExpression.ToString (); * }*/ public override void VisitSizeOfExpression(SizeOfExpression sizeOfExpression) { throw NotSupportedToConsistency(); }
public override object Visit(SizeOf sizeOfExpression) { var result = new SizeOfExpression(); var location = LocationsBag.GetLocations(sizeOfExpression); result.AddChild(new CSharpTokenNode(Convert(sizeOfExpression.Location), SizeOfExpression.SizeofKeywordRole), SizeOfExpression.SizeofKeywordRole); if (location != null) result.AddChild(new CSharpTokenNode(Convert(location [0]), Roles.LPar), Roles.LPar); if (sizeOfExpression.TypeExpression != null) result.AddChild(ConvertToType(sizeOfExpression.TypeExpression), Roles.Type); if (location != null && location.Count > 1) result.AddChild(new CSharpTokenNode(Convert(location [1]), Roles.RPar), Roles.RPar); return result; }
public virtual object TrackedVisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) { return base.VisitSizeOfExpression(sizeOfExpression, data); }
public override object Visit (SizeOf sizeOfExpression) { var result = new SizeOfExpression (); var location = LocationsBag.GetLocations (sizeOfExpression); result.AddChild (new CSharpTokenNode (Convert (sizeOfExpression.Location), "sizeof".Length), TypeOfExpression.Roles.Keyword); if (location != null) result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), TypeOfExpression.Roles.LPar); result.AddChild ((INode)sizeOfExpression.QueriedType.Accept (this), TypeOfExpression.Roles.ReturnType); if (location != null) result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), TypeOfExpression.Roles.RPar); return result; }
/// <inheritdoc/> public virtual void VisitSizeOfExpression(SizeOfExpression syntax) { VisitNode(syntax); }
public override object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) { return(CreateResult(typeof(System.Int32).FullName)); }
public sealed override object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) { BeginVisit(sizeOfExpression); object result = TrackedVisitSizeOfExpression(sizeOfExpression, data); EndVisit(sizeOfExpression); return result; }