本文整理汇总了C#中Mono.CSharp.SimpleName类的典型用法代码示例。如果您正苦于以下问题:C# SimpleName类的具体用法?C# SimpleName怎么用?C# SimpleName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimpleName类属于Mono.CSharp命名空间,在下文中一共展示了SimpleName类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: DoResolve
public override Expression DoResolve (ResolveContext ec)
{
eclass = ExprClass.Value;
// TODO: ec.GetSignatureForError ()
ConstructorBuilder caller_builder = ((Constructor) ec.MemberContext).ConstructorBuilder;
if (argument_list != null) {
bool dynamic;
//
// Spec mandates that constructor initializer will not have `this' access
//
using (ec.Set (ResolveContext.Options.BaseInitializer)) {
argument_list.Resolve (ec, out dynamic);
}
if (dynamic) {
SimpleName ctor = new SimpleName (ConstructorBuilder.ConstructorName, loc);
return new DynamicInvocation (ctor, argument_list, loc).Resolve (ec) as ExpressionStatement;
}
}
type = ec.CurrentType;
if (this is ConstructorBaseInitializer) {
if (ec.CurrentType.BaseType == null)
return this;
type = ec.CurrentType.BaseType;
if (TypeManager.IsStruct (ec.CurrentType)) {
ec.Report.Error (522, loc,
"`{0}': Struct constructors cannot call base constructors", TypeManager.CSharpSignature (caller_builder));
return this;
}
} else {
//
// It is legal to have "this" initializers that take no arguments
// in structs, they are just no-ops.
//
// struct D { public D (int a) : this () {}
//
if (TypeManager.IsStruct (ec.CurrentType) && argument_list == null)
return this;
}
base_constructor_group = MemberLookupFinal (
ec, null, type, ConstructorBuilder.ConstructorName, MemberTypes.Constructor,
BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly,
loc) as MethodGroupExpr;
if (base_constructor_group == null)
return this;
base_constructor_group = base_constructor_group.OverloadResolve (
ec, ref argument_list, false, loc);
if (base_constructor_group == null)
return this;
if (!ec.IsStatic)
base_constructor_group.InstanceExpression = ec.GetThis (loc);
ConstructorInfo base_ctor = (ConstructorInfo)base_constructor_group;
if (base_ctor == caller_builder){
ec.Report.Error (516, loc, "Constructor `{0}' cannot call itself", TypeManager.CSharpSignature (caller_builder));
}
return this;
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:70,代码来源:class.cs
示例2: Visit
public override object Visit(SimpleName simpleName)
{
var result = new IdentifierExpression();
result.AddChild(Identifier.Create(simpleName.Name, Convert(simpleName.Location)), Roles.Identifier);
AddTypeArguments(result, simpleName);
return result;
}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:7,代码来源:CSharpParser.cs
示例3: DoResolve
protected override Expression DoResolve (ResolveContext ec)
{
Expression clone = source.Clone (new CloneContext ());
clone = clone.Resolve (ec);
if (clone == null)
return null;
//
// A useful feature for the REPL: if we can resolve the expression
// as a type, Describe the type;
//
if (ec.Module.Evaluator.DescribeTypeExpressions && !(ec.CurrentAnonymousMethod is AsyncInitializer)) {
var old_printer = ec.Report.SetPrinter (new SessionReportPrinter ());
Expression tclone;
try {
// Note: clone context cannot be shared otherwise block mapping would leak
tclone = source.Clone (new CloneContext ());
tclone = tclone.Resolve (ec, ResolveFlags.Type);
if (ec.Report.Errors > 0)
tclone = null;
} finally {
ec.Report.SetPrinter (old_printer);
}
if (tclone is TypeExpr) {
Arguments args = new Arguments (1);
args.Add (new Argument (new TypeOf ((TypeExpr) clone, Location)));
return new Invocation (new SimpleName ("Describe", Location), args).Resolve (ec);
}
}
// This means its really a statement.
if (clone.Type.Kind == MemberKind.Void || clone is DynamicInvocation || clone is Assign) {
return clone;
}
source = clone;
var host = (Method) ec.MemberContext.CurrentMemberDefinition;
if (host.ParameterInfo.IsEmpty) {
eclass = ExprClass.Value;
type = InternalType.FakeInternalType;
return this;
}
target = new SimpleName (host.ParameterInfo[0].Name, Location);
return base.DoResolve (ec);
}
开发者ID:FrancisVarga,项目名称:mono,代码行数:51,代码来源:eval.cs
示例4: case_423
void case_423()
#line 3204 "cs-parser.jay"
{
var lt = (LocatedToken) yyVals[-1+yyTop];
yyVal = new SimpleName (lt.Value, (TypeArguments)yyVals[0+yyTop], lt.Location);
}
开发者ID:segaman,项目名称:NRefactory,代码行数:6,代码来源:cs-parser.cs
示例5: case_745
void case_745()
#line 5156 "cs-parser.jay"
{
Error_SyntaxError (yyToken);
var lt =(LocatedToken) yyVals[-1+yyTop];
var sn = new SimpleName (lt.Value, lt.Location);
current_block.AddStatement(new StatementErrorExpression (sn));
yyVal = null;
}
开发者ID:segaman,项目名称:NRefactory,代码行数:9,代码来源:cs-parser.cs
示例6: Create
public static AnonymousTypeClass Create (CompilerContext ctx, TypeContainer parent, IList<AnonymousTypeParameter> parameters, Location loc)
{
string name = ClassNamePrefix + types_counter++;
SimpleName [] t_args = new SimpleName [parameters.Count];
TypeParameterName [] t_params = new TypeParameterName [parameters.Count];
Parameter [] ctor_params = new Parameter [parameters.Count];
for (int i = 0; i < parameters.Count; ++i) {
AnonymousTypeParameter p = (AnonymousTypeParameter) parameters [i];
t_args [i] = new SimpleName ("<" + p.Name + ">__T", p.Location);
t_params [i] = new TypeParameterName (t_args [i].Name, null, p.Location);
ctor_params [i] = new Parameter (t_args [i], p.Name, 0, null, p.Location);
}
//
// Create generic anonymous type host with generic arguments
// named upon properties names
//
AnonymousTypeClass a_type = new AnonymousTypeClass (parent.NamespaceEntry.SlaveDeclSpace,
new MemberName (name, new TypeArguments (t_params), loc), parameters, loc);
if (parameters.Count > 0)
a_type.SetParameterInfo (null);
Constructor c = new Constructor (a_type, name, Modifiers.PUBLIC | Modifiers.DEBUGGER_HIDDEN,
null, new AnonymousParameters (ctx, ctor_params), null, loc);
c.Block = new ToplevelBlock (ctx, c.ParameterInfo, loc);
//
// Create fields and contructor body with field initialization
//
bool error = false;
for (int i = 0; i < parameters.Count; ++i) {
AnonymousTypeParameter p = (AnonymousTypeParameter) parameters [i];
Field f = new Field (a_type, t_args [i], Modifiers.PRIVATE | Modifiers.READONLY,
new MemberName ("<" + p.Name + ">", p.Location), null);
if (!a_type.AddField (f)) {
error = true;
continue;
}
c.Block.AddStatement (new StatementExpression (
new SimpleAssign (new MemberAccess (new This (p.Location), f.Name),
c.Block.GetParameterReference (p.Name, p.Location))));
ToplevelBlock get_block = new ToplevelBlock (ctx, p.Location);
get_block.AddStatement (new Return (
new MemberAccess (new This (p.Location), f.Name), p.Location));
Property prop = new Property (a_type, t_args [i], Modifiers.PUBLIC,
new MemberName (p.Name, p.Location), null);
prop.Get = new Property.GetMethod (prop, 0, null, p.Location);
prop.Get.Block = get_block;
a_type.AddProperty (prop);
}
if (error)
return null;
a_type.AddConstructor (c);
return a_type;
}
开发者ID:pgoron,项目名称:monodevelop,代码行数:65,代码来源:anonymous.cs
示例7: case_60
void case_60()
#line 746 "cs-parser.jay"
{
Error_SyntaxError (yyToken);
var lt = (LocatedToken) yyVals[-1+yyTop];
var tne = new SimpleName (lt.Value, null, lt.Location);
yyVal = new List<Attribute> () {
new Attribute (null, tne, null, GetLocation (yyVals[-1+yyTop]), false)
};
}
开发者ID:segaman,项目名称:NRefactory,代码行数:12,代码来源:cs-parser.cs
示例8: ResolveMemberAccess
public override MemberExpr ResolveMemberAccess (EmitContext ec, Expression left, Location loc, SimpleName original)
{
constant = TypeManager.GetGenericFieldDefinition (constant);
IConstant ic = TypeManager.GetConstant (constant);
if (ic == null) {
if (constant.IsLiteral) {
ic = new ExternalConstant (constant);
} else {
ic = ExternalConstant.CreateDecimal (constant);
// HACK: decimal field was not resolved as constant
if (ic == null)
return new FieldExpr (constant, loc).ResolveMemberAccess (ec, left, loc, original);
}
TypeManager.RegisterConstant (constant, ic);
}
return base.ResolveMemberAccess (ec, left, loc, original);
}
开发者ID:lewurm,项目名称:benchmarker,代码行数:19,代码来源:ecore.cs
示例9: case_736
void case_736()
{
if (yyVals[-1+yyTop] is VarExpr)
yyVals[-1+yyTop] = new SimpleName ("var", ((VarExpr) yyVals[-1+yyTop]).Location);
yyVal = new ComposedCast ((FullNamedExpression) yyVals[-1+yyTop], (ComposedTypeSpecifier) yyVals[0+yyTop]);
}
开发者ID:animaonline,项目名称:Portable-Mono.CSharp,代码行数:7,代码来源:cs-parser.cs
示例10: MakeTypeNameExpression
public ATypeNameExpression MakeTypeNameExpression(Location loc)
{
string[] names = Name.Split(new [] {'.'});
ATypeNameExpression exp = null;
for (var i = 0; i < names.Length; i++) {
var name = names[i];
if (exp == null) {
exp = new SimpleName (name, loc);
} else {
exp = new MemberAccess(exp, name, loc);
}
}
return exp;
}
开发者ID:johnv315,项目名称:playscript-mono,代码行数:16,代码来源:namespace.cs
示例11: case_526
void case_526()
{
var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop];
yyVal = new SimpleName (lt.Value, (int) yyVals[0+yyTop], lt.Location);
}
开发者ID:animaonline,项目名称:Portable-Mono.CSharp,代码行数:6,代码来源:cs-parser.cs
示例12: case_416
void case_416()
{
var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop];
yyVal = new SimpleName (lt.Value, (TypeArguments)yyVals[0+yyTop], lt.Location);
}
开发者ID:animaonline,项目名称:Portable-Mono.CSharp,代码行数:5,代码来源:cs-parser.cs
示例13: case_352
void case_352()
{
var lt = (Tokenizer.LocatedToken) yyVals[-2+yyTop];
yyVal = new SimpleName (lt.Value, (TypeArguments) yyVals[-1+yyTop], lt.Location);
lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop]));
}
开发者ID:animaonline,项目名称:Portable-Mono.CSharp,代码行数:6,代码来源:cs-parser.cs
示例14: case_527
void case_527()
#line 3805 "cs-parser.jay"
{
var lt = (Tokenizer.LocatedToken) yyVals[-1+yyTop];
yyVal = new SimpleName (lt.Value, (int) yyVals[0+yyTop], lt.Location);
}
开发者ID:kaagati,项目名称:NRefactory,代码行数:7,代码来源:cs-parser.cs
示例15: Visit
public virtual object Visit (SimpleName simpleName)
{
return null;
}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:4,代码来源:visit.cs
示例16: ResolveMemberAccess
public override MemberExpr ResolveMemberAccess(ResolveContext ec, Expression left, Location loc,
SimpleName original)
{
//
// If the event is local to this class, we transform ourselves into a FieldExpr
//
if (spec.DeclaringType == ec.CurrentType ||
TypeManager.IsNestedChildOf(ec.CurrentType, spec.DeclaringType)) {
// TODO: Breaks dynamic binder as currect context fields are imported and not compiled
EventField mi = spec.MemberDefinition as EventField;
if (mi != null && mi.HasBackingField) {
mi.SetIsUsed ();
if (!ec.IsObsolete)
mi.CheckObsoleteness (loc);
if ((mi.ModFlags & (Modifiers.ABSTRACT | Modifiers.EXTERN)) != 0 && !ec.HasSet (ResolveContext.Options.CompoundAssignmentScope))
Error_AssignmentEventOnly (ec);
FieldExpr ml = new FieldExpr (mi.BackingField, loc);
InstanceExpression = null;
return ml.ResolveMemberAccess (ec, left, loc, original);
}
}
if (left is This && !ec.HasSet (ResolveContext.Options.CompoundAssignmentScope))
Error_AssignmentEventOnly (ec);
return base.ResolveMemberAccess (ec, left, loc, original);
}
开发者ID:speier,项目名称:shake,代码行数:34,代码来源:ecore.cs
示例17: NameOf
public NameOf (SimpleName name)
: base (name.Location)
{
this.name = name;
}
开发者ID:genoher,项目名称:mono,代码行数:5,代码来源:constant.cs
示例18: case_359
void case_359()
#line 2961 "cs-parser.jay"
{
var lt = (LocatedToken) yyVals[-2+yyTop];
yyVal = new SimpleName (lt.Value, (TypeArguments) yyVals[-1+yyTop], lt.Location);
lbag.AddLocation (yyVal, GetLocation (yyVals[0+yyTop]));
}
开发者ID:segaman,项目名称:NRefactory,代码行数:7,代码来源:cs-parser.cs
示例19: case_534
void case_534()
#line 3856 "cs-parser.jay"
{
var lt = (LocatedToken) yyVals[-1+yyTop];
var sn = new SimpleName (lt.Value, (int) yyVals[0+yyTop], lt.Location);
yyVal = sn;
lbag.AddLocation (sn.TypeArguments, Lexer.GetGenericDimensionLocations ());
}
开发者ID:segaman,项目名称:NRefactory,代码行数:9,代码来源:cs-parser.cs
示例20: case_786
void case_786()
#line 5268 "cs-parser.jay"
{
if (yyVals[-1+yyTop] is VarExpr)
yyVals[-1+yyTop] = new SimpleName ("var", ((VarExpr) yyVals[-1+yyTop]).Location);
yyVal = new ComposedCast ((FullNamedExpression) yyVals[-1+yyTop], (ComposedTypeSpecifier) yyVals[0+yyTop]);
}
开发者ID:segaman,项目名称:NRefactory,代码行数:8,代码来源:cs-parser.cs
注:本文中的Mono.CSharp.SimpleName类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论