public Enum(NamespaceContainer ns, DeclSpace parent, TypeExpression type, Modifiers mod_flags, MemberName name, Attributes attrs) : base(ns, parent, name, attrs, MemberKind.Enum) { underlying_type_expr = type; var accmods = IsTopLevel ? Modifiers.INTERNAL : Modifiers.PRIVATE; ModFlags = ModifiersExtensions.Check (AllowedModifiers, mod_flags, accmods, Location, Report); spec = new EnumSpec (null, this, null, null, ModFlags); }
/// <summary> /// Defines the constant in the @parent /// </summary> public override bool Define () { if (!base.Define ()) return false; if (!member_type.IsConstantCompatible) { Error_InvalidConstantType (member_type, Location, Report); } FieldAttributes field_attr = FieldAttributes.Static | ModifiersExtensions.FieldAttr (ModFlags); // Decimals cannot be emitted into the constant blob. So, convert to 'readonly'. if (member_type.BuiltinType == BuiltinTypeSpec.Type.Decimal) { field_attr |= FieldAttributes.InitOnly; } else { field_attr |= FieldAttributes.Literal; } FieldBuilder = Parent.TypeBuilder.DefineField (Name, MemberType.GetMetaInfo (), field_attr); spec = new ConstSpec (Parent.Definition, this, MemberType, FieldBuilder, ModFlags, initializer); Parent.MemberCache.AddMember (spec); if ((field_attr & FieldAttributes.InitOnly) != 0) Parent.PartialContainer.RegisterFieldForInitialization (this, new FieldInitializer (this, initializer, Location)); if (declarators != null) { foreach (var d in declarators) { var t = new TypeExpression (d.Type, TypeExpression.Location); var c = new Const (Parent, t, ModFlags & ~Modifiers.STATIC, new MemberName (d.Name.Value, d.Name.Location), OptAttributes); c.initializer = d.Initializer; if (d.Initializer is ConstInitializer) ((ConstInitializer)d.Initializer).Field = c; ((ConstInitializer) c.initializer).Name = d.Name.Value; c.Define (); Parent.PartialContainer.Members.Add (c); } } return true; }
public Field AddCapturedVariable (string name, TypeSpec type) { CheckMembersDefined (); FullNamedExpression field_type = new TypeExpression (type, Location); if (!spec.IsGenericOrParentIsGeneric) return AddCompilerGeneratedField (name, field_type); const Modifiers mod = Modifiers.INTERNAL | Modifiers.COMPILER_GENERATED; Field f = new HoistedField (this, field_type, mod, name, null, Location); AddField (f); return f; }
protected override bool DoDefineMembers () { if (!base.DoDefineMembers ()) return false; Location loc = Location; var equals_parameters = ParametersCompiled.CreateFullyResolved ( new Parameter (new TypeExpression (Compiler.BuiltinTypes.Object, loc), "obj", 0, null, loc), Compiler.BuiltinTypes.Object); Method equals = new Method (this, new TypeExpression (Compiler.BuiltinTypes.Bool, loc), Modifiers.PUBLIC | Modifiers.OVERRIDE | Modifiers.DEBUGGER_HIDDEN, new MemberName ("Equals", loc), equals_parameters, null); equals_parameters[0].Resolve (equals, 0); Method tostring = new Method (this, new TypeExpression (Compiler.BuiltinTypes.String, loc), Modifiers.PUBLIC | Modifiers.OVERRIDE | Modifiers.DEBUGGER_HIDDEN, new MemberName ("ToString", loc), Mono.CSharp.ParametersCompiled.EmptyReadOnlyParameters, null); ToplevelBlock equals_block = new ToplevelBlock (Compiler, equals.ParameterInfo, loc); TypeExpr current_type; if (CurrentTypeParameters != null) { var targs = new TypeArguments (); for (int i = 0; i < CurrentTypeParameters.Count; ++i) { targs.Add (new TypeParameterExpr (CurrentTypeParameters[i], Location)); } current_type = new GenericTypeExpr (Definition, targs, loc); } else { current_type = new TypeExpression (Definition, loc); } var li_other = LocalVariable.CreateCompilerGenerated (CurrentType, equals_block, loc); equals_block.AddStatement (new BlockVariableDeclaration (new TypeExpression (li_other.Type, loc), li_other)); var other_variable = new LocalVariableReference (li_other, loc); MemberAccess system_collections_generic = new MemberAccess (new MemberAccess ( new QualifiedAliasMember ("global", "System", loc), "Collections", loc), "Generic", loc); Expression rs_equals = null; Expression string_concat = new StringConstant (Compiler.BuiltinTypes, "{", loc); Expression rs_hashcode = new IntConstant (Compiler.BuiltinTypes, -2128831035, loc); for (int i = 0; i < parameters.Count; ++i) { var p = parameters [i]; var f = (Field) Members [i * 2]; MemberAccess equality_comparer = new MemberAccess (new MemberAccess ( system_collections_generic, "EqualityComparer", new TypeArguments (new SimpleName (CurrentTypeParameters [i].Name, loc)), loc), "Default", loc); Arguments arguments_equal = new Arguments (2); arguments_equal.Add (new Argument (new MemberAccess (new This (f.Location), f.Name))); arguments_equal.Add (new Argument (new MemberAccess (other_variable, f.Name))); Expression field_equal = new Invocation (new MemberAccess (equality_comparer, "Equals", loc), arguments_equal); Arguments arguments_hashcode = new Arguments (1); arguments_hashcode.Add (new Argument (new MemberAccess (new This (f.Location), f.Name))); Expression field_hashcode = new Invocation (new MemberAccess (equality_comparer, "GetHashCode", loc), arguments_hashcode); IntConstant FNV_prime = new IntConstant (Compiler.BuiltinTypes, 16777619, loc); rs_hashcode = new Binary (Binary.Operator.Multiply, new Binary (Binary.Operator.ExclusiveOr, rs_hashcode, field_hashcode), FNV_prime); Expression field_to_string = new Conditional (new BooleanExpression (new Binary (Binary.Operator.Inequality, new MemberAccess (new This (f.Location), f.Name), new NullLiteral (loc))), new Invocation (new MemberAccess ( new MemberAccess (new This (f.Location), f.Name), "ToString"), null), new StringConstant (Compiler.BuiltinTypes, string.Empty, loc), loc); if (rs_equals == null) { rs_equals = field_equal; string_concat = new Binary (Binary.Operator.Addition, string_concat, new Binary (Binary.Operator.Addition, new StringConstant (Compiler.BuiltinTypes, " " + p.Name + " = ", loc), field_to_string)); continue; } // // Implementation of ToString () body using string concatenation // string_concat = new Binary (Binary.Operator.Addition, new Binary (Binary.Operator.Addition, string_concat, new StringConstant (Compiler.BuiltinTypes, ", " + p.Name + " = ", loc)), field_to_string); rs_equals = new Binary (Binary.Operator.LogicalAnd, rs_equals, field_equal); } string_concat = new Binary (Binary.Operator.Addition, string_concat, new StringConstant (Compiler.BuiltinTypes, " }", loc)); // // Equals (object obj) override // var other_variable_assign = new TemporaryVariableReference (li_other, loc); equals_block.AddStatement (new StatementExpression ( new SimpleAssign (other_variable_assign, new As (equals_block.GetParameterReference (0, loc), current_type, loc), loc))); Expression equals_test = new Binary (Binary.Operator.Inequality, other_variable, new NullLiteral (loc)); if (rs_equals != null) equals_test = new Binary (Binary.Operator.LogicalAnd, equals_test, rs_equals); equals_block.AddStatement (new Return (equals_test, loc)); equals.Block = equals_block; equals.Define (); Members.Add (equals); // // GetHashCode () override // Method hashcode = new Method (this, new TypeExpression (Compiler.BuiltinTypes.Int, loc), Modifiers.PUBLIC | Modifiers.OVERRIDE | Modifiers.DEBUGGER_HIDDEN, new MemberName ("GetHashCode", loc), Mono.CSharp.ParametersCompiled.EmptyReadOnlyParameters, null); // // Modified FNV with good avalanche behavior and uniform // distribution with larger hash sizes. // // const int FNV_prime = 16777619; // int hash = (int) 2166136261; // foreach (int d in data) // hash = (hash ^ d) * FNV_prime; // hash += hash << 13; // hash ^= hash >> 7; // hash += hash << 3; // hash ^= hash >> 17; // hash += hash << 5; ToplevelBlock hashcode_top = new ToplevelBlock (Compiler, loc); Block hashcode_block = new Block (hashcode_top, loc, loc); hashcode_top.AddStatement (new Unchecked (hashcode_block, loc)); var li_hash = LocalVariable.CreateCompilerGenerated (Compiler.BuiltinTypes.Int, hashcode_top, loc); hashcode_block.AddStatement (new BlockVariableDeclaration (new TypeExpression (li_hash.Type, loc), li_hash)); LocalVariableReference hash_variable_assign = new LocalVariableReference (li_hash, loc); hashcode_block.AddStatement (new StatementExpression ( new SimpleAssign (hash_variable_assign, rs_hashcode))); var hash_variable = new LocalVariableReference (li_hash, loc); hashcode_block.AddStatement (new StatementExpression ( new CompoundAssign (Binary.Operator.Addition, hash_variable, new Binary (Binary.Operator.LeftShift, hash_variable, new IntConstant (Compiler.BuiltinTypes, 13, loc))))); hashcode_block.AddStatement (new StatementExpression ( new CompoundAssign (Binary.Operator.ExclusiveOr, hash_variable, new Binary (Binary.Operator.RightShift, hash_variable, new IntConstant (Compiler.BuiltinTypes, 7, loc))))); hashcode_block.AddStatement (new StatementExpression ( new CompoundAssign (Binary.Operator.Addition, hash_variable, new Binary (Binary.Operator.LeftShift, hash_variable, new IntConstant (Compiler.BuiltinTypes, 3, loc))))); hashcode_block.AddStatement (new StatementExpression ( new CompoundAssign (Binary.Operator.ExclusiveOr, hash_variable, new Binary (Binary.Operator.RightShift, hash_variable, new IntConstant (Compiler.BuiltinTypes, 17, loc))))); hashcode_block.AddStatement (new StatementExpression ( new CompoundAssign (Binary.Operator.Addition, hash_variable, new Binary (Binary.Operator.LeftShift, hash_variable, new IntConstant (Compiler.BuiltinTypes, 5, loc))))); hashcode_block.AddStatement (new Return (hash_variable, loc)); hashcode.Block = hashcode_top; hashcode.Define (); Members.Add (hashcode); // // ToString () override // ToplevelBlock tostring_block = new ToplevelBlock (Compiler, loc); tostring_block.AddStatement (new Return (string_concat, loc)); tostring.Block = tostring_block; tostring.Define (); Members.Add (tostring); return true; }
public override bool Define () { if (!base.Define ()) return false; MetaType[] required_modifier = null; if ((ModFlags & Modifiers.VOLATILE) != 0) { var mod = Module.PredefinedTypes.IsVolatile.Resolve (); if (mod != null) required_modifier = new MetaType[] { mod.GetMetaInfo () }; } FieldBuilder = Parent.TypeBuilder.DefineField ( Name, member_type.GetMetaInfo (), required_modifier, null, ModifiersExtensions.FieldAttr (ModFlags)); spec = new FieldSpec (Parent.Definition, this, MemberType, FieldBuilder, ModFlags); // // Don't cache inaccessible fields except for struct where we // need them for definitive assignment checks // if ((ModFlags & Modifiers.BACKING_FIELD) == 0 || Parent.Kind == MemberKind.Struct) { Parent.MemberCache.AddMember (spec); } if (initializer != null) { ((TypeContainer) Parent).RegisterFieldForInitialization (this, new FieldInitializer (spec, initializer, this)); } if (declarators != null) { var t = new TypeExpression (MemberType, TypeExpression.Location); int index = Parent.PartialContainer.Fields.IndexOf (this); foreach (var d in declarators) { var f = new Field (Parent, t, ModFlags, new MemberName (d.Name.Value, d.Name.Location), OptAttributes); if (d.Initializer != null) f.initializer = d.Initializer; Parent.PartialContainer.Fields.Insert (++index, f); } } return true; }
// // Public function used to locate types. // // Returns: Type or null if they type can not be found. // public override FullNamedExpression LookupNamespaceOrType (string name, int arity, LookupMode mode, Location loc) { FullNamedExpression e; if (arity == 0 && Cache.TryGetValue (name, out e) && mode != LookupMode.IgnoreAccessibility) return e; e = null; if (arity == 0) { var tp = CurrentTypeParameters; if (tp != null) { TypeParameter tparam = tp.Find (name); if (tparam != null) e = new TypeParameterExpr (tparam, Location.Null); } } if (e == null) { TypeSpec t = LookupNestedTypeInHierarchy (name, arity); if (t != null && (t.IsAccessible (this) || mode == LookupMode.IgnoreAccessibility)) e = new TypeExpression (t, Location.Null); else { var errors = Compiler.Report.Errors; e = Parent.LookupNamespaceOrType (name, arity, mode, loc); // TODO: LookupNamespaceOrType does more than just lookup. The result // cannot be cached or the error reporting won't happen if (errors != Compiler.Report.Errors) return e; } } // TODO MemberCache: How to cache arity stuff ? if (arity == 0 && mode == LookupMode.Normal) Cache[name] = e; return e; }
public override object Visit (TypeExpression typeExpression) { var result = new FullTypeName (); if (typeExpression.Type != null) { result.AddChild (new Identifier (typeExpression.Type.Name, Convert (typeExpression.Location))); } // if (!string.IsNullOrEmpty (typeExpression.)) { // result.AddChild (new Identifier (typeExpression.Namespace + "." + typeExpression.Name, Convert (typeExpression.Location))); // } else { // result.AddChild (new Identifier (typeExpression.Name, Convert (typeExpression.Location))); // } return result; }
TypeExpr CreateSiteType(CompilerContext ctx, Arguments arguments, int dyn_args_count, bool is_statement) { int default_args = is_statement ? 1 : 2; bool has_ref_out_argument = false; FullNamedExpression[] targs = new FullNamedExpression[dyn_args_count + default_args]; targs [0] = new TypeExpression (TypeManager.call_site_type, loc); for (int i = 0; i < dyn_args_count; ++i) { TypeSpec arg_type; Argument a = arguments [i]; if (a.Type == TypeManager.null_type) arg_type = TypeManager.object_type; else arg_type = a.Type; if (a.ArgType == Argument.AType.Out || a.ArgType == Argument.AType.Ref) has_ref_out_argument = true; targs [i + 1] = new TypeExpression (arg_type, loc); } TypeExpr del_type = null; if (!has_ref_out_argument) { string d_name = is_statement ? "Action" : "Func"; TypeSpec t = TypeManager.CoreLookupType (ctx, "System", d_name, dyn_args_count + default_args, MemberKind.Delegate, false); if (t != null) { if (!is_statement) targs [targs.Length - 1] = new TypeExpression (type, loc); del_type = new GenericTypeExpr (t, new TypeArguments (targs), loc); } } // // Create custom delegate when no appropriate predefined one is found // if (del_type == null) { TypeSpec rt = is_statement ? TypeManager.void_type : type; Parameter[] p = new Parameter [dyn_args_count + 1]; p[0] = new Parameter (targs [0], "p0", Parameter.Modifier.NONE, null, loc); for (int i = 1; i < dyn_args_count + 1; ++i) p[i] = new Parameter (targs[i], "p" + i.ToString ("X"), arguments[i - 1].Modifier, null, loc); TypeContainer parent = CreateSiteContainer (); Delegate d = new Delegate (parent.NamespaceEntry, parent, new TypeExpression (rt, loc), Modifiers.INTERNAL | Modifiers.COMPILER_GENERATED, new MemberName ("Container" + container_counter++.ToString ("X")), new ParametersCompiled (ctx, p), null); d.CreateType (); d.DefineType (); d.Define (); d.Emit (); parent.AddDelegate (d); del_type = new TypeExpression (d.Definition, loc); } TypeExpr site_type = new GenericTypeExpr (TypeManager.generic_call_site_type, new TypeArguments (del_type), loc); return site_type; }
void case_792() #line 5340 "cs-parser.jay" { Expression.Error_VoidInvalidInTheContext (GetLocation (yyVals[0+yyTop]), report); yyVal = new TypeExpression (compiler.BuiltinTypes.Void, GetLocation (yyVals[0+yyTop])); }
void case_376() #line 3076 "cs-parser.jay" { report.Error (1536, GetLocation (yyVals[0+yyTop]), "Invalid parameter type `void'"); yyVal = new TypeExpression (compiler.BuiltinTypes.Void, GetLocation (yyVals[0+yyTop])); }
void case_240() #line 2104 "cs-parser.jay" { report.Error (590, GetLocation (yyVals[0+yyTop]), "User-defined operators cannot return void"); yyVal = new TypeExpression (compiler.BuiltinTypes.Void, GetLocation (yyVals[0+yyTop])); }
/** the generated parser. Maintains a state and a value stack, currently with fixed maximum size. @param yyLex scanner. @return result of the last reduction, if any. @throws yyException on irrecoverable parse error. */ internal Object yyparse (yyParser.yyInput yyLex) { if (yyMax <= 0) yyMax = 256; // initial size int yyState = 0; // state stack ptr int [] yyStates; // state stack yyVal = null; yyToken = -1; int yyErrorFlag = 0; // #tks to shift if (use_global_stacks && global_yyStates != null) { yyVals = global_yyVals; yyStates = global_yyStates; } else { yyVals = new object [yyMax]; yyStates = new int [yyMax]; if (use_global_stacks) { global_yyVals = yyVals; global_yyStates = yyStates; } } /*yyLoop:*/ for (yyTop = 0;; ++ yyTop) { if (yyTop >= yyStates.Length) { // dynamically increase global::System.Array.Resize (ref yyStates, yyStates.Length+yyMax); global::System.Array.Resize (ref yyVals, yyVals.Length+yyMax); } yyStates[yyTop] = yyState; yyVals[yyTop] = yyVal; //t if (debug != null) debug.push(yyState, yyVal); /*yyDiscarded:*/ while (true) { // discarding a token does not change stack int yyN; if ((yyN = yyDefRed[yyState]) == 0) { // else [default] reduce (yyN) if (yyToken < 0) { yyToken = yyLex.advance() ? yyLex.token() : 0; //t if (debug != null) //t debug.lex(yyState, yyToken, yyname(yyToken), yyLex.value()); } if ((yyN = yySindex[yyState]) != 0 && ((yyN += yyToken) >= 0) && (yyN < yyTable.Length) && (yyCheck[yyN] == yyToken)) { //t if (debug != null) //t debug.shift(yyState, yyTable[yyN], yyErrorFlag-1); yyState = yyTable[yyN]; // shift to yyN yyVal = yyLex.value(); yyToken = -1; if (yyErrorFlag > 0) -- yyErrorFlag; goto continue_yyLoop; } if ((yyN = yyRindex[yyState]) != 0 && (yyN += yyToken) >= 0 && yyN < yyTable.Length && yyCheck[yyN] == yyToken) yyN = yyTable[yyN]; // reduce (yyN) else switch (yyErrorFlag) { case 0: yyExpectingState = yyState; // yyerror(String.Format ("syntax error, got token `{0}'", yyname (yyToken)), yyExpecting(yyState)); //t if (debug != null) debug.error("syntax error"); if (yyToken == 0 /*eof*/ || yyToken == eof_token) throw new yyParser.yyUnexpectedEof (); goto case 1; case 1: case 2: yyErrorFlag = 3; do { if ((yyN = yySindex[yyStates[yyTop]]) != 0 && (yyN += Token.yyErrorCode) >= 0 && yyN < yyTable.Length && yyCheck[yyN] == Token.yyErrorCode) { //t if (debug != null) //t debug.shift(yyStates[yyTop], yyTable[yyN], 3); yyState = yyTable[yyN]; yyVal = yyLex.value(); goto continue_yyLoop; } //t if (debug != null) debug.pop(yyStates[yyTop]); } while (-- yyTop >= 0); //t if (debug != null) debug.reject(); throw new yyParser.yyException("irrecoverable syntax error"); case 3: if (yyToken == 0) { //t if (debug != null) debug.reject(); throw new yyParser.yyException("irrecoverable syntax error at end-of-file"); } //t if (debug != null) //t debug.discard(yyState, yyToken, yyname(yyToken), //t yyLex.value()); yyToken = -1; goto continue_yyDiscarded; // leave stack alone } } int yyV = yyTop + 1-yyLen[yyN]; //t if (debug != null) //t debug.reduce(yyState, yyStates[yyV-1], yyN, YYRules.getRule (yyN), yyLen[yyN]); yyVal = yyV > yyTop ? null : yyVals[yyV]; // yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]); switch (yyN) { case 1: #line 386 "cs-parser.jay" { Lexer.check_incorrect_doc_comment (); } break; case 2: #line 387 "cs-parser.jay" { Lexer.CompleteOnEOF = false; } break; case 6: case_6(); break; case 7: #line 406 "cs-parser.jay" { module.AddAttributes ((Attributes) yyVals[0+yyTop], current_namespace); } break; case 8: case_8(); break; case 13: case_13(); break; case 14: #line 451 "cs-parser.jay" { Error_SyntaxError (yyToken); } break; case 17: case_17(); break; case 18: case_18(); break; case 19: case_19(); break; case 20: case_20(); break; case 21: case_21(); break; case 22: case_22(); break; case 23: case_23(); break; case 24: case_24(); break; case 27: case_27(); break; case 28: case_28(); break; case 29: case_29(); break; case 30: case_30(); break; case 43: case_43(); break; case 44: #line 635 "cs-parser.jay" { current_namespace.DeclarationFound = true; } break; case 45: case_45(); break; case 53: case_53(); break; case 54: case_54(); break; case 55: case_55(); break; case 56: case_56(); break; case 57: case_57(); break; case 58: case_58(); break; case 59: case_59(); break; case 60: case_60(); break; case 61: case_61(); break; case 62: case_62(); break; case 63: #line 770 "cs-parser.jay" { yyVal = "event"; savedCloseLocation = GetLocation (yyVals[0+yyTop]); } break; case 64: #line 771 "cs-parser.jay" { yyVal = "return"; savedCloseLocation = GetLocation (yyVals[0+yyTop]); } break; case 65: #line 778 "cs-parser.jay" { yyVal = new List<Attribute> (4) { (Attribute) yyVals[0+yyTop] }; } break; case 66: case_66(); break; case 67: #line 795 "cs-parser.jay" { ++lexer.parsing_block; } break; case 68: case_68(); break; case 70: #line 823 "cs-parser.jay" { yyVal = null; HadAttributeParens = false; } break; case 71: case_71(); break; case 72: #line 835 "cs-parser.jay" { yyVal = null; } break; case 73: case_73(); break; case 74: case_74(); break; case 75: case_75(); break; case 76: case_76(); break; case 77: #line 879 "cs-parser.jay" { yyVal = new Argument ((Expression) yyVals[0+yyTop]); } break; case 79: case_79(); break; case 80: #line 892 "cs-parser.jay" { ++lexer.parsing_block; } break; case 81: case_81(); break; case 82: case_82(); break; case 83: #line 918 "cs-parser.jay" { yyVal = null; } break; case 84: #line 922 "cs-parser.jay" { yyVal = Argument.AType.Ref; } break; case 85: #line 926 "cs-parser.jay" { yyVal = Argument.AType.Out; } break; case 88: #line 938 "cs-parser.jay" { lexer.parsing_modifiers = true; } break; case 89: #line 942 "cs-parser.jay" { lexer.parsing_modifiers = true; } break; case 102: case_102(); break; case 103: #line 973 "cs-parser.jay" { } break; case 104: case_104(); break; case 105: case_105(); break; case 106: case_106(); break; case 107: case_107(); break; case 108: case_108(); break; case 109: #line 1017 "cs-parser.jay" { Error_SyntaxError (yyToken); } break; case 110: case_110(); break; case 111: case_111(); break; case 112: case_112(); break; case 115: #line 1066 "cs-parser.jay" { current_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } break; case 116: #line 1070 "cs-parser.jay" { current_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } break; case 117: case_117(); break; case 118: #line 1086 "cs-parser.jay" { ++lexer.parsing_block; } break; case 119: case_119(); break; case 120: case_120(); break; case 123: case_123(); break; case 124: case_124(); break; case 125: case_125(); break; case 126: case_126(); break; case 127: #line 1165 "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 129: case_129(); break; case 130: case_130(); break; case 133: #line 1195 "cs-parser.jay" { current_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } break; case 134: #line 1199 "cs-parser.jay" { current_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } break; case 135: case_135(); break; case 136: #line 1212 "cs-parser.jay" { ++lexer.parsing_block; } break; case 137: case_137(); break; case 140: #line 1231 "cs-parser.jay" { current_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } break; case 141: #line 1235 "cs-parser.jay" { current_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } break; case 142: case_142(); break; case 143: #line 1251 "cs-parser.jay" { ++lexer.parsing_block; } break; case 144: case_144(); break; case 145: case_145(); break; case 148: case_148(); break; case 149: case_149(); break; case 150: case_150(); break; case 151: #line 1319 "cs-parser.jay" { valid_param_mod = ParameterModifierType.All; } break; case 152: case_152(); break; case 153: case_153(); break; case 154: #line 1358 "cs-parser.jay" { lexer.parsing_generic_declaration = true; } break; case 155: case_155(); break; case 156: #line 1368 "cs-parser.jay" { lexer.ConstraintsParsing = true; } break; case 157: case_157(); break; case 158: case_158(); break; case 159: case_159(); break; case 161: #line 1441 "cs-parser.jay" { savedLocation = GetLocation (yyVals[0+yyTop]); yyVal = null; } break; case 162: #line 1445 "cs-parser.jay" { yyVal = ParametersCompiled.EmptyReadOnlyParameters; } break; case 164: case_164(); break; case 165: case_165(); break; case 166: case_166(); break; case 167: case_167(); break; case 168: case_168(); break; case 169: case_169(); break; case 170: case_170(); break; case 171: #line 1517 "cs-parser.jay" { yyVal = new ParametersCompiled (new Parameter[] { (Parameter) yyVals[0+yyTop] } ); } break; case 172: #line 1521 "cs-parser.jay" { yyVal = new ParametersCompiled (new Parameter [] { new ArglistParameter (GetLocation (yyVals[0+yyTop])) }, true); } break; case 173: case_173(); break; case 174: case_174(); break; case 175: case_175(); break; case 176: case_176(); break; case 177: case_177(); break; case 178: case_178(); break; case 179: case_179(); break; case 180: #line 1602 "cs-parser.jay" { ++lexer.parsing_block; } break; case 181: case_181(); break; case 182: #line 1643 "cs-parser.jay" { yyVal = Parameter.Modifier.NONE; } break; case 184: #line 1651 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } break; case 185: case_185(); break; case 186: case_186(); break; case 187: case_187(); break; case 188: case_188(); break; case 189: case_189(); break; case 190: case_190(); break; case 191: case_191(); break; case 192: case_192(); break; case 193: case_193(); break; case 194: #line 1745 "cs-parser.jay" { Error_DuplicateParameterModifier (GetLocation (yyVals[-1+yyTop]), Parameter.Modifier.PARAMS); } break; case 195: case_195(); break; case 196: case_196(); break; case 197: case_197(); break; case 198: case_198(); break; case 199: case_199(); break; case 200: #line 1799 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Params | ParameterModifierType.DefaultValue; } break; case 201: case_201(); break; case 202: #line 1828 "cs-parser.jay" { lexer.PropertyParsing = false; } break; case 203: case_203(); break; case 208: case_208(); break; case 209: case_209(); break; case 210: case_210(); break; case 211: case_211(); break; case 212: case_212(); break; case 214: case_214(); break; case 215: case_215(); break; case 216: #line 1976 "cs-parser.jay" { } break; case 217: case_217(); break; case 218: case_218(); break; case 219: case_219(); break; case 220: case_220(); break; case 221: #line 2016 "cs-parser.jay" { Error_SyntaxError (yyToken); } break; case 224: #line 2028 "cs-parser.jay" { lexer.parsing_modifiers = true; } break; case 225: #line 2032 "cs-parser.jay" { lexer.parsing_modifiers = true; } break; case 226: #line 2039 "cs-parser.jay" { report.Error (525, GetLocation (yyVals[0+yyTop]), "Interfaces cannot contain fields or constants"); } break; case 227: #line 2043 "cs-parser.jay" { report.Error (525, GetLocation (yyVals[0+yyTop]), "Interfaces cannot contain fields or constants"); } break; case 232: #line 2051 "cs-parser.jay" { report.Error (567, GetLocation (yyVals[0+yyTop]), "Interfaces cannot contain operators"); } break; case 233: #line 2055 "cs-parser.jay" { report.Error (526, GetLocation (yyVals[0+yyTop]), "Interfaces cannot contain contructors"); } break; case 234: #line 2059 "cs-parser.jay" { report.Error (524, GetLocation (yyVals[0+yyTop]), "Interfaces cannot declare classes, structs, interfaces, delegates, or enumerations"); } break; case 235: #line 2065 "cs-parser.jay" { } break; case 236: case_236(); break; case 238: #line 2098 "cs-parser.jay" { savedLocation = GetLocation (yyVals[0+yyTop]); yyVal = null; } break; case 240: case_240(); break; case 241: #line 2114 "cs-parser.jay" { valid_param_mod = ParameterModifierType.DefaultValue; } break; case 242: case_242(); break; case 244: #line 2160 "cs-parser.jay" { yyVal = Operator.OpType.LogicalNot; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 245: #line 2161 "cs-parser.jay" { yyVal = Operator.OpType.OnesComplement; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 246: #line 2162 "cs-parser.jay" { yyVal = Operator.OpType.Increment; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 247: #line 2163 "cs-parser.jay" { yyVal = Operator.OpType.Decrement; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 248: #line 2164 "cs-parser.jay" { yyVal = Operator.OpType.True; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 249: #line 2165 "cs-parser.jay" { yyVal = Operator.OpType.False; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 250: #line 2167 "cs-parser.jay" { yyVal = Operator.OpType.Addition; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 251: #line 2168 "cs-parser.jay" { yyVal = Operator.OpType.Subtraction; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 252: #line 2170 "cs-parser.jay" { yyVal = Operator.OpType.Multiply; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 253: #line 2171 "cs-parser.jay" { yyVal = Operator.OpType.Division; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 254: #line 2172 "cs-parser.jay" { yyVal = Operator.OpType.Modulus; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 255: #line 2173 "cs-parser.jay" { yyVal = Operator.OpType.BitwiseAnd; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 256: #line 2174 "cs-parser.jay" { yyVal = Operator.OpType.BitwiseOr; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 257: #line 2175 "cs-parser.jay" { yyVal = Operator.OpType.ExclusiveOr; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 258: #line 2176 "cs-parser.jay" { yyVal = Operator.OpType.LeftShift; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 259: #line 2177 "cs-parser.jay" { yyVal = Operator.OpType.RightShift; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 260: #line 2178 "cs-parser.jay" { yyVal = Operator.OpType.Equality; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 261: #line 2179 "cs-parser.jay" { yyVal = Operator.OpType.Inequality; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 262: #line 2180 "cs-parser.jay" { yyVal = Operator.OpType.GreaterThan; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 263: #line 2181 "cs-parser.jay" { yyVal = Operator.OpType.LessThan; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 264: #line 2182 "cs-parser.jay" { yyVal = Operator.OpType.GreaterThanOrEqual; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 265: #line 2183 "cs-parser.jay" { yyVal = Operator.OpType.LessThanOrEqual; savedOperatorLocation = GetLocation (yyVals[0+yyTop]); } break; case 266: #line 2190 "cs-parser.jay" { valid_param_mod = ParameterModifierType.DefaultValue; } break; case 267: case_267(); break; case 268: #line 2213 "cs-parser.jay" { valid_param_mod = ParameterModifierType.DefaultValue; } break; case 269: case_269(); break; case 270: case_270(); break; case 271: case_271(); break; case 272: case_272(); break; case 273: case_273(); break; case 274: case_274(); break; case 275: case_275(); break; case 277: #line 2323 "cs-parser.jay" { current_block = null; yyVal = null; } break; case 280: #line 2335 "cs-parser.jay" { ++lexer.parsing_block; } break; case 281: case_281(); break; case 282: #line 2345 "cs-parser.jay" { ++lexer.parsing_block; } break; case 283: case_283(); break; case 284: case_284(); break; case 285: case_285(); break; case 286: case_286(); break; case 287: case_287(); break; case 288: case_288(); break; case 289: case_289(); break; case 290: case_290(); break; case 291: case_291(); break; case 292: case_292(); break; case 293: case_293(); break; case 295: #line 2472 "cs-parser.jay" { ++lexer.parsing_block; } break; case 296: case_296(); break; case 299: #line 2490 "cs-parser.jay" { current_event_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } break; case 300: #line 2494 "cs-parser.jay" { current_event_field.AddDeclarator ((FieldDeclarator) yyVals[0+yyTop]); } break; case 301: case_301(); break; case 302: #line 2507 "cs-parser.jay" { ++lexer.parsing_block; } break; case 303: case_303(); break; case 304: case_304(); break; case 305: #line 2532 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } break; case 308: case_308(); break; case 309: case_309(); break; case 310: case_310(); break; case 311: case_311(); break; case 312: case_312(); break; case 313: case_313(); break; case 314: case_314(); break; case 315: case_315(); break; case 317: case_317(); break; case 318: case_318(); break; case 319: case_319(); break; case 320: case_320(); break; case 321: case_321(); break; case 322: case_322(); break; case 324: case_324(); break; case 325: case_325(); break; case 328: #line 2718 "cs-parser.jay" { lbag.AppendToMember (current_container, GetLocation (yyVals[0+yyTop])); } break; case 330: case_330(); break; case 331: case_331(); break; case 332: case_332(); break; case 333: case_333(); break; case 334: case_334(); break; case 336: #line 2792 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out | ParameterModifierType.Params | ParameterModifierType.DefaultValue; } break; case 337: case_337(); break; case 338: #line 2811 "cs-parser.jay" { lexer.ConstraintsParsing = false; } break; case 339: case_339(); break; case 341: case_341(); break; case 343: case_343(); break; case 345: case_345(); break; case 346: case_346(); break; case 348: case_348(); break; case 349: case_349(); break; case 350: case_350(); break; case 351: case_351(); break; case 352: #line 2917 "cs-parser.jay" { lexer.parsing_generic_declaration = true; } break; case 353: case_353(); break; case 354: case_354(); break; case 356: case_356(); break; case 357: case_357(); break; case 358: case_358(); break; case 359: case_359(); break; case 360: case_360(); break; case 361: case_361(); break; case 363: case_363(); break; case 364: case_364(); break; case 365: case_365(); break; case 366: case_366(); break; case 367: case_367(); break; case 369: #line 3042 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Void, GetLocation (yyVals[0+yyTop])); } break; case 370: #line 3049 "cs-parser.jay" { lexer.parsing_generic_declaration = true; } break; case 372: case_372(); break; case 374: case_374(); break; case 376: case_376(); break; case 378: #line 3087 "cs-parser.jay" { yyVal = new ComposedCast ((FullNamedExpression) yyVals[-1+yyTop], (ComposedTypeSpecifier) yyVals[0+yyTop]); } break; case 379: case_379(); break; case 380: #line 3106 "cs-parser.jay" { yyVal = new ComposedCast ((ATypeNameExpression) yyVals[-1+yyTop], (ComposedTypeSpecifier) yyVals[0+yyTop]); } break; case 381: case_381(); break; case 382: #line 3115 "cs-parser.jay" { yyVal = new ComposedCast ((FullNamedExpression) yyVals[-1+yyTop], (ComposedTypeSpecifier) yyVals[0+yyTop]); } break; case 383: #line 3119 "cs-parser.jay" { yyVal = new ComposedCast (new TypeExpression (compiler.BuiltinTypes.Void, GetLocation (yyVals[-1+yyTop])), (ComposedTypeSpecifier) yyVals[0+yyTop]); } break; case 384: case_384(); break; case 385: case_385(); break; case 386: case_386(); break; case 387: #line 3153 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Object, GetLocation (yyVals[0+yyTop])); } break; case 388: #line 3154 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.String, GetLocation (yyVals[0+yyTop])); } break; case 389: #line 3155 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Bool, GetLocation (yyVals[0+yyTop])); } break; case 390: #line 3156 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Decimal, GetLocation (yyVals[0+yyTop])); } break; case 391: #line 3157 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Float, GetLocation (yyVals[0+yyTop])); } break; case 392: #line 3158 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Double, GetLocation (yyVals[0+yyTop])); } break; case 394: #line 3163 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.SByte, GetLocation (yyVals[0+yyTop])); } break; case 395: #line 3164 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Byte, GetLocation (yyVals[0+yyTop])); } break; case 396: #line 3165 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Short, GetLocation (yyVals[0+yyTop])); } break; case 397: #line 3166 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.UShort, GetLocation (yyVals[0+yyTop])); } break; case 398: #line 3167 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Int, GetLocation (yyVals[0+yyTop])); } break; case 399: #line 3168 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.UInt, GetLocation (yyVals[0+yyTop])); } break; case 400: #line 3169 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Long, GetLocation (yyVals[0+yyTop])); } break; case 401: #line 3170 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.ULong, GetLocation (yyVals[0+yyTop])); } break; case 402: #line 3171 "cs-parser.jay" { yyVal = new TypeExpression (compiler.BuiltinTypes.Char, GetLocation (yyVals[0+yyTop])); } break; case 423: case_423(); break; case 424: case_424(); break; case 428: #line 3218 "cs-parser.jay" { yyVal = new NullLiteral (GetLocation (yyVals[0+yyTop])); } break; case 429: #line 3222 "cs-parser.jay" { yyVal = new BoolLiteral (compiler.BuiltinTypes, true, GetLocation (yyVals[0+yyTop])); } break; case 430: #line 3223 "cs-parser.jay" { yyVal = new BoolLiteral (compiler.BuiltinTypes, false, GetLocation (yyVals[0+yyTop])); } break; case 435: case_435(); break; case 436: #line 3256 "cs-parser.jay" { yyVal = new ParenthesizedExpression ((Expression) yyVals[-1+yyTop], GetLocation (yyVals[-2+yyTop])); } break; case 437: case_437(); break; case 438: case_438(); break; case 439: case_439(); break; case 440: case_440(); break; case 441: #line 3288 "cs-parser.jay" { yyVal = new CompletionMemberAccess ((Expression) yyVals[-2+yyTop], null,GetLocation (yyVals[0+yyTop])); } break; case 442: case_442(); break; case 443: #line 3296 "cs-parser.jay" { yyVal = new CompletionMemberAccess ((Expression) yyVals[-2+yyTop], null, lexer.Location); } break; case 444: case_444(); break; case 445: case_445(); break; case 446: case_446(); break; case 447: case_447(); break; case 448: #line 3326 "cs-parser.jay" { yyVal = null; } break; case 450: case_450(); break; case 451: case_451(); break; case 452: #line 3348 "cs-parser.jay" { yyVal = null; } break; case 453: #line 3352 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } break; case 454: case_454(); break; case 455: case_455(); break; case 456: case_456(); break; case 457: case_457(); break; case 458: case_458(); break; case 459: #line 3391 "cs-parser.jay" { yyVal = new CompletionElementInitializer (null, GetLocation (yyVals[0+yyTop])); } break; case 460: case_460(); break; case 461: case_461(); break; case 462: case_462(); break; case 465: #line 3422 "cs-parser.jay" { yyVal = null; } break; case 467: case_467(); break; case 468: case_468(); break; case 469: case_469(); break; case 470: case_470(); break; case 471: case_471(); break; case 472: #line 3476 "cs-parser.jay" { yyVal = new Argument ((Expression) yyVals[0+yyTop]); } break; case 476: case_476(); break; case 477: case_477(); break; case 478: case_478(); break; case 479: case_479(); break; case 481: case_481(); break; case 482: case_482(); break; case 483: case_483(); break; case 484: case_484(); break; case 485: case_485(); break; case 486: case_486(); break; case 487: case_487(); break; case 488: #line 3569 "cs-parser.jay" { yyVal = new Argument ((Expression) yyVals[0+yyTop]); } break; case 490: #line 3577 "cs-parser.jay" { yyVal = new This (GetLocation (yyVals[0+yyTop])); } break; case 491: case_491(); break; case 492: case_492(); break; case 493: #line 3597 "cs-parser.jay" { yyVal = new UnaryMutator (UnaryMutator.Mode.PostIncrement, (Expression) yyVals[-1+yyTop], GetLocation (yyVals[0+yyTop])); } break; case 494: #line 3604 "cs-parser.jay" { yyVal = new UnaryMutator (UnaryMutator.Mode.PostDecrement, (Expression) yyVals[-1+yyTop], GetLocation (yyVals[0+yyTop])); } break; case 495: case_495(); break; case 496: case_496(); break; case 497: case_497(); break; case 498: case_498(); break; case 499: case_499(); break; case 500: case_500(); break; case 501: case_501(); break; case 502: #line 3671 "cs-parser.jay" { ++lexer.parsing_type; } break; case 503: case_503(); break; case 504: case_504(); break; case 507: #line 3698 "cs-parser.jay" { yyVal = null; } break; case 509: case_509(); break; case 510: case_510(); break; case 511: case_511(); break; case 512: case_512(); break; case 513: case_513(); break; case 514: case_514(); break; case 518: case_518(); break; case 519: case_519(); break; case 520: case_520(); break; case 521: #line 3776 "cs-parser.jay" { yyVal = 2; } break; case 522: #line 3780 "cs-parser.jay" { yyVal = ((int) yyVals[-1+yyTop]) + 1; } break; case 523: #line 3787 "cs-parser.jay" { yyVal = null; } break; case 524: #line 3791 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } break; case 525: case_525(); break; case 526: case_526(); break; case 527: case_527(); break; case 528: case_528(); break; case 529: #line 3835 "cs-parser.jay" { lexer.TypeOfParsing = true; } break; case 530: case_530(); break; case 533: case_533(); break; case 534: case_534(); break; case 535: case_535(); break; case 536: case_536(); break; case 537: case_537(); break; case 538: case_538(); break; case 539: case_539(); break; case 540: case_540(); break; case 541: case_541(); break; case 542: case_542(); break; case 543: case_543(); break; case 544: case_544(); break; case 545: case_545(); break; case 546: case_546(); break; case 547: case_547(); break; case 548: #line 3978 "cs-parser.jay" { start_anonymous (false, (ParametersCompiled) yyVals[0+yyTop], false, GetLocation (yyVals[-1+yyTop])); } break; case 549: case_549(); break; case 550: #line 3991 "cs-parser.jay" { start_anonymous (false, (ParametersCompiled) yyVals[0+yyTop], true, GetLocation (yyVals[-2+yyTop])); } break; case 551: case_551(); break; case 552: #line 4008 "cs-parser.jay" { yyVal = ParametersCompiled.Undefined; } break; case 554: #line 4016 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; } break; case 555: case_555(); break; case 556: case_556(); break; case 558: #line 4042 "cs-parser.jay" { yyVal = new Unary (Unary.Operator.LogicalNot, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 559: #line 4046 "cs-parser.jay" { yyVal = new Unary (Unary.Operator.OnesComplement, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 560: case_560(); break; case 561: case_561(); break; case 562: case_562(); break; case 563: case_563(); break; case 564: case_564(); break; case 565: case_565(); break; case 567: #line 4107 "cs-parser.jay" { yyVal = new Unary (Unary.Operator.UnaryPlus, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 568: #line 4111 "cs-parser.jay" { yyVal = new Unary (Unary.Operator.UnaryNegation, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 569: #line 4115 "cs-parser.jay" { yyVal = new UnaryMutator (UnaryMutator.Mode.PreIncrement, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 570: #line 4119 "cs-parser.jay" { yyVal = new UnaryMutator (UnaryMutator.Mode.PreDecrement, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 571: #line 4123 "cs-parser.jay" { yyVal = new Indirection ((Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 572: #line 4127 "cs-parser.jay" { yyVal = new Unary (Unary.Operator.AddressOf, (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 573: case_573(); break; case 574: case_574(); break; case 575: case_575(); break; case 576: case_576(); break; 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; case 601: case_601(); break; case 602: case_602(); break; case 603: case_603(); break; case 604: case_604(); break; case 605: case_605(); break; case 606: case_606(); break; case 607: case_607(); break; case 608: case_608(); break; case 610: case_610(); break; case 611: case_611(); break; case 612: case_612(); break; case 613: case_613(); break; case 615: case_615(); break; case 616: case_616(); break; case 618: case_618(); break; case 619: case_619(); break; case 621: case_621(); break; case 622: case_622(); break; case 624: case_624(); break; case 625: case_625(); break; case 627: case_627(); break; case 628: case_628(); break; case 630: case_630(); break; case 632: case_632(); break; case 633: case_633(); break; case 634: case_634(); break; case 635: case_635(); break; case 636: case_636(); break; case 637: case_637(); break; case 638: case_638(); break; case 639: case_639(); break; case 640: case_640(); break; case 641: case_641(); break; case 642: case_642(); break; case 643: case_643(); break; case 644: case_644(); break; case 645: case_645(); break; case 646: case_646(); break; case 647: case_647(); break; case 648: case_648(); break; case 649: case_649(); break; case 650: case_650(); break; case 651: case_651(); break; case 652: case_652(); break; case 653: #line 4591 "cs-parser.jay" { yyVal = ParametersCompiled.EmptyReadOnlyParameters; } break; case 654: case_654(); break; case 655: #line 4602 "cs-parser.jay" { start_block (Location.Null); } break; case 656: case_656(); break; case 658: case_658(); break; case 660: case_660(); break; case 661: case_661(); break; case 662: case_662(); break; case 663: case_663(); break; case 664: case_664(); break; case 665: case_665(); break; case 666: case_666(); break; case 667: #line 4669 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; } break; case 668: case_668(); break; case 669: case_669(); break; case 670: #line 4683 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; } break; case 671: case_671(); break; case 672: case_672(); break; case 678: #line 4708 "cs-parser.jay" { yyVal = new ArglistAccess (GetLocation (yyVals[0+yyTop])); } break; case 679: case_679(); break; case 680: case_680(); break; case 681: case_681(); break; case 683: #line 4737 "cs-parser.jay" { yyVal = new BooleanExpression ((Expression) yyVals[0+yyTop]); } break; case 684: #line 4749 "cs-parser.jay" { } break; case 685: case_685(); break; case 686: case_686(); break; case 687: case_687(); break; case 688: case_688(); break; case 689: #line 4796 "cs-parser.jay" { yyVal = null; } break; case 690: #line 4798 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; StoreModifierLocation (Modifiers.PARTIAL, GetLocation (yyVals[0+yyTop])); } break; case 691: case_691(); break; case 692: #line 4811 "cs-parser.jay" { lexer.parsing_modifiers = false; } break; case 694: case_694(); break; case 695: case_695(); break; case 696: case_696(); break; case 697: case_697(); break; case 698: case_698(); break; case 699: case_699(); break; case 700: case_700(); break; case 701: case_701(); break; case 702: case_702(); break; case 703: case_703(); break; case 704: case_704(); break; case 705: case_705(); break; case 706: case_706(); break; case 707: case_707(); break; case 708: case_708(); break; case 709: case_709(); break; case 711: case_711(); break; case 712: case_712(); break; case 714: #line 4937 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } break; case 715: case_715(); break; case 716: case_716(); break; case 717: case_717(); break; case 718: case_718(); break; case 719: case_719(); break; case 720: case_720(); break; case 721: case_721(); break; case 722: case_722(); break; case 723: #line 5030 "cs-parser.jay" { yyVal = new SpecialContraintExpr (SpecialConstraint.Class, GetLocation (yyVals[0+yyTop])); } break; case 724: #line 5034 "cs-parser.jay" { yyVal = new SpecialContraintExpr (SpecialConstraint.Struct, GetLocation (yyVals[0+yyTop])); } break; case 725: #line 5041 "cs-parser.jay" { yyVal = Variance.None; } break; case 726: case_726(); break; case 727: case_727(); break; case 728: case_728(); break; case 729: case_729(); break; case 730: #line 5086 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } break; case 731: case_731(); break; case 732: case_732(); break; case 733: case_733(); break; case 734: case_734(); break; case 735: case_735(); break; case 736: case_736(); break; case 737: case_737(); break; case 742: #line 5148 "cs-parser.jay" { current_block.AddStatement ((Statement) yyVals[0+yyTop]); } break; case 743: #line 5152 "cs-parser.jay" { current_block.AddStatement ((Statement) yyVals[0+yyTop]); } break; case 745: case_745(); break; case 746: case_746(); break; case 749: #line 5186 "cs-parser.jay" { current_block.AddStatement ((Statement) yyVals[0+yyTop]); } break; case 750: #line 5190 "cs-parser.jay" { current_block.AddStatement ((Statement) yyVals[0+yyTop]); } break; case 779: case_779(); break; case 780: case_780(); break; case 781: case_781(); break; case 782: case_782(); break; case 783: case_783(); break; case 786: case_786(); break; case 787: case_787(); break; case 788: case_788(); break; case 789: case_789(); break; case 790: #line 5334 "cs-parser.jay" { yyVal = new ComposedCast ((FullNamedExpression) yyVals[-1+yyTop], (ComposedTypeSpecifier) yyVals[0+yyTop]); } break; case 791: #line 5338 "cs-parser.jay" { yyVal = new ComposedCast (new TypeExpression (compiler.BuiltinTypes.Void, GetLocation (yyVals[-1+yyTop])), (ComposedTypeSpecifier) yyVals[0+yyTop]); } break; case 792: case_792(); break; case 794: case_794(); break; case 795: #line 5359 "cs-parser.jay" { yyVal = ComposedTypeSpecifier.CreatePointer (GetLocation (yyVals[0+yyTop])); } break; case 797: #line 5367 "cs-parser.jay" { yyVal = Error_AwaitAsIdentifier (yyVals[0+yyTop]); } break; case 798: case_798(); break; case 799: case_799(); break; case 800: case_800(); break; case 801: case_801(); break; case 803: case_803(); break; case 805: case_805(); break; case 806: case_806(); break; case 810: case_810(); break; case 813: case_813(); break; case 814: case_814(); break; case 815: #line 5481 "cs-parser.jay" { report.Error (145, lexer.Location, "A const field requires a value to be provided"); } break; case 816: case_816(); break; case 821: case_821(); break; case 823: case_823(); break; case 824: case_824(); break; case 825: case_825(); break; case 826: #line 5531 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; } break; case 827: case_827(); break; case 828: #line 5541 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; } break; case 829: #line 5542 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; } break; case 830: case_830(); break; case 831: case_831(); break; case 832: case_832(); break; case 835: case_835(); break; case 836: case_836(); break; case 837: case_837(); break; case 838: #line 5617 "cs-parser.jay" { start_block (GetLocation (yyVals[0+yyTop])); } break; case 839: case_839(); break; case 840: case_840(); break; case 841: #line 5637 "cs-parser.jay" { report.Warning (1522, 1, current_block.StartLocation, "Empty switch block"); } break; case 845: #line 5647 "cs-parser.jay" { Error_SyntaxError (yyToken); } break; case 847: case_847(); break; case 848: #line 5664 "cs-parser.jay" { current_block.AddStatement ((Statement) yyVals[0+yyTop]); } break; case 849: case_849(); break; case 850: case_850(); break; case 851: #line 5681 "cs-parser.jay" { yyVal = new SwitchLabel (null, GetLocation (yyVals[0+yyTop])); } break; case 856: case_856(); break; case 857: case_857(); break; case 858: case_858(); break; case 859: case_859(); break; case 860: case_860(); break; case 861: case_861(); break; case 862: #line 5742 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } break; case 863: case_863(); break; case 864: #line 5757 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } break; case 865: case_865(); break; case 866: case_866(); break; case 867: #line 5778 "cs-parser.jay" { yyVal = yyVals[0+yyTop]; } break; case 868: case_868(); break; case 869: case_869(); break; case 870: case_870(); break; case 871: #line 5812 "cs-parser.jay" { yyVal = new EmptyStatement (lexer.Location); } break; case 873: case_873(); break; case 874: case_874(); break; case 876: #line 5836 "cs-parser.jay" { yyVal = null; } break; case 878: #line 5841 "cs-parser.jay" { yyVal = new EmptyStatement (lexer.Location); } break; case 882: case_882(); break; case 883: case_883(); break; case 884: case_884(); break; case 885: case_885(); break; case 886: case_886(); break; case 887: case_887(); break; case 888: case_888(); break; case 895: case_895(); break; case 896: case_896(); break; case 897: case_897(); break; case 898: case_898(); break; case 899: case_899(); break; case 900: case_900(); break; case 901: case_901(); break; case 902: case_902(); break; case 903: case_903(); break; case 904: case_904(); break; case 905: case_905(); break; case 906: case_906(); break; case 907: case_907(); break; case 908: case_908(); break; case 911: #line 6082 "cs-parser.jay" { yyVal = new TryCatch ((Block) yyVals[-1+yyTop], (List<Catch>) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop]), false); } break; case 912: case_912(); break; case 913: case_913(); break; case 914: case_914(); break; case 915: case_915(); break; case 916: case_916(); break; case 919: #line 6131 "cs-parser.jay" { yyVal = new Catch ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 920: case_920(); break; case 921: #line 6150 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; } break; case 922: case_922(); break; case 923: case_923(); break; case 924: #line 6191 "cs-parser.jay" { yyVal = new Checked ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 925: #line 6198 "cs-parser.jay" { yyVal = new Unchecked ((Block) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop])); } break; case 926: case_926(); break; case 927: #line 6208 "cs-parser.jay" { yyVal = new Unsafe ((Block) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop])); } break; case 928: case_928(); break; case 929: case_929(); break; case 930: case_930(); break; case 931: case_931(); break; case 932: case_932(); break; case 933: case_933(); break; case 934: case_934(); break; case 935: case_935(); break; case 936: case_936(); break; case 937: case_937(); break; case 939: case_939(); break; case 940: #line 6313 "cs-parser.jay" { Error_MissingInitializer (lexer.Location); } break; case 941: case_941(); break; case 942: case_942(); break; case 943: case_943(); break; case 944: case_944(); break; case 945: case_945(); break; case 946: case_946(); break; case 947: case_947(); break; case 948: case_948(); break; case 949: case_949(); break; case 950: #line 6418 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } break; case 951: case_951(); break; case 952: #line 6434 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } break; case 953: case_953(); break; case 954: case_954(); break; case 955: case_955(); break; case 957: case_957(); break; case 958: case_958(); break; case 959: #line 6498 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } break; case 960: case_960(); break; case 961: case_961(); break; case 962: case_962(); break; case 963: case_963(); break; case 964: #line 6537 "cs-parser.jay" { yyVal = new object[] { yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]) }; } break; case 965: case_965(); break; case 967: case_967(); break; case 973: #line 6566 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } break; case 974: case_974(); break; case 975: #line 6585 "cs-parser.jay" { current_block = new Linq.QueryBlock (current_block, lexer.Location); } break; case 976: case_976(); break; case 977: case_977(); break; case 978: case_978(); break; case 979: case_979(); break; case 980: case_980(); break; case 981: case_981(); break; case 982: case_982(); break; case 983: case_983(); break; case 984: case_984(); break; case 986: case_986(); break; case 987: case_987(); break; case 988: case_988(); break; case 990: case_990(); break; case 991: case_991(); break; case 993: case_993(); break; case 994: case_994(); break; case 995: #line 6786 "cs-parser.jay" { yyVal = new Linq.OrderByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[0+yyTop]); } break; case 996: case_996(); break; case 997: case_997(); break; case 998: #line 6803 "cs-parser.jay" { yyVal = new Linq.ThenByAscending ((Linq.QueryBlock) current_block, (Expression)yyVals[0+yyTop]); } break; case 999: case_999(); break; case 1000: case_1000(); break; case 1002: case_1002(); break; case 1003: case_1003(); break; case 1006: case_1006(); break; case 1007: case_1007(); break; case 1015: #line 6925 "cs-parser.jay" { module.DocumentationBuilder.ParsedName = (MemberName) yyVals[0+yyTop]; } break; case 1016: #line 6932 "cs-parser.jay" { module.DocumentationBuilder.ParsedParameters = (List<DocumentationParameter>)yyVals[0+yyTop]; } break; case 1017: case_1017(); break; case 1018: case_1018(); break; case 1019: #line 6949 "cs-parser.jay" { yyVal = new MemberName ((MemberName) yyVals[-2+yyTop], MemberCache.IndexerNameAlias, Location.Null); } break; case 1020: #line 6953 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; } break; case 1021: case_1021(); break; case 1022: case_1022(); break; case 1023: case_1023(); break; case 1024: case_1024(); break; case 1026: #line 6989 "cs-parser.jay" { yyVal = new MemberName (((MemberName) yyVals[-2+yyTop]), (MemberName) yyVals[0+yyTop]); } break; case 1028: #line 6997 "cs-parser.jay" { valid_param_mod = ParameterModifierType.Ref | ParameterModifierType.Out; } break; case 1029: #line 7001 "cs-parser.jay" { yyVal = yyVals[-1+yyTop]; } break; case 1030: #line 7008 "cs-parser.jay" { yyVal = new List<DocumentationParameter> (0); } break; case 1032: case_1032(); break; case 1033: case_1033(); break; case 1034: case_1034(); break; #line default } yyTop -= yyLen[yyN]; yyState = yyStates[yyTop]; int yyM = yyLhs[yyN]; if (yyState == 0 && yyM == 0) { //t if (debug != null) debug.shift(0, yyFinal); yyState = yyFinal; if (yyToken < 0) { yyToken = yyLex.advance() ? yyLex.token() : 0; //t if (debug != null) //t debug.lex(yyState, yyToken,yyname(yyToken), yyLex.value()); } if (yyToken == 0) { //t if (debug != null) debug.accept(yyVal); return yyVal; } goto continue_yyLoop; } if (((yyN = yyGindex[yyM]) != 0) && ((yyN += yyState) >= 0) && (yyN < yyTable.Length) && (yyCheck[yyN] == yyState)) yyState = yyTable[yyN]; else yyState = yyDgoto[yyM]; //t if (debug != null) debug.shift(yyStates[yyTop], yyState); goto continue_yyLoop; continue_yyDiscarded: ; // implements the named-loop continue: 'continue yyDiscarded' } continue_yyLoop: ; // implements the named-loop continue: 'continue yyLoop' } }
public override bool Define() { if (!base.Define ()) return false; if (declarators != null) { var t = new TypeExpression (MemberType, TypeExpression.Location); int index = Parent.PartialContainer.Events.IndexOf (this); foreach (var d in declarators) { var ef = new EventField (Parent, t, ModFlags, new MemberName (d.Name.Value, d.Name.Location), OptAttributes); if (d.Initializer != null) ef.initializer = d.Initializer; Parent.PartialContainer.Events.Insert (++index, ef); } } if (!HasBackingField) { SetIsUsed (); return true; } if (Add.IsInterfaceImplementation) SetIsUsed (); backing_field = new Field (Parent, new TypeExpression (MemberType, Location), Modifiers.BACKING_FIELD | Modifiers.COMPILER_GENERATED | Modifiers.PRIVATE | (ModFlags & (Modifiers.STATIC | Modifiers.UNSAFE)), MemberName, null); Parent.PartialContainer.AddField (backing_field); backing_field.Initializer = Initializer; backing_field.ModFlags &= ~Modifiers.COMPILER_GENERATED; // Call define because we passed fields definition backing_field.Define (); // Set backing field for event fields spec.BackingField = backing_field.Spec; return true; }
public void AddCapturedThisField (EmitContext ec) { TypeExpr type_expr = new TypeExpression (ec.CurrentType, Location); Field f = AddCompilerGeneratedField ("<>f__this", type_expr); f.Define (); hoisted_this = new HoistedThis (this, f); // Inflated type instance has to be updated manually if (Instance.Type is InflatedTypeSpec) { var inflator = new TypeParameterInflator (this, Instance.Type, TypeParameterSpec.EmptyTypes, TypeSpec.EmptyTypes); Instance.Type.MemberCache.AddMember (f.Spec.InflateMember (inflator)); inflator = new TypeParameterInflator (this, f.Parent.CurrentType, TypeParameterSpec.EmptyTypes, TypeSpec.EmptyTypes); f.Parent.CurrentType.MemberCache.AddMember (f.Spec.InflateMember (inflator)); } }
public TypeExpr LookupType (IMemberContext ctx, string name, int arity, LookupMode mode, Location loc) { if (types == null) return null; TypeExpr te; if (arity == 0 && cached_types.TryGetValue (name, out te)) return te; IList<TypeSpec> found; if (!types.TryGetValue (name, out found)) return null; TypeSpec best = null; foreach (var ts in found) { if (ts.Arity == arity) { if (best == null) { if ((ts.Modifiers & Modifiers.INTERNAL) != 0 && !ts.MemberDefinition.IsInternalAsPublic (ctx.Module.DeclaringAssembly) && mode != LookupMode.IgnoreAccessibility) continue; best = ts; continue; } if (best.MemberDefinition.IsImported && ts.MemberDefinition.IsImported) { if (mode == LookupMode.Normal) { ctx.Module.Compiler.Report.SymbolRelatedToPreviousError (best); ctx.Module.Compiler.Report.SymbolRelatedToPreviousError (ts); ctx.Module.Compiler.Report.Error (433, loc, "The imported type `{0}' is defined multiple times", ts.GetSignatureForError ()); } break; } if (best.MemberDefinition.IsImported) best = ts; if ((best.Modifiers & Modifiers.INTERNAL) != 0 && !best.MemberDefinition.IsInternalAsPublic (ctx.Module.DeclaringAssembly)) continue; if (mode != LookupMode.Normal) continue; if (ts.MemberDefinition.IsImported) { ctx.Module.Compiler.Report.SymbolRelatedToPreviousError (best); ctx.Module.Compiler.Report.SymbolRelatedToPreviousError (ts); } ctx.Module.Compiler.Report.Warning (436, 2, loc, "The type `{0}' conflicts with the imported type of same name'. Ignoring the imported type definition", best.GetSignatureForError ()); } // // Lookup for the best candidate with the closest arity match // if (arity < 0) { if (best == null) { best = ts; } else if (System.Math.Abs (ts.Arity + arity) < System.Math.Abs (best.Arity + arity)) { best = ts; } } } if (best == null) return null; te = new TypeExpression (best, Location.Null); // TODO MemberCache: Cache more if (arity == 0 && mode == LookupMode.Normal) cached_types.Add (name, te); return te; }
public override bool Resolve(BlockContext ec) { TypeExpression storey_type_expr = new TypeExpression (host.Definition, loc); List<Expression> init = null; if (host.hoisted_this != null) { init = new List<Expression> (host.hoisted_params == null ? 1 : host.HoistedParameters.Count + 1); HoistedThis ht = host.hoisted_this; FieldExpr from = new FieldExpr (ht.Field, loc); from.InstanceExpression = CompilerGeneratedThis.Instance; init.Add (new ElementInitializer (ht.Field.Name, from, loc)); } if (host.hoisted_params != null) { if (init == null) init = new List<Expression> (host.HoistedParameters.Count); for (int i = 0; i < host.hoisted_params.Count; ++i) { HoistedParameter hp = (HoistedParameter) host.hoisted_params [i]; HoistedParameter hp_cp = (HoistedParameter) host.hoisted_params_copy [i]; FieldExpr from = new FieldExpr (hp_cp.Field, loc); from.InstanceExpression = CompilerGeneratedThis.Instance; init.Add (new ElementInitializer (hp.Field.Name, from, loc)); } } if (init != null) { new_storey = new NewInitialize (storey_type_expr, null, new CollectionOrObjectInitializers (init, loc), loc); } else { new_storey = new New (storey_type_expr, null, loc); } new_storey = new_storey.Resolve (ec); if (new_storey != null) new_storey = Convert.ImplicitConversionRequired (ec, new_storey, host_method.MemberType, loc); if (TypeManager.int_interlocked_compare_exchange == null) { TypeSpec t = TypeManager.CoreLookupType (ec.Compiler, "System.Threading", "Interlocked", MemberKind.Class, true); if (t != null) { var p = ParametersCompiled.CreateFullyResolved ( new[] { new ParameterData (null, Parameter.Modifier.REF), new ParameterData (null, Parameter.Modifier.NONE), new ParameterData (null, Parameter.Modifier.NONE) }, new[] { TypeManager.int32_type, TypeManager.int32_type, TypeManager.int32_type } ); var f = new MemberFilter ("CompareExchange", 0, MemberKind.Method, p, TypeManager.int32_type); TypeManager.int_interlocked_compare_exchange = TypeManager.GetPredefinedMethod (t, f, loc); } } ec.CurrentBranching.CurrentUsageVector.Goto (); return true; }
public override object Visit(TypeExpression typeExpression) { return new TypeReferenceExpression(new PrimitiveType(keywordTable [(int)typeExpression.Type.BuiltinType], Convert(typeExpression.Location))); }
protected void EmitCall (EmitContext ec, Expression binder, Arguments arguments, bool isStatement) { // // This method generates all internal infrastructure for a dynamic call. The // reason why it's quite complicated is the mixture of dynamic and anonymous // methods. Dynamic itself requires a temporary class (ContainerX) and anonymous // methods can generate temporary storey as well (AnonStorey). Handling MVAR // type parameters rewrite is non-trivial in such case as there are various // combinations possible therefore the mutator is not straightforward. Secondly // we need to keep both MVAR(possibly VAR for anon storey) and type VAR to emit // correct Site field type and its access from EmitContext. // int dyn_args_count = arguments == null ? 0 : arguments.Count; int default_args = isStatement ? 1 : 2; var module = ec.Module; bool has_ref_out_argument = false; var targs = new TypeExpression[dyn_args_count + default_args]; targs[0] = new TypeExpression (module.PredefinedTypes.CallSite.TypeSpec, loc); TypeExpression[] targs_for_instance = null; TypeParameterMutator mutator; var site_container = ec.CreateDynamicSite (); if (context_mvars != null) { TypeParameters tparam; TypeContainer sc = site_container; do { tparam = sc.CurrentTypeParameters; sc = sc.Parent; } while (tparam == null); mutator = new TypeParameterMutator (context_mvars, tparam); if (!ec.IsAnonymousStoreyMutateRequired) { targs_for_instance = new TypeExpression[targs.Length]; targs_for_instance[0] = targs[0]; } } else { mutator = null; } for (int i = 0; i < dyn_args_count; ++i) { Argument a = arguments[i]; if (a.ArgType == Argument.AType.Out || a.ArgType == Argument.AType.Ref) has_ref_out_argument = true; var t = a.Type; // Convert any internal type like dynamic or null to object if (t.Kind == MemberKind.InternalCompilerType) t = ec.BuiltinTypes.Object; if (targs_for_instance != null) targs_for_instance[i + 1] = new TypeExpression (t, loc); if (mutator != null) t = t.Mutate (mutator); targs[i + 1] = new TypeExpression (t, loc); } TypeExpr del_type = null; TypeExpr del_type_instance_access = null; if (!has_ref_out_argument) { string d_name = isStatement ? "Action" : "Func"; TypeSpec te = null; Namespace type_ns = module.GlobalRootNamespace.GetNamespace ("System", true); if (type_ns != null) { te = type_ns.LookupType (module, d_name, dyn_args_count + default_args, LookupMode.Normal, loc); } if (te != null) { if (!isStatement) { var t = type; if (t.Kind == MemberKind.InternalCompilerType) t = ec.BuiltinTypes.Object; if (targs_for_instance != null) targs_for_instance[targs_for_instance.Length - 1] = new TypeExpression (t, loc); if (mutator != null) t = t.Mutate (mutator); targs[targs.Length - 1] = new TypeExpression (t, loc); } del_type = new GenericTypeExpr (te, new TypeArguments (targs), loc); if (targs_for_instance != null) del_type_instance_access = new GenericTypeExpr (te, new TypeArguments (targs_for_instance), loc); else del_type_instance_access = del_type; } } // // Create custom delegate when no appropriate predefined delegate has been found // Delegate d; if (del_type == null) { TypeSpec rt = isStatement ? ec.BuiltinTypes.Void : type; Parameter[] p = new Parameter[dyn_args_count + 1]; p[0] = new Parameter (targs[0], "p0", Parameter.Modifier.NONE, null, loc); var site = ec.CreateDynamicSite (); int index = site.Containers == null ? 0 : site.Containers.Count; if (mutator != null) rt = mutator.Mutate (rt); for (int i = 1; i < dyn_args_count + 1; ++i) { p[i] = new Parameter (targs[i], "p" + i.ToString ("X"), arguments[i - 1].Modifier, null, loc); } d = new Delegate (site, new TypeExpression (rt, loc), Modifiers.INTERNAL | Modifiers.COMPILER_GENERATED, new MemberName ("Container" + index.ToString ("X")), new ParametersCompiled (p), null); d.CreateContainer (); d.DefineContainer (); d.Define (); d.PrepareEmit (); site.AddTypeContainer (d); // // Add new container to inflated site container when the // member cache already exists // if (site.CurrentType is InflatedTypeSpec && index > 0) site.CurrentType.MemberCache.AddMember (d.CurrentType); del_type = new TypeExpression (d.CurrentType, loc); if (targs_for_instance != null) { del_type_instance_access = null; } else { del_type_instance_access = del_type; } } else { d = null; } var site_type_decl = new GenericTypeExpr (module.PredefinedTypes.CallSiteGeneric.TypeSpec, new TypeArguments (del_type), loc); var field = site_container.CreateCallSiteField (site_type_decl, loc); if (field == null) return; if (del_type_instance_access == null) { var dt = d.CurrentType.DeclaringType.MakeGenericType (module, context_mvars.Types); del_type_instance_access = new TypeExpression (MemberCache.GetMember (dt, d.CurrentType), loc); } var instanceAccessExprType = new GenericTypeExpr (module.PredefinedTypes.CallSiteGeneric.TypeSpec, new TypeArguments (del_type_instance_access), loc); if (instanceAccessExprType.ResolveAsType (ec.MemberContext) == null) return; bool inflate_using_mvar = context_mvars != null && ec.IsAnonymousStoreyMutateRequired; TypeSpec gt; if (inflate_using_mvar || context_mvars == null) { gt = site_container.CurrentType; } else { gt = site_container.CurrentType.MakeGenericType (module, context_mvars.Types); } // When site container already exists the inflated version has to be // updated manually to contain newly created field if (gt is InflatedTypeSpec && site_container.AnonymousMethodsCounter > 1) { var tparams = gt.MemberDefinition.TypeParametersCount > 0 ? gt.MemberDefinition.TypeParameters : TypeParameterSpec.EmptyTypes; var inflator = new TypeParameterInflator (module, gt, tparams, gt.TypeArguments); gt.MemberCache.AddMember (field.InflateMember (inflator)); } FieldExpr site_field_expr = new FieldExpr (MemberCache.GetMember (gt, field), loc); BlockContext bc = new BlockContext (ec.MemberContext, null, ec.BuiltinTypes.Void); Arguments args = new Arguments (1); args.Add (new Argument (binder)); StatementExpression s = new StatementExpression (new SimpleAssign (site_field_expr, new Invocation (new MemberAccess (instanceAccessExprType, "Create"), args))); using (ec.With (BuilderContext.Options.OmitDebugInfo, true)) { var conditionalAccessReceiver = IsConditionalAccessReceiver; var ca = ec.ConditionalAccess; if (conditionalAccessReceiver) { ec.ConditionalAccess = new ConditionalAccessContext (type, ec.DefineLabel ()) { Statement = isStatement }; // // Emit conditional access expressions before dynamic call // is initialized. It pushes site_field_expr on stack before // the actual instance argument is emited which would cause // jump from non-empty stack. // EmitConditionalAccess (ec); } if (s.Resolve (bc)) { Statement init = new If (new Binary (Binary.Operator.Equality, site_field_expr, new NullLiteral (loc)), s, loc); init.Emit (ec); } args = new Arguments (1 + dyn_args_count); args.Add (new Argument (site_field_expr)); if (arguments != null) { int arg_pos = 1; foreach (Argument a in arguments) { if (a is NamedArgument) { // Name is not valid in this context args.Add (new Argument (a.Expr, a.ArgType)); } else { args.Add (a); } if (inflate_using_mvar && a.Type != targs[arg_pos].Type) a.Expr.Type = targs[arg_pos].Type; ++arg_pos; } } var target = new DelegateInvocation (new MemberAccess (site_field_expr, "Target", loc).Resolve (bc), args, false, loc).Resolve (bc); if (target != null) { target.Emit (ec); } if (conditionalAccessReceiver) { ec.CloseConditionalAccess (!isStatement && type.IsNullableType ? type : null); ec.ConditionalAccess = ca; } } }
public override bool Define() { var mod_flags_src = ModFlags; if (!base.Define ()) return false; if (declarators != null) { if ((mod_flags_src & Modifiers.DEFAULT_ACCESS_MODIFER) != 0) mod_flags_src &= ~(Modifiers.AccessibilityMask | Modifiers.DEFAULT_ACCESS_MODIFER); var t = new TypeExpression (MemberType, TypeExpression.Location); foreach (var d in declarators) { var ef = new EventField (Parent, t, mod_flags_src, new MemberName (d.Name.Value, d.Name.Location), OptAttributes); if (d.Initializer != null) ef.initializer = d.Initializer; ef.Define (); Parent.PartialContainer.Members.Add (ef); } } if (!HasBackingField) { SetIsUsed (); return true; } if (Add.IsInterfaceImplementation) SetIsUsed (); backing_field = new Field (Parent, new TypeExpression (MemberType, Location), Modifiers.BACKING_FIELD | Modifiers.COMPILER_GENERATED | Modifiers.PRIVATE | (ModFlags & (Modifiers.STATIC | Modifiers.UNSAFE)), MemberName, null); Parent.PartialContainer.Members.Add (backing_field); backing_field.Initializer = Initializer; backing_field.ModFlags &= ~Modifiers.COMPILER_GENERATED; // Call define because we passed fields definition backing_field.Define (); // Set backing field for event fields spec.BackingField = backing_field.Spec; return true; }
protected override bool DoDefineMembers () { var builtin_types = Compiler.BuiltinTypes; var ctor_parameters = ParametersCompiled.CreateFullyResolved ( new [] { new Parameter (new TypeExpression (builtin_types.Object, Location), "object", Parameter.Modifier.NONE, null, Location), new Parameter (new TypeExpression (builtin_types.IntPtr, Location), "method", Parameter.Modifier.NONE, null, Location) }, new [] { builtin_types.Object, builtin_types.IntPtr } ); Constructor = new Constructor (this, Constructor.ConstructorName, Modifiers.PUBLIC, null, ctor_parameters, Location); Constructor.Define (); // // Here the various methods like Invoke, BeginInvoke etc are defined // // First, call the `out of band' special method for // defining recursively any types we need: // var p = parameters; if (!p.Resolve (this)) return false; // // Invoke method // // Check accessibility foreach (var partype in p.Types) { if (!IsAccessibleAs (partype)) { Report.SymbolRelatedToPreviousError (partype); Report.Error (59, Location, "Inconsistent accessibility: parameter type `{0}' is less accessible than delegate `{1}'", partype.GetSignatureForError (), GetSignatureForError ()); } } var ret_type = ReturnType.ResolveAsType (this); if (ret_type == null) return false; // // We don't have to check any others because they are all // guaranteed to be accessible - they are standard types. // if (!IsAccessibleAs (ret_type)) { Report.SymbolRelatedToPreviousError (ret_type); Report.Error (58, Location, "Inconsistent accessibility: return type `" + ret_type.GetSignatureForError () + "' is less " + "accessible than delegate `" + GetSignatureForError () + "'"); return false; } CheckProtectedModifier (); if (Compiler.Settings.StdLib && ret_type.IsSpecialRuntimeType) { Method.Error1599 (Location, ret_type, Report); return false; } VarianceDecl.CheckTypeVariance (ret_type, Variance.Covariant, this); var resolved_rt = new TypeExpression (ret_type, Location); InvokeBuilder = new Method (this, resolved_rt, MethodModifiers, new MemberName (InvokeMethodName), p, null); InvokeBuilder.Define (); // // Don't emit async method for compiler generated delegates (e.g. dynamic site containers) // if (!IsCompilerGenerated) { DefineAsyncMethods (resolved_rt); } return true; }
public void ChangeToAsync () { ModFlags |= Modifiers.ASYNC; ModFlags &= ~Modifiers.UNSAFE; type_expr = new TypeExpression(Module.PredefinedTypes.Task.TypeSpec, Location); parameters = ParametersCompiled.EmptyReadOnlyParameters; }
void DefineAsyncMethods (TypeExpression returnType) { var iasync_result = Module.PredefinedTypes.IAsyncResult; var async_callback = Module.PredefinedTypes.AsyncCallback; // // It's ok when async types don't exist, the delegate will have Invoke method only // if (!iasync_result.Define () || !async_callback.Define ()) return; // // BeginInvoke // ParametersCompiled async_parameters; if (Parameters.Count == 0) { async_parameters = ParametersCompiled.EmptyReadOnlyParameters; } else { var compiled = new Parameter[Parameters.Count]; for (int i = 0; i < compiled.Length; ++i) { var p = parameters[i]; compiled[i] = new Parameter (new TypeExpression (parameters.Types[i], Location), p.Name, p.ModFlags & Parameter.Modifier.RefOutMask, p.OptAttributes == null ? null : p.OptAttributes.Clone (), Location); } async_parameters = new ParametersCompiled (compiled); } async_parameters = ParametersCompiled.MergeGenerated (Compiler, async_parameters, false, new Parameter[] { new Parameter (new TypeExpression (async_callback.TypeSpec, Location), "callback", Parameter.Modifier.NONE, null, Location), new Parameter (new TypeExpression (Compiler.BuiltinTypes.Object, Location), "object", Parameter.Modifier.NONE, null, Location) }, new [] { async_callback.TypeSpec, Compiler.BuiltinTypes.Object } ); BeginInvokeBuilder = new Method (this, new TypeExpression (iasync_result.TypeSpec, Location), MethodModifiers, new MemberName ("BeginInvoke"), async_parameters, null); BeginInvokeBuilder.Define (); // // EndInvoke is a bit more interesting, all the parameters labeled as // out or ref have to be duplicated here. // // // Define parameters, and count out/ref parameters // ParametersCompiled end_parameters; int out_params = 0; foreach (Parameter p in Parameters.FixedParameters) { if ((p.ModFlags & Parameter.Modifier.RefOutMask) != 0) ++out_params; } if (out_params > 0) { Parameter[] end_params = new Parameter[out_params]; int param = 0; for (int i = 0; i < Parameters.FixedParameters.Length; ++i) { Parameter p = parameters [i]; if ((p.ModFlags & Parameter.Modifier.RefOutMask) == 0) continue; end_params [param++] = new Parameter (new TypeExpression (p.Type, Location), p.Name, p.ModFlags & Parameter.Modifier.RefOutMask, p.OptAttributes == null ? null : p.OptAttributes.Clone (), Location); } end_parameters = new ParametersCompiled (end_params); } else { end_parameters = ParametersCompiled.EmptyReadOnlyParameters; } end_parameters = ParametersCompiled.MergeGenerated (Compiler, end_parameters, false, new Parameter ( new TypeExpression (iasync_result.TypeSpec, Location), "result", Parameter.Modifier.NONE, null, Location), iasync_result.TypeSpec); // // Create method, define parameters, register parameters with type system // EndInvokeBuilder = new Method (this, returnType, MethodModifiers, new MemberName ("EndInvoke"), end_parameters, null); EndInvokeBuilder.Define (); }
public override bool Define () { if (!base.Define ()) return false; if (!BuiltinTypeSpec.IsPrimitiveType (MemberType)) { Report.Error (1663, Location, "`{0}': Fixed size buffers type must be one of the following: bool, byte, short, int, long, char, sbyte, ushort, uint, ulong, float or double", GetSignatureForError ()); } else if (declarators != null) { var t = new TypeExpression (MemberType, TypeExpression.Location); int index = Parent.PartialContainer.Fields.IndexOf (this); foreach (var d in declarators) { var f = new FixedField (Parent, t, ModFlags, new MemberName (d.Name.Value, d.Name.Location), OptAttributes); f.initializer = d.Initializer; ((ConstInitializer) f.initializer).Name = d.Name.Value; Parent.PartialContainer.Fields.Insert (++index, f); } } // Create nested fixed buffer container string name = String.Format ("<{0}>__FixedBuffer{1}", Name, GlobalCounter++); fixed_buffer_type = Parent.TypeBuilder.DefineNestedType (name, TypeAttributes.NestedPublic | TypeAttributes.Sealed | TypeAttributes.BeforeFieldInit, Compiler.BuiltinTypes.ValueType.GetMetaInfo ()); var ffield = fixed_buffer_type.DefineField (FixedElementName, MemberType.GetMetaInfo (), FieldAttributes.Public); FieldBuilder = Parent.TypeBuilder.DefineField (Name, fixed_buffer_type, ModifiersExtensions.FieldAttr (ModFlags)); var element_spec = new FieldSpec (null, this, MemberType, ffield, ModFlags); spec = new FixedFieldSpec (Parent.Definition, this, FieldBuilder, element_spec, ModFlags); Parent.MemberCache.AddMember (spec); return true; }
protected override Expression DoResolve (ResolveContext ec) { constructor_method = Delegate.GetConstructor (type); var invoke_method = Delegate.GetInvokeMethod (type); if (!ec.HasSet (ResolveContext.Options.ConditionalAccessReceiver)) { if (method_group.HasConditionalAccess ()) { conditional_access_receiver = true; ec.Set (ResolveContext.Options.ConditionalAccessReceiver); } } Arguments arguments = CreateDelegateMethodArguments (ec, invoke_method.Parameters, invoke_method.Parameters.Types, loc); method_group = method_group.OverloadResolve (ec, ref arguments, this, OverloadResolver.Restrictions.CovariantDelegate); if (conditional_access_receiver) ec.With (ResolveContext.Options.ConditionalAccessReceiver, false); if (method_group == null) return null; var delegate_method = method_group.BestCandidate; if (delegate_method.DeclaringType.IsNullableType) { ec.Report.Error (1728, loc, "Cannot create delegate from method `{0}' because it is a member of System.Nullable<T> type", delegate_method.GetSignatureForError ()); return null; } if (!AllowSpecialMethodsInvocation) Invocation.IsSpecialMethodInvocation (ec, delegate_method, loc); ExtensionMethodGroupExpr emg = method_group as ExtensionMethodGroupExpr; if (emg != null) { method_group.InstanceExpression = emg.ExtensionExpression; TypeSpec e_type = emg.ExtensionExpression.Type; if (TypeSpec.IsValueType (e_type)) { ec.Report.Error (1113, loc, "Extension method `{0}' of value type `{1}' cannot be used to create delegates", delegate_method.GetSignatureForError (), e_type.GetSignatureForError ()); } } TypeSpec rt = method_group.BestCandidateReturnType; if (rt.BuiltinType == BuiltinTypeSpec.Type.Dynamic) rt = ec.BuiltinTypes.Object; if (!Delegate.IsTypeCovariant (ec, rt, invoke_method.ReturnType)) { Expression ret_expr = new TypeExpression (delegate_method.ReturnType, loc); Error_ConversionFailed (ec, delegate_method, ret_expr); } if (method_group.IsConditionallyExcluded) { ec.Report.SymbolRelatedToPreviousError (delegate_method); MethodOrOperator m = delegate_method.MemberDefinition as MethodOrOperator; if (m != null && m.IsPartialDefinition) { ec.Report.Error (762, loc, "Cannot create delegate from partial method declaration `{0}'", delegate_method.GetSignatureForError ()); } else { ec.Report.Error (1618, loc, "Cannot create delegate with `{0}' because it has a Conditional attribute", TypeManager.CSharpSignature (delegate_method)); } } var expr = method_group.InstanceExpression; if (expr != null && (expr.Type.IsGenericParameter || !TypeSpec.IsReferenceType (expr.Type))) method_group.InstanceExpression = new BoxedCast (expr, ec.BuiltinTypes.Object); eclass = ExprClass.Value; return this; }
// // Public function used to locate types. // // Set 'ignore_cs0104' to true if you want to ignore cs0104 errors. // // Returns: Type or null if they type can not be found. // public override FullNamedExpression LookupNamespaceOrType (string name, int arity, LookupMode mode, Location loc) { FullNamedExpression e; if (arity == 0 && Cache.TryGetValue (name, out e) && mode != LookupMode.IgnoreAccessibility) return e; e = null; if (arity == 0) { var tp = CurrentTypeParameters; if (tp != null) { TypeParameter tparam = tp.Find (name); if (tparam != null) e = new TypeParameterExpr (tparam, Location.Null); } } if (e == null) { TypeSpec t = LookupNestedTypeInHierarchy (name, arity); if (t != null && (t.IsAccessible (this) || mode == LookupMode.IgnoreAccessibility)) e = new TypeExpression (t, Location.Null); else { e = Parent.LookupNamespaceOrType (name, arity, mode, loc); } } // TODO MemberCache: How to cache arity stuff ? if (arity == 0 && mode == LookupMode.Normal) Cache[name] = e; return e; }
FullNamedExpression Lookup (string name, int arity, LookupMode mode, Location loc) { // // Check whether it's in the namespace. // FullNamedExpression fne = ns.LookupTypeOrNamespace (this, name, arity, mode, loc); // // Check aliases. // if (aliases != null && arity == 0) { UsingAliasNamespace uan; if (aliases.TryGetValue (name, out uan)) { if (fne != null && mode != LookupMode.Probing) { // TODO: Namespace has broken location //Report.SymbolRelatedToPreviousError (fne.Location, null); Compiler.Report.SymbolRelatedToPreviousError (uan.Location, null); Compiler.Report.Error (576, loc, "Namespace `{0}' contains a definition with same name as alias `{1}'", GetSignatureForError (), name); } return uan.ResolvedExpression; } } if (fne != null) return fne; // // Lookup can be called before the namespace is defined from different namespace using alias clause // if (namespace_using_table == null) { DoDefineNamespace (); } // // Check using entries. // FullNamedExpression match = null; foreach (Namespace using_ns in namespace_using_table) { // // A using directive imports only types contained in the namespace, it // does not import any nested namespaces // var t = using_ns.LookupType (this, name, arity, mode, loc); if (t == null) continue; fne = new TypeExpression (t, loc); if (match == null) { match = fne; continue; } // Prefer types over namespaces var texpr_fne = fne as TypeExpr; var texpr_match = match as TypeExpr; if (texpr_fne != null && texpr_match == null) { match = fne; continue; } else if (texpr_fne == null) { continue; } // It can be top level accessibility only var better = Namespace.IsImportedTypeOverride (Module, texpr_match.Type, texpr_fne.Type); if (better == null) { if (mode == LookupMode.Normal) { Compiler.Report.SymbolRelatedToPreviousError (texpr_match.Type); Compiler.Report.SymbolRelatedToPreviousError (texpr_fne.Type); Compiler.Report.Error (104, loc, "`{0}' is an ambiguous reference between `{1}' and `{2}'", name, texpr_match.GetSignatureForError (), texpr_fne.GetSignatureForError ()); } return match; } if (better == texpr_fne.Type) match = texpr_fne; } return match; }
public void AddCapturedThisField (EmitContext ec) { TypeExpr type_expr = new TypeExpression (ec.CurrentType, Location); Field f = AddCompilerGeneratedField ("$this", type_expr); hoisted_this = new HoistedThis (this, f); initialize_hoisted_this = true; }
// // Public function used to locate types. // // Set 'ignore_cs0104' to true if you want to ignore cs0104 errors. // // Returns: Type or null if they type can not be found. // public override FullNamedExpression LookupNamespaceOrType (string name, int arity, Location loc, bool ignore_cs0104) { FullNamedExpression e; if (arity == 0 && Cache.TryGetValue (name, out e)) return e; e = null; int errors = Report.Errors; if (arity == 0) { TypeParameter[] tp = CurrentTypeParameters; if (tp != null) { TypeParameter tparam = TypeParameter.FindTypeParameter (tp, name); if (tparam != null) e = new TypeParameterExpr (tparam, Location.Null); } } if (e == null) { TypeSpec t = LookupNestedTypeInHierarchy (name, arity); if (t != null) e = new TypeExpression (t, Location.Null); else if (Parent != null) { e = Parent.LookupNamespaceOrType (name, arity, loc, ignore_cs0104); } else e = NamespaceEntry.LookupNamespaceOrType (name, arity, loc, ignore_cs0104); } // TODO MemberCache: How to cache arity stuff ? if (errors == Report.Errors && arity == 0) Cache[name] = e; return e; }
TypeExpr CreateStoreyTypeExpression (EmitContext ec) { // // Create an instance of storey type // TypeExpr storey_type_expr; if (CurrentTypeParameters != null) { // // Use current method type parameter (MVAR) for top level storey only. All // nested storeys use class type parameter (VAR) // var tparams = ec.CurrentAnonymousMethod != null && ec.CurrentAnonymousMethod.Storey != null ? ec.CurrentAnonymousMethod.Storey.CurrentTypeParameters : ec.CurrentTypeParameters; TypeArguments targs = new TypeArguments (); // // Use type parameter name instead of resolved type parameter // specification to resolve to correctly nested type parameters // for (int i = 0; i < tparams.Count; ++i) targs.Add (new SimpleName (tparams [i].Name, Location)); // new TypeParameterExpr (tparams[i], Location)); storey_type_expr = new GenericTypeExpr (Definition, targs, Location); } else { storey_type_expr = new TypeExpression (CurrentType, Location); } return storey_type_expr; }
FullNamedExpression Lookup(string name, int arity, LookupMode mode, Location loc) { // // Check whether it's in the namespace. // FullNamedExpression fne = ns.LookupTypeOrNamespace (this, name, arity, mode, loc); // // Check aliases. // if (aliases != null && arity == 0) { UsingAliasNamespace uan; if (aliases.TryGetValue (name, out uan)) { if (fne != null && mode != LookupMode.Probing) { // TODO: Namespace has broken location //Report.SymbolRelatedToPreviousError (fne.Location, null); Compiler.Report.SymbolRelatedToPreviousError (uan.Location, null); Compiler.Report.Error (576, loc, "Namespace `{0}' contains a definition with same name as alias `{1}'", GetSignatureForError (), name); } if (uan.ResolvedExpression == null) uan.Define (this); return uan.ResolvedExpression; } } if (fne != null) return fne; // // Lookup can be called before the namespace is defined from different namespace using alias clause // if (namespace_using_table == null) { DoDefineNamespace (); } // // Check using entries. // FullNamedExpression match = null; foreach (Namespace using_ns in namespace_using_table) { // // A using directive imports only types contained in the namespace, it // does not import any nested namespaces // var t = using_ns.LookupType (this, name, arity, mode, loc); if (t == null) continue; fne = new TypeExpression (t, loc); if (match == null) { match = fne; continue; } // Prefer types over namespaces var texpr_fne = fne as TypeExpr; var texpr_match = match as TypeExpr; if (texpr_fne != null && texpr_match == null) { match = fne; continue; } else if (texpr_fne == null) { continue; } // It can be top level accessibility only var better = Namespace.IsImportedTypeOverride (Module, texpr_match.Type, texpr_fne.Type); if (better == null) { if (mode == LookupMode.Normal) { Error_AmbiguousReference (name, texpr_match, texpr_fne, loc); } return match; } if (better == texpr_fne.Type) match = texpr_fne; } if (types_using_table != null) { foreach (var using_type in types_using_table) { var members = MemberCache.FindMembers (using_type, name, true); if (members == null) continue; foreach (var member in members) { if (arity > 0 && member.Arity != arity) continue; if ((member.Kind & MemberKind.NestedMask) != 0) { // non-static nested type is included with using static } else { if ((member.Modifiers & Modifiers.STATIC) == 0) continue; if ((member.Modifiers & Modifiers.METHOD_EXTENSION) != 0) continue; if (mode == LookupMode.Normal) throw new NotImplementedException (); return null; } fne = new TypeExpression ((TypeSpec) member, loc); if (match == null) { match = fne; continue; } if (mode == LookupMode.Normal) { Error_AmbiguousReference (name, match, fne, loc); } } } } return match; }