本文整理汇总了C#中Mono.CSharp.As类的典型用法代码示例。如果您正苦于以下问题:C# As类的具体用法?C# As怎么用?C# As使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
As类属于Mono.CSharp命名空间,在下文中一共展示了As类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Visit
public override object Visit(As asExpression)
{
var result = new AsExpression();
if (asExpression.Expr != null)
result.AddChild((Expression)asExpression.Expr.Accept(this), Roles.Expression);
result.AddChild(new CSharpTokenNode(Convert(asExpression.Location), AsExpression.AsKeywordRole), AsExpression.AsKeywordRole);
if (asExpression.ProbeType != null)
result.AddChild(ConvertToType(asExpression.ProbeType), Roles.Type);
return result;
}
示例2: Visit
public override object Visit (As asExpression)
{
var result = new AsExpression ();
result.AddChild ((INode)asExpression.Expr.Accept (this), AsExpression.Roles.Expression);
result.AddChild (new CSharpTokenNode (Convert (asExpression.Location), "as".Length), AsExpression.Roles.Keyword);
result.AddChild ((INode)asExpression.ProbeType.Accept (this), AsExpression.Roles.ReturnType);
return result;
}
示例3: yyparse
//.........这里部分代码省略.........
case 577:
case_577();
break;
case 578:
case_578();
break;
case 580:
case_580();
break;
case 581:
case_581();
break;
case 582:
case_582();
break;
case 583:
case_583();
break;
case 584:
case_584();
break;
case 585:
case_585();
break;
case 587:
case_587();
break;
case 588:
case_588();
break;
case 589:
#line 4221 "cs-parser.jay"
{
yyVal = new As ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
}
break;
case 590:
#line 4225 "cs-parser.jay"
{
yyVal = new Is ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
}
break;
case 591:
case_591();
break;
case 592:
case_592();
break;
case 593:
case_593();
break;
case 594:
case_594();
break;
case 596:
case_596();
break;
case 597:
case_597();
break;
case 598:
case_598();
break;
case 599:
case_599();
break;
示例4: case_593
void case_593()
#line 4241 "cs-parser.jay"
{
Error_SyntaxError (yyToken);
yyVal = new As ((Expression) yyVals[-2+yyTop], null, GetLocation (yyVals[-1+yyTop]));
}
示例5: Visit
public virtual object Visit (As asExpression)
{
return null;
}
示例6: yyparse
//.........这里部分代码省略.........
yyVal = new Indirection ((Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
}
break;
case 563:
#line 3839 "cs-parser.jay"
{
yyVal = new Unary (Unary.Operator.AddressOf, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
}
break;
case 565:
case_565();
break;
case 566:
case_566();
break;
case 567:
case_567();
break;
case 569:
case_569();
break;
case 570:
#line 3871 "cs-parser.jay"
{
yyVal = new Binary (Binary.Operator.Subtraction, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
}
break;
case 571:
case_571();
break;
case 572:
#line 3880 "cs-parser.jay"
{
yyVal = new As ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
}
break;
case 573:
#line 3884 "cs-parser.jay"
{
yyVal = new Is ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
}
break;
case 575:
case_575();
break;
case 576:
case_576();
break;
case 578:
case_578();
break;
case 579:
case_579();
break;
case 580:
case_580();
break;
case 581:
case_581();
break;
case 583:
case_583();
break;
case 584:
case_584();
break;
示例7: yyparse
//.........这里部分代码省略.........
if ((ds.ModFlags & (Modifiers.PRIVATE|Modifiers.PROTECTED)) != 0){
Report.Error (1527, ds.Location,
"Namespace elements cannot be explicitly declared as private, protected or protected internal");
}
}
current_namespace.DeclarationFound = true;
}
break;
case 50:
#line 594 "cs-parser.jay"
{
current_namespace.DeclarationFound = true;
}
break;
case 51:
#line 598 "cs-parser.jay"
{
Report.Error (116, ((MemberCore) yyVals[0+yyTop]).Location, "A namespace can only contain types and namespace declarations");
}
break;
case 52:
#line 601 "cs-parser.jay"
{
Report.Error (116, ((MemberCore) yyVals[0+yyTop]).Location, "A namespace can only contain types and namespace declarations");
}
break;
case 58:
#line 627 "cs-parser.jay"
{
if (yyVals[0+yyTop] != null) {
Attributes attrs = (Attributes)yyVals[0+yyTop];
if (global_attrs_enabled) {
CodeGen.Assembly.AddAttributes (attrs.Attrs, current_namespace);
} else {
foreach (Attribute a in attrs.Attrs) {
Report.Error (1730, a.Location, "Assembly and module attributes must precede all other elements except using clauses and extern alias declarations");
}
}
}
yyVal = yyVals[0+yyTop];
}
break;
case 59:
#line 644 "cs-parser.jay"
{
global_attrs_enabled = false;
yyVal = null;
}
break;
case 60:
#line 649 "cs-parser.jay"
{
global_attrs_enabled = false;
yyVal = yyVals[0+yyTop];
}
break;
case 61:
#line 658 "cs-parser.jay"
{
if (current_attr_target != String.Empty) {
var sect = (List<Attribute>) yyVals[0+yyTop];
if (global_attrs_enabled) {
if (current_attr_target == "module") {
current_container.Module.Compiled.AddAttributes (sect);
示例8: case_600
void case_600()
#line 4283 "cs-parser.jay"
{
var lt = (LocatedToken) yyVals[-2+yyTop];
yyVal = new As (new SimpleName (lt.Value, lt.Location), (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
}
示例9: yyparse
//.........这里部分代码省略.........
case 3:
if (yyToken == 0) {
if (debug != null) debug.reject();
throw new yyParser.yyException("irrecoverable syntax error at end-of-file");
}
if (debug != null)
debug.discard(yyState, yyToken, yyname(yyToken),
yyLex.value());
yyToken = -1;
goto continue_yyDiscarded; // leave stack alone
}
}
int yyV = yyTop + 1-yyLen[yyN];
if (debug != null)
debug.reduce(yyState, yyStates[yyV-1], yyN, YYRules.getRule (yyN), yyLen[yyN]);
yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]);
switch (yyN) {
case 1:
#line 391 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
Lexer.check_incorrect_doc_comment ();
}
break;
case 2:
#line 394 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{ Lexer.CompleteOnEOF = false; }
break;
case 6:
#line 401 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
if (yyVals[0+yyTop] != null) {
Attributes attrs = (Attributes) yyVals[0+yyTop];
report.Error (1730, attrs.Attrs [0].Location,
"Assembly and module attributes must precede all other elements except using clauses and extern alias declarations");
}
}
break;
case 7:
#line 409 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
module.AddAttributes ((Attributes) yyVals[0+yyTop], current_namespace);
}
break;
case 8:
#line 413 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
if (yyToken == Token.EXTERN_ALIAS)
report.Error (439, lexer.Location, "An extern alias declaration must precede all other elements");
else
Error_SyntaxError (yyToken);
}
break;
case 13:
#line 433 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop];
string s = lt.Value;
if (s != "alias"){
syntax_error (lt.Location, "`alias' expected");
} else if (lang_version == LanguageVersion.ISO_1) {
FeatureIsNotAvailable (lt.Location, "external alias");
} else {
lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop];
current_namespace.AddUsingExternalAlias (lt.Value, lt.Location, report);
}
}