You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Harbs <ha...@gmail.com> on 2018/02/25 11:32:23 UTC

Re: [royale-asjs] 01/01: Added Map

I need help here:

By adding the Map class for SWF, that seems to mess up the Map reference in JS blocks in ObjectMap. For some reason, the SWF class makes the compiler not find the extern definition of Map on the JS side. I’m not sure why.

Any thoughts?
Harbs

> On Feb 25, 2018, at 1:30 PM, harbs@apache.org wrote:
> 
> This is an automated email from the ASF dual-hosted git repository.
> 
> harbs pushed a commit to branch feature/native-js
> in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
> 
> commit fa36e70dc9dfd924db30a512f1a2f8622e218ae4
> Author: Harbs <ha...@in-tools.com>
> AuthorDate: Sun Feb 25 13:30:10 2018 +0200
> 
>    Added Map
> ---
> .../projects/Core/src/main/royale/CoreClasses.as   |   6 ++
> frameworks/projects/Core/src/main/royale/Map.as    | 101 +++++++++++++++++++++
> 2 files changed, 107 insertions(+)
> 
> diff --git a/frameworks/projects/Core/src/main/royale/CoreClasses.as b/frameworks/projects/Core/src/main/royale/CoreClasses.as
> index 0408118..fc9595e 100644
> --- a/frameworks/projects/Core/src/main/royale/CoreClasses.as
> +++ b/frameworks/projects/Core/src/main/royale/CoreClasses.as
> @@ -224,6 +224,12 @@ internal class CoreClasses
> 		import org.apache.royale.core.WrappedHTMLElement ;WrappedHTMLElement;
> 	    import org.apache.royale.core.IRoyaleElement; IRoyaleElement;
> 	}
> +
> +	//JS native classes
> +	COMPILE::SWF
> +	{
> +		import Map; Map;
> +	}
> 	//Package Level Functions
> 	import org.apache.royale.debugging.assert; assert;
> 	import org.apache.royale.debugging.assertType; assertType;
> diff --git a/frameworks/projects/Core/src/main/royale/Map.as b/frameworks/projects/Core/src/main/royale/Map.as
> new file mode 100644
> index 0000000..e2549ea
> --- /dev/null
> +++ b/frameworks/projects/Core/src/main/royale/Map.as
> @@ -0,0 +1,101 @@
> +////////////////////////////////////////////////////////////////////////////////
> +//
> +//  Licensed to the Apache Software Foundation (ASF) under one or more
> +//  contributor license agreements.  See the NOTICE file distributed with
> +//  this work for additional information regarding copyright ownership.
> +//  The ASF licenses this file to You under the Apache License, Version 2.0
> +//  (the "Licens"); you may not use this file except in compliance with
> +//  the License.  You may obtain a copy of the License at
> +//
> +//      http://www.apache.org/licenses/LICENSE-2.0
> +//
> +//  Unless required by applicable law or agreed to in writing, software
> +//  distributed under the License is distributed on an "AS IS" BASIS,
> +//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> +//  See the License for the specific language governing permissions and
> +//  limitations under the License.
> +//
> +////////////////////////////////////////////////////////////////////////////////
> +package
> +{
> +    COMPILE::SWF
> +    {
> +        import flash.utils.Dictionary;
> +    }
> +    COMPILE::SWF
> +    public class Map
> +    {
> +        public function Map(iterable:Object=null)
> +        {
> +            dict = new Dictionary();
> +        }
> +
> +        private var dict:Dictionary;
> +        public static const length:int = 0;
> +
> +        private var _keys:Array = [];
> +        public function get size():int
> +        {
> +            return _keys.length;
> +        }
> +
> +        public function clear():void
> +        {
> +            dict = new Dictionary();
> +            _keys = [];
> +        }
> +
> +        public function delete(key:*):Boolean
> +        {
> +            var idx:int = _keys.indexOf(key);
> +            if(idx != -1){
> +                _keys.splice(idx,1);
> +            }
> +            return delete dict[key];
> +        }
> +
> +        //TODO requires Iterator
> +        // public function entries():Iterator
> +        // {
> +            
> +        // }
> +
> +        public function forEach(callback:Function,thisArg:Object = null):void
> +        {
> +            thisArg = thisArg ? thisArg : this;
> +            var len:int = _keys.length;
> +            for(var i:int = 0; i < len; i++)
> +            {
> +                callback.call(thisArg,dict[_keys[i]],i,this);
> +            }
> +        }
> +
> +        public function get(key:Object):*
> +        {
> +            return dict[key];
> +        }
> +
> +        public function has(key:Object):Boolean
> +        {
> +            return dict[key] != null;
> +        }
> +
> +        //TODO requires Iterator
> +        // public function keys():Iterator
> +        // {
> +            
> +        // }
> +
> +        public function set(key:Object,value:*):Map
> +        {
> +            dict[key] = value;
> +            return this;
> +        }
> +
> +        //TODO requires Iterator
> +        // public function values():Iterator
> +        // {
> +            
> +        // }
> +    }
> +}
> \ No newline at end of file
> 
> -- 
> To stop receiving notification emails like this one, please contact
> harbs@apache.org.


