Exemplo n.º 1
0
			public SetMethod (PropertyBase method, Modifiers modifiers, ParametersCompiled parameters, Attributes attrs, Location loc)
				: base (method, Prefix, modifiers, attrs, loc)
			{
				this.parameters = parameters;
			}
Exemplo n.º 2
0
			public PropertyMethod (PropertyBase method, string prefix, Modifiers modifiers, Attributes attrs, Location loc)
				: base (method, prefix, attrs, loc)
			{
				this.method = method;
				this.ModFlags = ModifiersExtensions.Check (AllowedModifiers, modifiers, 0, loc, Report);
				this.ModFlags |= (method.ModFlags & (Modifiers.STATIC | Modifiers.UNSAFE));
			}
Exemplo n.º 3
0
			public SetIndexerMethod (PropertyBase property, Modifiers modifiers, ParametersCompiled parameters, Attributes attrs, Location loc)
				: base (property, modifiers, parameters, attrs, loc)
			{
			}
Exemplo n.º 4
0
			public GetMethod (PropertyBase method, Modifiers modifiers, Attributes attrs, Location loc)
				: base (method, Prefix, modifiers, attrs, loc)
			{
			}
Exemplo n.º 5
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;
	  }
Exemplo n.º 6
0
void case_200()
#line 1809 "cs-parser.jay"
{
		if (current_property.AccessorFirst != null && current_property.AccessorFirst.Block == null)
			((Indexer) current_property).ParameterInfo.CheckParameters (current_property);
	  
		if (doc_support)
			current_property.DocComment = ConsumeStoredComment ();
			
		lbag.AppendToMember (current_property, GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[0+yyTop]));
		current_property = null;		
	  }
Exemplo n.º 7
0
void case_194()
#line 1745 "cs-parser.jay"
{
		var type = (FullNamedExpression) yyVals[-3+yyTop];
		current_property = new Property (current_type, type, (Modifiers) yyVals[-4+yyTop],
			(MemberName) yyVals[-2+yyTop], (Attributes) yyVals[-5+yyTop]);
			
		if (type.Type != null && type.Type.Kind == MemberKind.Void)
			report.Error (547, GetLocation (yyVals[-3+yyTop]), "`{0}': property or indexer cannot have void type", current_property.GetSignatureForError ());					
			
		current_type.AddMember (current_property);
		lbag.AddMember (current_property, GetModifierLocations (), GetLocation (yyVals[0+yyTop]));
		
		lexer.PropertyParsing = true;
	  }
Exemplo n.º 8
0
void case_196()
#line 1766 "cs-parser.jay"
{
		lbag.AppendToMember (current_property, GetLocation (yyVals[0+yyTop]));
		current_property = null;
	  }
Exemplo n.º 9
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;
	  }
Exemplo n.º 10
0
void case_228()
#line 2313 "ps-parser.jay"
{
  		CheckIsPlayScript("indexer", GetLocation(yyVals[-12+yyTop])); 	
	  
		if (current_property.AccessorFirst != null && current_property.AccessorFirst.Block == null)
			((Indexer) current_property).ParameterInfo.CheckParameters (current_property);
	  
		if (doc_support)
			current_property.DocComment = ConsumeStoredComment ();
			
		lbag.AppendToMember (current_property, GetLocation (yyVals[-3+yyTop]));
		current_property = null;		
	  }
Exemplo n.º 11
0
void case_224()
#line 2257 "ps-parser.jay"
{
  		CheckIsPlayScript("property", GetLocation(yyVals[-9+yyTop])); 	
  		  
		lbag.AppendToMember (current_property, GetLocation (yyVals[0+yyTop]));
		current_property = null;
	  }
