Fixed #1006 AS3 - Warning - Function value used where type Boolean was expected

as3_new testdata compilers do not ignore warnings
as3_new testdata without warnings
This commit is contained in:
Jindra Petřík
2022-12-03 18:53:18 +01:00
parent 19d7f2c6b5
commit 3771e02ba2
14 changed files with 111 additions and 48 deletions

View File

@@ -1,4 +1,5 @@
@echo off
set COMPILERKIND=air
set SWFNAME=as3_new
call c:\air\bin\mxmlc.bat -warnings=false -debug=true -output bin/%SWFNAME%.%COMPILERKIND%.swf src/Main.as 1> buildlog.%COMPILERKIND%.txt 2>&1
call c:\air\bin\mxmlc.bat -debug=true -output bin/%SWFNAME%.%COMPILERKIND%.swf src/Main.as 1> buildlog.%COMPILERKIND%.txt 2>&1
rem -warnings=false

View File

@@ -1,4 +1,5 @@
@echo off
set COMPILERKIND=flex
set SWFNAME=as3_new
c:\flex\bin\mxmlc.exe -warnings=false -debug=true -output bin/%SWFNAME%.%COMPILERKIND%.swf src/Main.as 1> buildlog.%COMPILERKIND%.txt 2>&1
c:\flex\bin\mxmlc.exe -debug=true -output bin/%SWFNAME%.%COMPILERKIND%.swf src/Main.as 1> buildlog.%COMPILERKIND%.txt 2>&1
rem -warnings=false

View File

@@ -6,8 +6,8 @@ package tests
{
public function run() : *
{
var o = new getDefinitionByName("Object")();
var o2 = new (getDefinitionByName("Object"))();
var o:* = new getDefinitionByName("Object")();
var o2:* = new (getDefinitionByName("Object"))();
}
}
}

View File

@@ -69,7 +69,24 @@ package tests
var lc:LocalClass = new LocalClass();
i = lc.attr;
s = String(lc.attr);
s = String(lc.attr);
var f:Function = function():void {};
if (Boolean(f)) {
trace("OK");
}
if (i) {
trace(i);
}
if (s) {
trace(s);
}
if (o) {
trace("obj");
}
}
}
}

View File

@@ -6,12 +6,11 @@ package tests
public function run():*
{
var obj:* = null;
var x = 5;
var x:* = 5;
if (x != null)
{
obj = {};
var item = {};
for each (var item in obj)
for each (var item:* in obj)
{
switch (item["key"])
{

View File

@@ -5,7 +5,7 @@ package tests
{
public function run():*
{
trace("hello");
trace("hello");
}
}
}

View File

@@ -9,7 +9,7 @@ package tests
{
myInternal var neco:int;
myInternal2 var neco:int;
var nic:int;
internal var nic:int;
public function run():*
{

View File

@@ -8,7 +8,7 @@ package tests
var i:int;
var j:int
var c:int = 5 + i;
var f = function() {
var f:Function = function(): void {
trace(c);
trace(j);
};