Re: [royale-asjs] 01/01: Added Map

Posted by Harbs <ha...@gmail.com>.
     [java] /Apache/royale-asjs/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/ObjectMap.as(69): col: 23 Error: Access of possibly undefinedproperty Map.
     [java]
     [java]             if(typeof Map == "function")
     [java]                       ^
     [java]
     [java] /Apache/royale-asjs/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/ObjectMap.as(71): col: 28 Error: Call to a possibly undefinedmethod Map.
     [java]
     [java]                 _map = new Map();
     [java]                            ^
     [java]
     [java] /Apache/royale-asjs/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/ObjectMap.as(231): col: 28 Error: Call to a possibly undefined method Map.
     [java]
     [java]                 _map = new Map();
     [java]                            ^
     [java]

> On Feb 25, 2018, at 7:12 PM, Alex Harui <ah...@adobe.com.INVALID> wrote:
> 
> Hmm.  Probably the compiler thinks Map.as is a monkey-patch over the SWC
> definition.  Source-path definitions always win.
> 
> What error do you get?
> 
> HTH,
> -Alex
> 
> On 2/25/18, 3:32 AM, "Harbs" <harbs.lists@gmail.com <ma...@gmail.com>> wrote:
> 
>> I need help here:
>> 
>> By adding the Map class for SWF, that seems to mess up the Map reference
>> in JS blocks in ObjectMap. For some reason, the SWF class makes the
>> compiler not find the extern definition of Map on the JS side. I’m not
>> sure why.
>> 
>> Any thoughts?
>> Harbs
>> 
>>> On Feb 25, 2018, at 1:30 PM, harbs@apache.org wrote:
>>> 
>>> This is an automated email from the ASF dual-hosted git repository.
>>> 
>>> harbs pushed a commit to branch feature/native-js
>>> in repository 
>>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitbox.a <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitbox.a>
>>> pache.org <http://pache.org/>%2Frepos%2Fasf%2Froyale-asjs.git&data=02%7C01%7Caharui%40adobe.c
>>> om%7Ca4bd776070724b1dcc1808d57c4378ec%7Cfa7b1b5a7b34438794aed2c178decee1%
>>> 7C0%7C0%7C636551551615381068&sdata=8rGGfy%2B3oPjqQEuqvMvxA1KB5t4lDS%2FLWH
>>> kDRxsrkmU%3D&reserved=0
>>> 
>>> commit fa36e70dc9dfd924db30a512f1a2f8622e218ae4
>>> Author: Harbs <harbs@in-tools.com <ma...@in-tools.com>>
>>> AuthorDate: Sun Feb 25 13:30:10 2018 +0200
>>> 
>>>   Added Map
>>> ---
>>> .../projects/Core/src/main/royale/CoreClasses.as   |   6 ++
>>> frameworks/projects/Core/src/main/royale/Map.as    | 101
>>> +++++++++++++++++++++
>>> 2 files changed, 107 insertions(+)
>>> 
>>> diff --git a/frameworks/projects/Core/src/main/royale/CoreClasses.as
>>> b/frameworks/projects/Core/src/main/royale/CoreClasses.as
>>> index 0408118..fc9595e 100644
>>> --- a/frameworks/projects/Core/src/main/royale/CoreClasses.as
>>> +++ b/frameworks/projects/Core/src/main/royale/CoreClasses.as
>>> @@ -224,6 +224,12 @@ internal class CoreClasses
>>> 		import org.apache.royale.core.WrappedHTMLElement ;WrappedHTMLElement;
>>> 	    import org.apache.royale.core.IRoyaleElement; IRoyaleElement;
>>> 	}
>>> +
>>> +	//JS native classes
>>> +	COMPILE::SWF
>>> +	{
>>> +		import Map; Map;
>>> +	}
>>> 	//Package Level Functions
>>> 	import org.apache.royale.debugging.assert; assert;
>>> 	import org.apache.royale.debugging.assertType; assertType;
>>> diff --git a/frameworks/projects/Core/src/main/royale/Map.as
>>> b/frameworks/projects/Core/src/main/royale/Map.as
>>> new file mode 100644
>>> index 0000000..e2549ea
>>> --- /dev/null
>>> +++ b/frameworks/projects/Core/src/main/royale/Map.as
>>> @@ -0,0 +1,101 @@
>>> 
>>> +////////////////////////////////////////////////////////////////////////
>>> ////////
>>> +//
>>> +//  Licensed to the Apache Software Foundation (ASF) under one or more
>>> +//  contributor license agreements.  See the NOTICE file distributed
>>> with
>>> +//  this work for additional information regarding copyright ownership.
>>> +//  The ASF licenses this file to You under the Apache License,
>>> Version 2.0
>>> +//  (the "Licens"); you may not use this file except in compliance with
>>> +//  the License.  You may obtain a copy of the License at
>>> +//
>>> +//      
>>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.apach <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.apach>
>>> e.org <http://e.org/>%2Flicenses%2FLICENSE-2.0&data=02%7C01%7Caharui%40adobe.com <http://40adobe.com/>%7Ca4bd77
>>> 6070724b1dcc1808d57c4378ec%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6
>>> 36551551615381068&sdata=9Ja2Y3rXZc4hhbn85tmZyHq8lE8FQkbl%2B%2BgTaFzKUVY%3
>>> D&reserved=0
>>> +//
>>> +//  Unless required by applicable law or agreed to in writing, software
>>> +//  distributed under the License is distributed on an "AS IS" BASIS,
>>> +//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>>> implied.
>>> +//  See the License for the specific language governing permissions and
>>> +//  limitations under the License.
>>> +//
>>> 
>>> +////////////////////////////////////////////////////////////////////////
>>> ////////
>>> +package
>>> +{
>>> +    COMPILE::SWF
>>> +    {
>>> +        import flash.utils.Dictionary;
>>> +    }
>>> +    COMPILE::SWF
>>> +    public class Map
>>> +    {
>>> +        public function Map(iterable:Object=null)
>>> +        {
>>> +            dict = new Dictionary();
>>> +        }
>>> +
>>> +        private var dict:Dictionary;
>>> +        public static const length:int = 0;
>>> +
>>> +        private var _keys:Array = [];
>>> +        public function get size():int
>>> +        {
>>> +            return _keys.length;
>>> +        }
>>> +
>>> +        public function clear():void
>>> +        {
>>> +            dict = new Dictionary();
>>> +            _keys = [];
>>> +        }
>>> +
>>> +        public function delete(key:*):Boolean
>>> +        {
>>> +            var idx:int = _keys.indexOf(key);
>>> +            if(idx != -1){
>>> +                _keys.splice(idx,1);
>>> +            }
>>> +            return delete dict[key];
>>> +        }
>>> +
>>> +        //TODO requires Iterator
>>> +        // public function entries():Iterator
>>> +        // {
>>> +            
>>> +        // }
>>> +
>>> +        public function forEach(callback:Function,thisArg:Object =
>>> null):void
>>> +        {
>>> +            thisArg = thisArg ? thisArg : this;
>>> +            var len:int = _keys.length;
>>> +            for(var i:int = 0; i < len; i++)
>>> +            {
>>> +                callback.call(thisArg,dict[_keys[i]],i,this);
>>> +            }
>>> +        }
>>> +
>>> +        public function get(key:Object):*
>>> +        {
>>> +            return dict[key];
>>> +        }
>>> +
>>> +        public function has(key:Object):Boolean
>>> +        {
>>> +            return dict[key] != null;
>>> +        }
>>> +
>>> +        //TODO requires Iterator
>>> +        // public function keys():Iterator
>>> +        // {
>>> +            
>>> +        // }
>>> +
>>> +        public function set(key:Object,value:*):Map
>>> +        {
>>> +            dict[key] = value;
>>> +            return this;
>>> +        }
>>> +
>>> +        //TODO requires Iterator
>>> +        // public function values():Iterator
>>> +        // {
>>> +            
>>> +        // }
>>> +    }
>>> +}
>>> \ No newline at end of file
>>> 
>>> -- 
>>> To stop receiving notification emails like this one, please contact
>>> harbs@apache.org.