Exemplo n.º 12
0
void case_222()
#line 2224 "ps-parser.jay"
{
		var type = (FullNamedExpression) yyVals[-2+yyTop];
	
		var modifiers = (Modifiers) yyVals[-6+yyTop];
	
		var name = (MemberName) yyVals[-4+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;
		
		current_property = new Property (current_type, type, modifiers,
			name, (Attributes) yyVals[-7+yyTop]);
			
		if (type.Type != null && type.Type.Kind == MemberKind.Void)
			report.Error (547, GetLocation (yyVals[-5+yyTop]), "`{0}': property or indexer cannot have void type", current_property.GetSignatureForError ());					
			
		if (is_config_enabled) {
			current_type.AddMember (current_property);
		}
		is_config_enabled = true;
		lbag.AddMember (current_property, GetModifierLocations (), GetLocation (yyVals[0+yyTop]));
		
		lexer.PropertyParsing = true;
	  }
Exemplo n.º 13
0
void case_184()
#line 1735 "ps-parser.jay"
{
		var void_type = (FullNamedExpression) yyVals[0+yyTop];
		var name = (MemberName) yyVals[-6+yyTop];
		var modifiers = (Modifiers) yyVals[-8+yyTop];
		var parameters = (ParametersCompiled) yyVals[-3+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;
		
		if (void_type.Type != null && void_type.Type.Kind != MemberKind.Void)
			report.Error (7003, GetLocation (yyVals[0+yyTop]), "Property setter function must not be of type void");					

		current_property = null;
						
		MemberCore member;
		if (current_type.DefinedNames.TryGetValue(name.Name, out member)) {
			current_property = member as Property;
		}

		FullNamedExpression type; 
		
		if (parameters == null || parameters.Count != 1 || parameters.FixedParameters.Length != parameters.Count) {
			report.Error (7001, GetLocation (yyVals[-3+yyTop]), "Property setter must have a single parameter");
			type = new TypeExpression (compiler.BuiltinTypes.Int, GetLocation (yyVals[-3+yyTop]));
		} else {
			type = ((Parameter)parameters.FixedParameters[0]).TypeExpression;	
		}
				
		if (current_property == null) {
			current_property = new Property (current_type, type, modifiers, name, (Attributes) yyVals[-9+yyTop]);
			if (is_config_enabled) {
				current_type.AddMember (current_property);
			}
			is_config_enabled = true;
			modifiers = (Modifiers) 0;			
		} else {
/*			if (!type.Equals(current_property.TypeExpression)) {*/
/*				report.Error (7002, GetLocation ($10), "Type of property getter and setter must match", current_property.GetSignatureForError ());*/
/*			}*/
			if (current_property.Get != null && ModifiersExtensions.IsRestrictedModifier (current_property.ModFlags & Modifiers.AccessibilityMask, modifiers & Modifiers.AccessibilityMask)) {
				current_property.Get.ModFlags |= current_property.ModFlags & Modifiers.AccessibilityMask;
				current_property.ModFlags = (current_property.ModFlags & ~Modifiers.AccessibilityMask) | (modifiers & Modifiers.AccessibilityMask);
				modifiers = (Modifiers) 0;
			} else if ((modifiers & Modifiers.AccessibilityMask) == (current_property.ModFlags & Modifiers.AccessibilityMask)) {
				modifiers = (Modifiers) 0;
			}
		}
		
		if (current_property.Set != null) {
			report.Error (1007, GetLocation (yyVals[-7+yyTop]), "Property accessor already defined");
		}
		
		current_property.Set = new Property.SetMethod (current_property, 
			modifiers & Modifiers.AccessibilityMask, (ParametersCompiled) yyVals[-3+yyTop], (Attributes) yyVals[-9+yyTop], GetLocation (yyVals[-7+yyTop]));
	  
		lbag.AddMember (current_property, GetModifierLocations (), GetLocation (yyVals[0+yyTop]));
		current_local_parameters = parameters;
		yyVal = current_property.Set;
	  }
Exemplo n.º 14
0
void case_182()
#line 1674 "ps-parser.jay"
{
		var type = (FullNamedExpression) yyVals[0+yyTop];
		var name = (MemberName) yyVals[-6+yyTop];
		var modifiers = (Modifiers) yyVals[-8+yyTop];
		var parameters = (ParametersCompiled) yyVals[-3+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;

		if (parameters != null && parameters.Count > 0)
			report.Error (7016, GetLocation (yyVals[0+yyTop]), "Property getter functions may not have parameters");

		current_property = null;		
						
		MemberCore member;
		if (current_type.DefinedNames.TryGetValue(name.Name, out member)) {
			current_property = member as Property;
		}
		
		if (current_property == null) {
			current_property = new Property (current_type, type, modifiers, name, (Attributes) yyVals[-9+yyTop]);
			if (is_config_enabled) {
				current_type.AddMember (current_property);
			}
			is_config_enabled = true;
			modifiers = (Modifiers) 0;
		} else {
/*			if (!type.Equals(current_property.TypeExpression)) {*/
/*				report.Error (7002, GetLocation ($10), "Type of property getter and setter must match", current_property.GetSignatureForError ());*/
/*			}*/
			if (current_property.Set != null && ModifiersExtensions.IsRestrictedModifier (current_property.ModFlags & Modifiers.AccessibilityMask, modifiers & Modifiers.AccessibilityMask)) {
				current_property.Set.ModFlags |= current_property.ModFlags & Modifiers.AccessibilityMask;
				current_property.ModFlags = (current_property.ModFlags & ~Modifiers.AccessibilityMask) | (modifiers & Modifiers.AccessibilityMask);
				modifiers = (Modifiers) 0;
			} else if ((modifiers & Modifiers.AccessibilityMask) == (current_property.ModFlags & Modifiers.AccessibilityMask)) {
				modifiers = (Modifiers) 0;
			}
		}
		
		if (type.Type != null && type.Type.Kind == MemberKind.Void)
			report.Error (547, GetLocation (yyVals[0+yyTop]), "`{0}': property or indexer cannot have void type", current_property.GetSignatureForError ());					
			
		if (current_property.Get != null) {
			report.Error (1007, GetLocation (yyVals[-7+yyTop]), "Property accessor already defined");
		}
		
		current_property.Get = new Property.GetMethod (current_property,
			modifiers & Modifiers.AccessibilityMask, (Attributes) yyVals[-9+yyTop], GetLocation (yyVals[-7+yyTop]));
	  
		lbag.AddMember (current_property, GetModifierLocations (), GetLocation (yyVals[0+yyTop]));
		current_local_parameters = current_property.Get.ParameterInfo;
		yyVal = current_property.Get;
	  }
Exemplo n.º 15
0
void case_177()
#line 1513 "ps-parser.jay"
{
		if (is_package_function)
			lexer.DynamicParsing = true;
	  
	 	async_block = false;

		if (yyVals[-2+yyTop] is Method) {
		
			Method method = yyVals[-2+yyTop] as Method;
			
			if (yyVals[0+yyTop] == null) {
				lbag.AppendToMember (method, savedLocation); /* semicolon			*/
				method.ParameterInfo.CheckParameters (method);
	
				if ((method.ModFlags & Modifiers.ASYNC) != 0) {
					report.Error (1994, method.Location, "`{0}': The async modifier can only be used with methods that have a body",
						method.GetSignatureForError ());
				}
			} else {
				method.Block = (ToplevelBlock) yyVals[0+yyTop];
				
				if (current_container.Kind == MemberKind.Interface) {
					report.Error (531, method.Location, "`{0}': interface members cannot have a definition",
						method.GetSignatureForError ());
				}
			}
			
		} else if (yyVals[-2+yyTop] is Constructor) {
		
			Constructor c = yyVals[-2+yyTop] as Constructor;
			
			if (yyVals[0+yyTop] != null) {		
				c.Block = (ToplevelBlock) yyVals[0+yyTop];
			}
			
			if (doc_support)
				c.DocComment = ConsumeStoredComment ();
		
		} else {
		
			Property.PropertyMethod propMethod = yyVals[-2+yyTop] as Property.PropertyMethod;
			
			if (yyVals[0+yyTop] != null) {
		  		propMethod.Block = (ToplevelBlock) yyVals[0+yyTop];			
		  	
				if (current_container.Kind == MemberKind.Interface) {
					report.Error (531, propMethod.Block.StartLocation,
						"`{0}': interface members cannot have a definition", propMethod.GetSignatureForError ());
				}
			}
			
		}

		current_local_parameters = null;
		current_property = null;
		current_constructor = null;
		
		/* If this was a package function, pop the container xxxxx_fn class.*/
		if (is_package_function) {
			pop_current_class();
			is_package_function = false;
		}
	
		if (doc_support)
			Lexer.doc_state = XmlCommentState.Allowed;
	  }