royale-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com.INVALID>
Subject Re: Compiler error using static function toString
Date Fri, 04 May 2018 16:47:58 GMT
Hmm.  I agree that doesn't make sense.  Try changing the name of the function just to see if
there is sensitivity to the "toString".  "toString" is handled in a strange way in AS.

-Alex

´╗┐On 5/4/18, 6:13 AM, "Spiros Aggelopoulos" <aggelopoulos@novusnet.eu> wrote:

    Hi , 
    there is a compiler error on the code bellow, 
    is any reason to avoid this type of code? Or it is a bug ?
    
    
    
    package org.comp
    {
    	public class ToStringImp
    	{
    		public static function toString(str:String):String
    		{
    			return str;
    		}
    	}
    }
    
    
    package org.comp
    {
    	import org.apache.royale.events.EventDispatcher;
    	import org.apache.royale.events.IEventDispatcher;
    	
    	public class CompError extends EventDispatcher
    	{
    		public function CompError(target:IEventDispatcher=null)
    		{
    			super(target);
    		}
    		
    		override public function toString():String
    		{
    			
    			//compiler message : 
    			//1137: Incorrect number of arguments.  Expected no
    more than 0	
    			return ToStringImp.toString("some string value");
    		}
    	}
    }
    
    Thanks , 
    
    Spiros 
    
    
    
    
    
    
    
    
    
    
    
    

Mime
View raw message