Ejemplo n.º 1
0
void case_198()
#line 1780 "cs-parser.jay"
{
		valid_param_mod = 0;
		var type = (FullNamedExpression) yyVals[-5+yyTop];
		Indexer indexer = new Indexer (current_type, type, (MemberName) yyVals[-4+yyTop], (Modifiers) yyVals[-6+yyTop], (ParametersCompiled) yyVals[-1+yyTop], (Attributes) yyVals[-7+yyTop]);
			
		current_property = indexer;

  		current_type.AddIndexer (indexer);
		lbag.AddMember (current_property, GetModifierLocations (), GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[0+yyTop]));
  		
		if (type.Type != null && type.Type.Kind == MemberKind.Void)
			report.Error (620, GetLocation (yyVals[-5+yyTop]), "`{0}': indexer return type cannot be `void'", indexer.GetSignatureForError ());  		

		if (indexer.ParameterInfo.IsEmpty) {
			report.Error (1551, GetLocation (yyVals[-3+yyTop]), "Indexers must have at least one parameter");
		}

		if (doc_support) {
			tmpComment = Lexer.consume_doc_comment ();
			Lexer.doc_state = XmlCommentState.Allowed;
		}

		lexer.PropertyParsing = true;
	  }
Ejemplo n.º 2
0
void case_226()
#line 2272 "ps-parser.jay"
{
		valid_param_mod = 0;
		var type = (FullNamedExpression) yyVals[-1+yyTop];

		var modifiers = (Modifiers) yyVals[-9+yyTop];
		
		var name = (MemberName) yyVals[-7+yyTop];

		if (current_container.Kind == MemberKind.Class && name.ExplicitInterface == null && 
			(modifiers & (Modifiers.NEW | Modifiers.SEALED | Modifiers.STATIC | Modifiers.PRIVATE | Modifiers.VIRTUAL | Modifiers.OVERRIDE)) == 0)
				modifiers |= Modifiers.VIRTUAL;
		
		Indexer indexer = new Indexer (current_type, type, name, modifiers, (ParametersCompiled) yyVals[-4+yyTop], (Attributes) yyVals[-10+yyTop]);
			
		current_property = indexer;

		if (is_config_enabled) {
	  		current_type.AddIndexer (indexer);
	  	}
	  	is_config_enabled = true;
		lbag.AddMember (current_property, GetModifierLocations (), GetLocation (yyVals[-6+yyTop]), GetLocation (yyVals[-3+yyTop]));
  		
		if (type.Type != null && type.Type.Kind == MemberKind.Void)
			report.Error (620, GetLocation (yyVals[-8+yyTop]), "`{0}': indexer return type cannot be `void'", indexer.GetSignatureForError ());  		

		if (indexer.ParameterInfo.IsEmpty) {
			report.Error (1551, GetLocation (yyVals[-6+yyTop]), "Indexers must have at least one parameter");
		}

		if (doc_support) {
			tmpComment = Lexer.consume_doc_comment ();
			Lexer.doc_state = XmlCommentState.Allowed;
		}

		lexer.PropertyParsing = true;
	  }