本文整理汇总了C#中Mono.CSharp.Location类的典型用法代码示例。如果您正苦于以下问题:C# Location类的具体用法?C# Location怎么用?C# Location使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Location类属于Mono.CSharp命名空间,在下文中一共展示了Location类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: DefineInitializedData
public FieldSpec DefineInitializedData (byte[] data, Location loc)
{
Struct size_type;
if (!size_types.TryGetValue (data.Length, out size_type)) {
//
// Build common type for this data length. We cannot use
// DefineInitializedData because it creates public type,
// and its name is not unique among modules
//
size_type = new Struct (this, new MemberName ("$ArrayType=" + data.Length, loc), Modifiers.PRIVATE | Modifiers.COMPILER_GENERATED, null);
size_type.CreateContainer ();
size_type.DefineContainer ();
size_types.Add (data.Length, size_type);
// It has to work even if StructLayoutAttribute does not exist
size_type.TypeBuilder.__SetLayout (1, data.Length);
}
var name = "$field-" + fields.ToString ("X");
++fields;
const Modifiers fmod = Modifiers.STATIC | Modifiers.INTERNAL;
var fbuilder = TypeBuilder.DefineField (name, size_type.CurrentType.GetMetaInfo (), ModifiersExtensions.FieldAttr (fmod) | FieldAttributes.HasFieldRVA);
fbuilder.__SetDataAndRVA (data);
return new FieldSpec (CurrentType, null, size_type.CurrentType, fbuilder, fmod);
}
开发者ID:nobled,项目名称:mono,代码行数:27,代码来源:module.cs
示例2: CreateDelegateType
public static TypeSpec CreateDelegateType (ResolveContext rc, AParametersCollection parameters, TypeSpec returnType, Location loc)
{
Namespace type_ns = rc.Module.GlobalRootNamespace.GetNamespace ("System", true);
if (type_ns == null) {
return null;
}
if (returnType == rc.BuiltinTypes.Void) {
var actArgs = parameters.Types;
var actionSpec = type_ns.LookupType (rc.Module, "Action", actArgs.Length, LookupMode.Normal, loc).ResolveAsType(rc);
if (actionSpec == null) {
return null;
}
if (actArgs.Length == 0)
return actionSpec;
else
return actionSpec.MakeGenericType(rc, actArgs);
} else {
TypeSpec[] funcArgs = new TypeSpec[parameters.Types.Length + 1];
parameters.Types.CopyTo(funcArgs, 0);
funcArgs[parameters.Types.Length] = returnType;
var funcSpec = type_ns.LookupType (rc.Module, "Func", funcArgs.Length, LookupMode.Normal, loc).ResolveAsType(rc);
if (funcSpec == null)
return null;
return funcSpec.MakeGenericType(rc, funcArgs);
}
}
开发者ID:OpenFlex,项目名称:playscript-mono,代码行数:26,代码来源:delegate.cs
示例3: LookupTypeReflection
public virtual Type LookupTypeReflection (CompilerContext ctx, string name, Location loc, bool must_be_unique)
{
Type found_type = null;
foreach (Assembly a in referenced_assemblies) {
Type t = GetTypeInAssembly (a, name);
if (t == null)
continue;
if (!must_be_unique)
return t;
if (found_type == null) {
found_type = t;
continue;
}
// When type is forwarded
if (t.Assembly == found_type.Assembly)
continue;
ctx.Report.SymbolRelatedToPreviousError (found_type);
ctx.Report.SymbolRelatedToPreviousError (t);
if (loc.IsNull) {
Error_AmbiguousPredefinedType (ctx, loc, name, found_type);
} else {
ctx.Report.Error (433, loc, "The imported type `{0}' is defined multiple times", name);
}
return found_type;
}
return found_type;
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:34,代码来源:namespace.cs
示例4: CreateBranching
public static FlowBranching CreateBranching (FlowBranching parent, BranchingType type, Block block, Location loc)
{
switch (type) {
case BranchingType.Exception:
case BranchingType.Labeled:
case BranchingType.Toplevel:
case BranchingType.TryCatch:
throw new InvalidOperationException ();
case BranchingType.Switch:
return new FlowBranchingBreakable (parent, type, SiblingType.SwitchSection, block, loc);
case BranchingType.Block:
return new FlowBranchingBlock (parent, type, SiblingType.Block, block, loc);
case BranchingType.Loop:
return new FlowBranchingBreakable (parent, type, SiblingType.Conditional, block, loc);
case BranchingType.Embedded:
return new FlowBranchingContinuable (parent, type, SiblingType.Conditional, block, loc);
default:
return new FlowBranchingBlock (parent, type, SiblingType.Conditional, block, loc);
}
}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:25,代码来源:flowanalysis.cs
示例5: DynamicTypeExpr
public DynamicTypeExpr (Location loc)
{
this.loc = loc;
type = InternalType.Dynamic;
eclass = ExprClass.Type;
}
开发者ID:tgiphil,项目名称:mono,代码行数:7,代码来源:dynamic.cs
示例6: MemberName
public MemberName (string name, TypeParameters tparams, Location loc)
{
this.Name = name;
this.Location = loc;
this.TypeParameters = tparams;
}
开发者ID:johnluetke,项目名称:mono,代码行数:7,代码来源:decl.cs
示例7: MemberName
private MemberName (MemberName left, string name, bool is_double_colon,
TypeArguments args, Location loc)
: this (left, name, is_double_colon, loc)
{
if (args != null && args.Count > 0)
this.TypeArguments = args;
}
开发者ID:constructor-igor,项目名称:cudafy,代码行数:7,代码来源:decl.cs
示例8: FeatureIsNotAvailable
public void FeatureIsNotAvailable (CompilerContext compiler, Location loc, string feature)
{
string version;
switch (compiler.Settings.Version) {
case LanguageVersion.ISO_1:
version = "1.0";
break;
case LanguageVersion.ISO_2:
version = "2.0";
break;
case LanguageVersion.V_3:
version = "3.0";
break;
case LanguageVersion.V_4:
version = "4.0";
break;
case LanguageVersion.V_5:
version = "5.0";
break;
default:
throw new InternalErrorException ("Invalid feature version", compiler.Settings.Version);
}
Error (1644, loc,
"Feature `{0}' cannot be used because it is not part of the C# {1} language specification",
feature, version);
}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:27,代码来源:report.cs
示例9: ExplicitConversion
/// <summary>
/// Performs an explicit conversion of the expression `expr' whose
/// type is expr.Type to `target_type'.
/// </summary>
public static Expression ExplicitConversion(ResolveContext ec, Expression expr,
TypeSpec target_type, Location loc)
{
Expression e = ExplicitConversionCore (ec, expr, target_type, loc);
if (e != null) {
//
// Don't eliminate explicit precission casts
//
if (e == expr) {
if (target_type.BuiltinType == BuiltinTypeSpec.Type.Float)
return new OpcodeCast (expr, target_type, OpCodes.Conv_R4);
if (target_type.BuiltinType == BuiltinTypeSpec.Type.Double)
return new OpcodeCast (expr, target_type, OpCodes.Conv_R8);
}
return e;
}
TypeSpec expr_type = expr.Type;
if (target_type.IsNullableType) {
TypeSpec target;
if (expr_type.IsNullableType) {
target = Nullable.NullableInfo.GetUnderlyingType (target_type);
Expression unwrap = Nullable.Unwrap.Create (expr);
e = ExplicitConversion (ec, unwrap, target, expr.Location);
if (e == null)
return null;
return new Nullable.LiftedConversion (e, unwrap, target_type).Resolve (ec);
}
if (expr_type.BuiltinType == BuiltinTypeSpec.Type.Object) {
return new UnboxCast (expr, target_type);
}
target = TypeManager.GetTypeArguments (target_type) [0];
e = ExplicitConversionCore (ec, expr, target, loc);
if (e != null)
return TypeSpec.IsReferenceType (expr.Type) ? new UnboxCast (expr, target_type) : Nullable.Wrap.Create (e, target_type);
} else if (expr_type.IsNullableType) {
e = ImplicitBoxingConversion (expr, Nullable.NullableInfo.GetUnderlyingType (expr_type), target_type);
if (e != null)
return e;
e = Nullable.Unwrap.Create (expr, false);
e = ExplicitConversionCore (ec, e, target_type, loc);
if (e != null)
return EmptyCast.Create (e, target_type);
}
e = ExplicitUserConversion (ec, expr, target_type, loc);
if (e != null)
return e;
expr.Error_ValueCannotBeConverted (ec, target_type, true);
return null;
}
开发者ID:exodrifter,项目名称:mcs-ICodeCompiler,代码行数:63,代码来源:convert.cs
示例10: Const
public Const (DeclSpace parent, FullNamedExpression type, string name,
Expression expr, int mod_flags, Attributes attrs, Location loc)
: base (parent, type, mod_flags, AllowedModifiers,
new MemberName (name, loc), attrs)
{
initializer = expr;
ModFlags |= Modifiers.STATIC;
}
开发者ID:lewurm,项目名称:benchmarker,代码行数:8,代码来源:const.cs
示例11: BoolConstant
public BoolConstant(TypeSpec type, bool val, Location loc)
: base(loc)
{
eclass = ExprClass.Value;
this.type = type;
Value = val;
}
开发者ID:exodrifter,项目名称:mcs-ICodeCompiler,代码行数:8,代码来源:constant.cs
示例12: Accessor
public Accessor(ToplevelBlock b, Modifiers mod, Attributes attrs, ParametersCompiled p, Location loc)
{
Block = b;
Attributes = attrs;
Location = loc;
Parameters = p;
ModFlags = ModifiersExtensions.Check (AllowedModifiers, mod, 0, loc, RootContext.ToplevelTypes.Compiler.Report);
}
开发者ID:speier,项目名称:shake,代码行数:8,代码来源:property.cs
示例13: MemberName
public MemberName (string name, TypeArguments args, Location loc)
{
this.Name = name;
this.Location = loc;
if (args != null && args.Count > 0)
this.TypeArguments = args;
}
开发者ID:Tenere,项目名称:mono,代码行数:8,代码来源:decl.cs
示例14: ImplicitConversionRequired
public Constant ImplicitConversionRequired (ResolveContext ec, TypeSpec type, Location loc)
{
Constant c = ConvertImplicitly (type);
if (c == null)
Error_ValueCannotBeConverted (ec, type, false);
return c;
}
开发者ID:rabink,项目名称:mono,代码行数:8,代码来源:constant.cs
示例15: ReturnParameter
public ReturnParameter (MethodBuilder mb, Location location)
{
try {
builder = mb.DefineParameter (0, ParameterAttributes.None, "");
}
catch (ArgumentOutOfRangeException) {
RootContext.ToplevelTypes.Compiler.Report.RuntimeMissingSupport (location, "custom attributes on the return type");
}
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:9,代码来源:parameter.cs
示例16: EnumMember
public EnumMember (Enum parent, EnumMember prev_member, string name, Expression expr,
Attributes attrs, Location loc)
: base (parent, new EnumTypeExpr (parent), name, expr, Modifiers.PUBLIC,
attrs, loc)
{
this.ParentEnum = parent;
this.ValueExpr = expr;
this.prev_member = prev_member;
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:9,代码来源:enum.cs
示例17: StaticCallExpr
public StaticCallExpr (MethodInfo m, ArrayList a, Location l)
{
mi = m;
args = a;
type = m.ReturnType;
eclass = ExprClass.Value;
loc = l;
}
开发者ID:emtees,项目名称:old-code,代码行数:9,代码来源:expression.cs
示例18: ExplicitConversion
/// <summary>
/// Performs an explicit conversion of the expression `expr' whose
/// type is expr.Type to `target_type'.
/// </summary>
public static Expression ExplicitConversion(ResolveContext ec, Expression expr,
TypeSpec target_type, Location loc)
{
Expression e = ExplicitConversionCore (ec, expr, target_type, loc);
if (e != null) {
//
// Don't eliminate explicit precission casts
//
if (e == expr) {
if (target_type == TypeManager.float_type)
return new OpcodeCast (expr, target_type, OpCodes.Conv_R4);
if (target_type == TypeManager.double_type)
return new OpcodeCast (expr, target_type, OpCodes.Conv_R8);
}
return e;
}
TypeSpec expr_type = expr.Type;
if (TypeManager.IsNullableType (target_type)) {
if (TypeManager.IsNullableType (expr_type)) {
TypeSpec target = Nullable.NullableInfo.GetUnderlyingType (target_type);
Expression unwrap = Nullable.Unwrap.Create (expr);
e = ExplicitConversion (ec, unwrap, target, expr.Location);
if (e == null)
return null;
return new Nullable.Lifted (e, unwrap, target_type).Resolve (ec);
} else if (expr_type == TypeManager.object_type) {
return new UnboxCast (expr, target_type);
} else {
TypeSpec target = TypeManager.GetTypeArguments (target_type) [0];
e = ExplicitConversionCore (ec, expr, target, loc);
if (e != null)
return Nullable.Wrap.Create (e, target_type);
}
} else if (TypeManager.IsNullableType (expr_type)) {
bool use_class_cast;
if (ImplicitBoxingConversionExists (Nullable.NullableInfo.GetUnderlyingType (expr_type), target_type, out use_class_cast))
return new BoxedCast (expr, target_type);
e = Nullable.Unwrap.Create (expr, false);
e = ExplicitConversionCore (ec, e, target_type, loc);
if (e != null)
return EmptyCast.Create (e, target_type);
}
e = ExplicitUserConversion (ec, expr, target_type, loc);
if (e != null)
return e;
expr.Error_ValueCannotBeConverted (ec, loc, target_type, true);
return null;
}
开发者ID:speier,项目名称:shake,代码行数:60,代码来源:convert.cs
示例19: Error_InvalidConstantType
public static void Error_InvalidConstantType(TypeSpec t, Location loc, Report Report)
{
if (t.IsGenericParameter) {
Report.Error (1959, loc,
"Type parameter `{0}' cannot be declared const", TypeManager.CSharpName (t));
} else {
Report.Error (283, loc,
"The type `{0}' cannot be declared const", TypeManager.CSharpName (t));
}
}
开发者ID:speier,项目名称:shake,代码行数:10,代码来源:const.cs
示例20: ReturnParameter
// TODO: merge method and mb
public ReturnParameter (MemberCore method, MethodBuilder mb, Location location)
{
this.method = method;
try {
builder = mb.DefineParameter (0, ParameterAttributes.None, "");
}
catch (ArgumentOutOfRangeException) {
method.Compiler.Report.RuntimeMissingSupport (location, "custom attributes on the return type");
}
}
开发者ID:bl8,项目名称:mono,代码行数:11,代码来源:parameter.cs
注:本文中的Mono.CSharp.Location类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论