本文整理汇总了C#中SizeOfExpression类的典型用法代码示例。如果您正苦于以下问题:C# SizeOfExpression类的具体用法?C# SizeOfExpression怎么用?C# SizeOfExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SizeOfExpression类属于命名空间,在下文中一共展示了SizeOfExpression类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: VisitSizeOfExpression
public StringBuilder VisitSizeOfExpression(SizeOfExpression sizeOfExpression, int data)
{
throw new SLSharpException("SL# has no sizeof operator.");
}
开发者ID:hach-que,项目名称:SLSharp,代码行数:4,代码来源:VisitorBase.Illegal.cs
示例2: VisitSizeOfExpression
public override void VisitSizeOfExpression(SizeOfExpression sizeOfExpression)
{
ForceSpacesBefore(sizeOfExpression.LParToken, policy.SpaceBeforeSizeOfParentheses);
ForceSpacesAfter(sizeOfExpression.LParToken, policy.SpacesWithinSizeOfParentheses);
ForceSpacesBefore(sizeOfExpression.RParToken, policy.SpacesWithinSizeOfParentheses);
base.VisitSizeOfExpression(sizeOfExpression);
}
开发者ID:txdv,项目名称:monodevelop,代码行数:7,代码来源:AstFormattingVisitor.cs
示例3: Format_SizeOf_Expression
private void Format_SizeOf_Expression(StringBuilder sb, SizeOfExpression expression)
{
sb.Append("sizeof(").Append(FormatterUtility.FormatDataType(expression.TypeReference, document, controller)).Append(")");
}
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:4,代码来源:CSharpCodeFormatter.cs
示例4: Visit
public override object Visit(SizeOfExpression sizeOfExpression, object data)
{
return new ReturnType("System.Int32");
}
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:4,代码来源:TypeVisitor.cs
示例5: Visit
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;
}
开发者ID:pgoron,项目名称:monodevelop,代码行数:12,代码来源:CSharpParser.cs
示例6: VisitSizeOfExpression
public sealed override object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) {
BeginVisit(sizeOfExpression);
object result = TrackedVisitSizeOfExpression(sizeOfExpression, data);
EndVisit(sizeOfExpression);
return result;
}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:6,代码来源:NodeTrackingAstVisitor.cs
示例7: VisitSizeOfExpression
public virtual object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) {
Debug.Assert((sizeOfExpression != null));
Debug.Assert((sizeOfExpression.TypeReference != null));
return sizeOfExpression.TypeReference.AcceptVisitor(this, data);
}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:5,代码来源:AbstractASTVisitor.cs
示例8: Visit
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;
}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:13,代码来源:CSharpParser.cs
示例9: VisitSizeOfExpression
public void VisitSizeOfExpression(SizeOfExpression node)
{
NotSupported(node);
}
开发者ID:evanw,项目名称:minisharp,代码行数:4,代码来源:Lower.cs
示例10: VisitSizeOfExpression
public void VisitSizeOfExpression(SizeOfExpression sizeOfExpression)
{
JsonObject expression = CreateJsonExpression(sizeOfExpression);
AddKeyword(expression, SizeOfExpression.SizeofKeywordRole);
expression.AddJsonValue("type-info", GenTypeInfo(sizeOfExpression.Type));
Push(expression);
}
开发者ID:CompilerKit,项目名称:CodeWalk,代码行数:8,代码来源:AstCsToJson.cs
示例11: VisitSizeOfExpression
public virtual object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) {
throw new global::System.NotImplementedException("SizeOfExpression");
}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:3,代码来源:NotImplementedAstVisitor.cs
示例12: PrimaryExpr
//.........这里部分代码省略.........
{
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)
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:67,代码来源:Parser.cs
示例13: VisitSizeOfExpression
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;
}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:8,代码来源:AbstractAstTransformer.cs
示例14: VisitSizeOfExpression
public virtual void VisitSizeOfExpression(SizeOfExpression sizeOfExpression)
{
if (this.ThrowException)
{
throw (Exception)this.CreateException(sizeOfExpression);
}
}
开发者ID:fabriciomurta,项目名称:BridgeUnified,代码行数:7,代码来源:Visitor.Exception.cs
示例15: PrimaryExpr
//.........这里部分代码省略.........
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) {
开发者ID:mgagne-atman,项目名称:Projects,代码行数:67,代码来源:Parser.cs
示例16: DivideBySize
/// <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);
}
开发者ID:JustasB,项目名称:cudafy,代码行数:38,代码来源:AstMethodBodyBuilder.cs
示例17: VisitSizeOfExpression
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);
}
开发者ID:0xd4d,项目名称:NRefactory,代码行数:14,代码来源:CSharpOutputVisitor.cs
示例18: VisitSizeOfExpression
public virtual void VisitSizeOfExpression (SizeOfExpression sizeOfExpression)
{
VisitChildren (sizeOfExpression);
}
开发者ID:modulexcite,项目名称:ICSharpCode.Decompiler-retired,代码行数:4,代码来源:DepthFirstAstVisitor.cs
示例19: DivideBySize
/// <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);
}
开发者ID:pentp,项目名称:ILSpy,代码行数:42,代码来源:AstMethodBodyBuilder.cs
示例20: VisitSizeOfExpression
public void VisitSizeOfExpression(SizeOfExpression sizeOfExpression)
{
StartNode(sizeOfExpression);
WriteKeyword(SizeOfExpression.SizeofKeywordRole);
LPar();
Space(policy.SpacesWithinSizeOfParentheses);
sizeOfExpression.Type.AcceptVisitor(this);
Space(policy.SpacesWithinSizeOfParentheses);
RPar();
EndNode(sizeOfExpression);
}
开发者ID:x-strong,项目名称:ILSpy,代码行数:13,代码来源:CSharpOutputVisitor.cs
注:本文中的SizeOfExpression类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论