本文整理汇总了C#中Mono.CSharp.Fixed类的典型用法代码示例。如果您正苦于以下问题:C# Fixed类的具体用法?C# Fixed怎么用?C# Fixed使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Fixed类属于Mono.CSharp命名空间,在下文中一共展示了Fixed类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Visit
public override object Visit(Fixed fixedStatement)
{
var result = new FixedStatement();
var location = LocationsBag.GetLocations(fixedStatement);
result.AddChild(new CSharpTokenNode(Convert(fixedStatement.loc), FixedStatement.FixedKeywordRole), FixedStatement.FixedKeywordRole);
if (location != null)
result.AddChild(new CSharpTokenNode(Convert(location [0]), Roles.LPar), Roles.LPar);
if (fixedStatement.Variables != null) {
var blockVariableDeclaration = fixedStatement.Variables;
result.AddChild(ConvertToType(blockVariableDeclaration.TypeExpression), Roles.Type);
var varInit = new VariableInitializer();
var initLocation = LocationsBag.GetLocations(blockVariableDeclaration);
varInit.AddChild(Identifier.Create(blockVariableDeclaration.Variable.Name, Convert(blockVariableDeclaration.Variable.Location)), Roles.Identifier);
if (blockVariableDeclaration.Initializer != null) {
if (initLocation != null)
varInit.AddChild(new CSharpTokenNode(Convert(initLocation [0]), Roles.Assign), Roles.Assign);
varInit.AddChild((Expression)blockVariableDeclaration.Initializer.Accept(this), Roles.Expression);
}
result.AddChild(varInit, Roles.Variable);
if (blockVariableDeclaration.Declarators != null) {
foreach (var decl in blockVariableDeclaration.Declarators) {
var loc = LocationsBag.GetLocations(decl);
var init = new VariableInitializer();
if (loc != null && loc.Count > 0)
result.AddChild(new CSharpTokenNode(Convert(loc [0]), Roles.Comma), Roles.Comma);
init.AddChild(Identifier.Create(decl.Variable.Name, Convert(decl.Variable.Location)), Roles.Identifier);
if (decl.Initializer != null) {
if (loc != null && loc.Count > 1)
init.AddChild(new CSharpTokenNode(Convert(loc [1]), Roles.Assign), Roles.Assign);
init.AddChild((Expression)decl.Initializer.Accept(this), Roles.Expression);
}
result.AddChild(init, Roles.Variable);
}
}
}
if (location != null && location.Count > 1)
result.AddChild(new CSharpTokenNode(Convert(location [1]), Roles.RPar), Roles.RPar);
if (fixedStatement.Statement != null)
result.AddChild((Statement)fixedStatement.Statement.Accept(this), Roles.EmbeddedStatement);
return result;
}
示例2: Visit
public override object Visit (Fixed fixedStatement)
{
var result = new FixedStatement ();
var location = LocationsBag.GetLocations (fixedStatement);
result.AddChild (new CSharpTokenNode (Convert (fixedStatement.loc), "fixed".Length), FixedStatement.FixedKeywordRole);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), FixedStatement.Roles.LPar);
result.AddChild ((INode)fixedStatement.Type.Accept (this), FixedStatement.PointerDeclarationRole);
foreach (KeyValuePair<LocalInfo, Expression> declarator in fixedStatement.Declarators) {
result.AddChild ((INode)declarator.Value.Accept (this), FixedStatement.DeclaratorRole);
}
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), FixedStatement.Roles.RPar);
result.AddChild ((INode)fixedStatement.Statement.Accept (this), FixedStatement.Roles.EmbeddedStatement);
return result;
}
示例3: Visit
public virtual object Visit (Fixed fixedStatement)
{
return null;
}
示例4: case_932
void case_932()
#line 6246 "cs-parser.jay"
{
if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE)
Warning_EmptyStatement (GetLocation (yyVals[0+yyTop]));
Fixed f = new Fixed ((Fixed.VariableDeclaration) yyVals[-1+yyTop], (Statement) yyVals[0+yyTop], GetLocation (yyVals[-9+yyTop]));
current_block.AddStatement (f);
lbag.AddStatement (f, GetLocation (yyVals[-8+yyTop]), GetLocation (yyVals[-2+yyTop]));
yyVal = end_block (GetLocation (yyVals[-2+yyTop]));
}
示例5: yyparse
//.........这里部分代码省略.........
}
break;
case 135:
#line 1076 "cs-parser.jay"
{
FullNamedExpression type = (FullNamedExpression) yyVals[-2+yyTop];
if (type == TypeManager.system_void_expr)
Report.Error (670, GetLocation (yyVals[-2+yyTop]), "Fields cannot have void type");
var mod = (Modifiers) yyVals[-3+yyTop];
foreach (VariableMemberDeclaration var in (List<object>) yyVals[-1+yyTop]){
Field field = new Field (current_class, type, mod, var.MemberName, (Attributes) yyVals[-4+yyTop]);
field.Initializer = var.GetInitializer (type);
if (RootContext.Documentation != null) {
field.DocComment = Lexer.consume_doc_comment ();
Lexer.doc_state = XmlCommentState.Allowed;
}
current_container.AddField (field);
yyVal = field; /* FIXME: might be better if it points to the top item*/
}
}
break;
case 136:
#line 1102 "cs-parser.jay"
{
FullNamedExpression type = (FullNamedExpression) yyVals[-2+yyTop];
var mod = (Modifiers) yyVals[-4+yyTop];
foreach (VariableDeclaration var in (List<VariableDeclaration>) yyVals[-1+yyTop]) {
FixedField field = new FixedField (current_class, type, mod, var.identifier,
var.GetInitializer (type), (Attributes) yyVals[-5+yyTop], var.Location);
if (RootContext.Version < LanguageVersion.ISO_2)
Report.FeatureIsNotAvailable (GetLocation (yyVals[-3+yyTop]), "fixed size buffers");
if (RootContext.Documentation != null) {
field.DocComment = Lexer.consume_doc_comment ();
Lexer.doc_state = XmlCommentState.Allowed;
}
current_container.AddField (field);
yyVal = field; /* FIXME: might be better if it points to the top item*/
}
}
break;
case 137:
#line 1127 "cs-parser.jay"
{
Report.Error (1641, GetLocation (yyVals[-1+yyTop]), "A fixed size buffer field must have the array size specifier after the field name");
}
break;
case 138:
#line 1134 "cs-parser.jay"
{
var decl = new List<VariableDeclaration> (2);
decl.Add ((VariableDeclaration)yyVals[0+yyTop]);
yyVal = decl;
}
break;
case 139:
#line 1140 "cs-parser.jay"
{
var decls = (List<VariableDeclaration>) yyVals[-2+yyTop];
示例6: Visit
public override object Visit (Fixed fixedStatement)
{
var result = new FixedStatement ();
var location = LocationsBag.GetLocations (fixedStatement);
result.AddChild (new CSharpTokenNode (Convert (fixedStatement.loc), "fixed".Length), FixedStatement.FixedKeywordRole);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), FixedStatement.Roles.LPar);
if (fixedStatement.Variables != null) {
result.AddChild ((INode)fixedStatement.Variables.TypeExpression.Accept (this), UsingStatement.Roles.ReturnType);
result.AddChild (new Identifier (fixedStatement.Variables.Variable.Name, Convert (fixedStatement.Variables.Variable.Location)), UsingStatement.Roles.Identifier);
var loc = LocationsBag.GetLocations (fixedStatement.Variables);
if (loc != null)
result.AddChild (new CSharpTokenNode (Convert (loc[1]), 1), ContinueStatement.Roles.Assign);
if (fixedStatement.Variables.Initializer != null)
result.AddChild ((INode)fixedStatement.Variables.Initializer.Accept (this), UsingStatement.Roles.Initializer);
}
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), FixedStatement.Roles.RPar);
result.AddChild ((INode)fixedStatement.Statement.Accept (this), FixedStatement.Roles.EmbeddedStatement);
return result;
}
示例7: case_881
void case_881()
{
if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE)
Warning_EmptyStatement (GetLocation (yyVals[0+yyTop]));
Fixed f = new Fixed ((Fixed.VariableDeclaration) yyVals[-1+yyTop], (Statement) yyVals[0+yyTop], GetLocation (yyVals[-9+yyTop]));
current_block.AddStatement (f);
yyVal = end_block (GetLocation (yyVals[-2+yyTop]));
}
示例8: yyparse
//.........这里部分代码省略.........
{
lexer.parsing_generic_declaration = false;
FullNamedExpression type = (FullNamedExpression) yyVals[-1+yyTop];
if (type.Type != null && type.Type.Kind == MemberKind.Void)
report.Error (670, GetLocation (yyVals[-1+yyTop]), "Fields cannot have void type");
var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop];
current_field = new Field (current_class, type, (Modifiers) yyVals[-2+yyTop], new MemberName (lt.Value, lt.Location), (Attributes) yyVals[-3+yyTop]);
current_container.AddField (current_field);
yyVal = current_field;
}
break;
case 133:
#line 1163 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
if (doc_support) {
current_field.DocComment = Lexer.consume_doc_comment ();
Lexer.doc_state = XmlCommentState.Allowed;
}
lbag.AddMember (current_field, mod_locations, GetLocation (yyVals[0+yyTop]));
yyVal = current_field;
current_field = null;
}
break;
case 134:
#line 1176 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
if (lang_version < LanguageVersion.ISO_2)
FeatureIsNotAvailable (GetLocation (yyVals[-2+yyTop]), "fixed size buffers");
var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop];
current_field = new FixedField (current_class, (FullNamedExpression) yyVals[-1+yyTop], (Modifiers) yyVals[-3+yyTop],
new MemberName (lt.Value, lt.Location), (Attributes) yyVals[-4+yyTop]);
current_container.AddField (current_field);
}
break;
case 135:
#line 1187 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
if (doc_support) {
current_field.DocComment = Lexer.consume_doc_comment ();
Lexer.doc_state = XmlCommentState.Allowed;
}
current_field.Initializer = (ConstInitializer) yyVals[-2+yyTop];
lbag.AddMember (current_field, mod_locations, GetLocation (yyVals[0+yyTop]));
yyVal = current_field;
current_field = null;
}
break;
case 136:
#line 1202 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
report.Error (1641, GetLocation (yyVals[-1+yyTop]), "A fixed size buffer field must have the array size specifier after the field name");
}
break;
case 138:
#line 1210 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
++lexer.parsing_block;
current_local_parameters = ParametersCompiled.EmptyReadOnlyParameters;
start_block (GetLocation (yyVals[0+yyTop]));
}
示例9: case_849
void case_849()
#line 5398 "C:\Projects\Junk\mono\mcs\class\Mono.CSharp\..\..\mcs\cs-parser.jay"
{
if (yyVals[0+yyTop] is EmptyStatement && lexer.peek_token () == Token.OPEN_BRACE)
Warning_EmptyStatement (GetLocation (yyVals[0+yyTop]));
Fixed f = new Fixed ((Fixed.VariableDeclaration) yyVals[-1+yyTop], (Statement) yyVals[0+yyTop], GetLocation (yyVals[-9+yyTop]));
current_block.AddStatement (f);
yyVal = end_block (GetLocation (yyVals[-2+yyTop]));
}