Re: [royale-asjs] 01/01: Added Map

Posted by Alex Harui <ah...@adobe.com.INVALID>.
Hmm.  Probably the compiler thinks Map.as is a monkey-patch over the SWC
definition.  Source-path definitions always win.

What error do you get?

HTH,
-Alex

On 2/25/18, 3:32 AM, "Harbs" <ha...@gmail.com> wrote:

>I need help here:
>
>By adding the Map class for SWF, that seems to mess up the Map reference
>in JS blocks in ObjectMap. For some reason, the SWF class makes the
>compiler not find the extern definition of Map on the JS side. I’m not
>sure why.
>
>Any thoughts?
>Harbs
>
>> On Feb 25, 2018, at 1:30 PM, harbs@apache.org wrote:
>> 
>> This is an automated email from the ASF dual-hosted git repository.
>> 
>> harbs pushed a commit to branch feature/native-js
>> in repository 
>>https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitbox.a
>>pache.org%2Frepos%2Fasf%2Froyale-asjs.git&data=02%7C01%7Caharui%40adobe.c
>>om%7Ca4bd776070724b1dcc1808d57c4378ec%7Cfa7b1b5a7b34438794aed2c178decee1%
>>7C0%7C0%7C636551551615381068&sdata=8rGGfy%2B3oPjqQEuqvMvxA1KB5t4lDS%2FLWH
>>kDRxsrkmU%3D&reserved=0
>> 
>> commit fa36e70dc9dfd924db30a512f1a2f8622e218ae4
>> Author: Harbs <ha...@in-tools.com>
>> AuthorDate: Sun Feb 25 13:30:10 2018 +0200
>> 
>>    Added Map
>> ---
>> .../projects/Core/src/main/royale/CoreClasses.as   |   6 ++
>> frameworks/projects/Core/src/main/royale/Map.as    | 101
>>+++++++++++++++++++++
>> 2 files changed, 107 insertions(+)
>> 
>> diff --git a/frameworks/projects/Core/src/main/royale/CoreClasses.as
>>b/frameworks/projects/Core/src/main/royale/CoreClasses.as
>> index 0408118..fc9595e 100644
>> --- a/frameworks/projects/Core/src/main/royale/CoreClasses.as
>> +++ b/frameworks/projects/Core/src/main/royale/CoreClasses.as
>> @@ -224,6 +224,12 @@ internal class CoreClasses
>> 		import org.apache.royale.core.WrappedHTMLElement ;WrappedHTMLElement;
>> 	    import org.apache.royale.core.IRoyaleElement; IRoyaleElement;
>> 	}
>> +
>> +	//JS native classes
>> +	COMPILE::SWF
>> +	{
>> +		import Map; Map;
>> +	}
>> 	//Package Level Functions
>> 	import org.apache.royale.debugging.assert; assert;
>> 	import org.apache.royale.debugging.assertType; assertType;
>> diff --git a/frameworks/projects/Core/src/main/royale/Map.as
>>b/frameworks/projects/Core/src/main/royale/Map.as
>> new file mode 100644
>> index 0000000..e2549ea
>> --- /dev/null
>> +++ b/frameworks/projects/Core/src/main/royale/Map.as
>> @@ -0,0 +1,101 @@
>> 
>>+////////////////////////////////////////////////////////////////////////
>>////////
>> +//
>> +//  Licensed to the Apache Software Foundation (ASF) under one or more
>> +//  contributor license agreements.  See the NOTICE file distributed
>>with
>> +//  this work for additional information regarding copyright ownership.
>> +//  The ASF licenses this file to You under the Apache License,
>>Version 2.0
>> +//  (the "Licens"); you may not use this file except in compliance with
>> +//  the License.  You may obtain a copy of the License at
>> +//
>> +//      
>>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.apach
>>e.org%2Flicenses%2FLICENSE-2.0&data=02%7C01%7Caharui%40adobe.com%7Ca4bd77
>>6070724b1dcc1808d57c4378ec%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6
>>36551551615381068&sdata=9Ja2Y3rXZc4hhbn85tmZyHq8lE8FQkbl%2B%2BgTaFzKUVY%3
>>D&reserved=0
>> +//
>> +//  Unless required by applicable law or agreed to in writing, software
>> +//  distributed under the License is distributed on an "AS IS" BASIS,
>> +//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>>implied.
>> +//  See the License for the specific language governing permissions and
>> +//  limitations under the License.
>> +//
>> 
>>+////////////////////////////////////////////////////////////////////////
>>////////
>> +package
>> +{
>> +    COMPILE::SWF
>> +    {
>> +        import flash.utils.Dictionary;
>> +    }
>> +    COMPILE::SWF
>> +    public class Map
>> +    {
>> +        public function Map(iterable:Object=null)
>> +        {
>> +            dict = new Dictionary();
>> +        }
>> +
>> +        private var dict:Dictionary;
>> +        public static const length:int = 0;
>> +
>> +        private var _keys:Array = [];
>> +        public function get size():int
>> +        {
>> +            return _keys.length;
>> +        }
>> +
>> +        public function clear():void
>> +        {
>> +            dict = new Dictionary();
>> +            _keys = [];
>> +        }
>> +
>> +        public function delete(key:*):Boolean
>> +        {
>> +            var idx:int = _keys.indexOf(key);
>> +            if(idx != -1){
>> +                _keys.splice(idx,1);
>> +            }
>> +            return delete dict[key];
>> +        }
>> +
>> +        //TODO requires Iterator
>> +        // public function entries():Iterator
>> +        // {
>> +            
>> +        // }
>> +
>> +        public function forEach(callback:Function,thisArg:Object =
>>null):void
>> +        {
>> +            thisArg = thisArg ? thisArg : this;
>> +            var len:int = _keys.length;
>> +            for(var i:int = 0; i < len; i++)
>> +            {
>> +                callback.call(thisArg,dict[_keys[i]],i,this);
>> +            }
>> +        }
>> +
>> +        public function get(key:Object):*
>> +        {
>> +            return dict[key];
>> +        }
>> +
>> +        public function has(key:Object):Boolean
>> +        {
>> +            return dict[key] != null;
>> +        }
>> +
>> +        //TODO requires Iterator
>> +        // public function keys():Iterator
>> +        // {
>> +            
>> +        // }
>> +
>> +        public function set(key:Object,value:*):Map
>> +        {
>> +            dict[key] = value;
>> +            return this;
>> +        }
>> +
>> +        //TODO requires Iterator
>> +        // public function values():Iterator
>> +        // {
>> +            
>> +        // }
>> +    }
>> +}
>> \ No newline at end of file
>> 
>> -- 
>> To stop receiving notification emails like this one, please contact
>> harbs@apache.org.
>