Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 44 - Haxe importing flash .swfs broken - haxe #44

Closed
issuesbot opened this issue May 28, 2013 · 5 comments
Closed

Issue 44 - Haxe importing flash .swfs broken - haxe #44

issuesbot opened this issue May 28, 2013 · 5 comments

Comments

@issuesbot
Copy link

[Google Issue #44 : https://code.google.com/p/haxe/issues/detail?id=44]
by [email protected], at 14/01/2010, 03:00:12
What steps will reproduce the problem?

The following Breaks.as (attached)

package { 
    public class Breaks {
        static public function f() : void {
        }
        public function f() : void {
        }
    }
}
  1. (optional results .swf attached) Compile into Breaks.swf (attached),
    using Adobe Flex "mxmlc Breaks.as".
  2. C:\workspace\flashdemo\ActionScriptTests>haxe --gen-hx-classes
    Breaks.swf
    import Breaks;
  3. C:\workspace\flashdemo\ActionScriptTests>cd hxclasses
  4. C:\workspace\flashdemo\ActionScriptTests\hxclasses>haxe Breaks.hx
    Breaks.hx:4: characters 8-28 : Same field name can't be use for both
    static and
    instance : f

What is the expected output? What do you see instead?

Haxe should compile ok
Haxe breaks in haxe compiler.

What version of the product are you using? On what operating system?
2.0.4 on Windows XP.

Please provide any additional information below.

Haxe importing flash .swfs in broken, it generates bad .hx from the .swf:
In Actionscript you may have a method with the same name as a static
method in the class. This is not valid in Haxe but haxe --gen-hx-classes
outputs a .hx that will not compile. FieldBreaks.as/FieldBreaks.swf have
the same problem but with fields rather than methods.

Please fix ASAP as I have a project that depends on importing .swfs like
those attached.

Yours Sincnerely,

Hank Inaworken.

@issuesbot
Copy link
Author

[comment from [email protected], published at 17/01/2010, 22:10:27]
[Reply from Justin Donaldson on Haxe mailing list]
Date: Wed, 13 Jan 2010 01:35:11 -0500

Hi Hank,

I'm pretty sure the behavior here is correct, or at least not fixable. The
--gen-hx-classes essentially does a format translation, but it's far from
foolproof. There are still plenty of things that can prevent the translated
code from compiling. It is the discretion of the programmer to work around
issues like yours, because there really isn't a best way for handling it
automatically.

Fixing it would involve renaming one of the field/method names (which one?),
which could potentially cause naming conflicts. Then all the external class
references to this function must be changed, etc. There's probably some
references (involving reflection) that the compiler couldn't possibly
find.

Also, if you want Nicolas or one of the main dev's to find this issue
faster, it's better to submit a bug report to the issue log on google code:
http://code.google.com/p/haxe/issues/list

-Justin

@issuesbot
Copy link
Author

[comment from [email protected], published at 17/01/2010, 22:14:31]
[Reply from Nicolas Cannasse on Haxe mailing list]
Date: Wed, 13 Jan 2010 10:01:07 +0100

This is a limitation of haXe that can't be removed. You will have to
comment one of the two fields and then if you want to access it use
"Reflect.field" or "untyped".

Nicolas

@issuesbot
Copy link
Author

[comment from [email protected], published at 18/01/2010, 04:55:30]
Could we have the haXe not output the static method or field where there is a
conflict (an instance field or method with the same name), or even better output a
comment saying it was omitted?

Reflect.callMethod(Breaks, Reflect.field(Breaks, "f"), []));

works calling the commented out static field (field of the class, not the field of
an instance).

Hank.

@issuesbot
Copy link
Author

[comment from [email protected], published at 24/01/2010, 14:33:12]
A comment have been added in front of static fields when a non static field has the
same name in the same class. It will still fail when a static method with the same
name has a superclass field gets generated.

@issuesbot
Copy link
Author

[comment from [email protected], published at 26/01/2010, 21:40:34]
Are you sure this is the case? Haxe doesn't mind if the conflict is across different
classes.

Attached are Breaks2Base.hx and Breaks2Sub.hx which have the same named field as a
static in the superclass and an instance field in the subclass, haxe Breaks2Sub.hx
compiles ok.

nadako added a commit to nadako/haxe that referenced this issue Apr 28, 2017
Simn added a commit that referenced this issue Jun 3, 2017
* add eval target (new interpreter)

* install findlib packages

* typo

* don't add trailing slashes if your name is remove_trailing_slash

* add rope and ptmap to merlin again

* fix timers

* support enum to expr conversion (#43)

* fix no-arg enum values (#44)

* make Md5 faster on `eval` (#45)

* implement Md5 natively

* add -D interp-times

* fix incr ops

* lose IO dependency

* ignore Japan (?)

* 64 bits

* implement FPHelper natively for more accuracy

* allow floats in place of int because apparently that happens sometimes

* print value kind in case of unexpected value

* make other interp's create functions compatible

* add more hxmls for mandelbrot benchmark

* optimize enum index access

* optimize enum construction

* return empty array for Reflect.fields(null) (#46)

* sort timers by time

* print parent % too

* add eval.vm.Gc

* deal with different OCaml versions

* optimize decrement ops

* avoid raising Return exceptions at the end of a function's control flow

* don't catch RunTimeException in two places

* Improve macro context api: add haxe.macro.Context.storeExpr (#47)

* optimize `while (a >= const)`

* use DynArray instead of Stack for environment stacks

* avoid Return exception wrapping if there's no nonfinal return

* don't record stack traces in non-debug mode, unless -D interp-stack

* throw "Unbound variable" instead of asserting

* keep a default environment and re-use it if possible

* specialize any calls

* fix closure jitting

* memoize proto functions on call

* avoid hitting the write barrier on envs so much

* show context of local functions for times (#48)

* avoid more write barrier by storing 3 ints instead of 1 pos

* make envs a bit smaller

* make constructor calls a bit less slow

* move env info creating to a function

* allow adding useless breakpoints because why not

* keep variable names around so we can print them

* move JitContext to its own file

* implement some parts of the hxcpp-debugger CLI

* detect uncaught exceptions when debugging

* make caught-type detection more accurate

* catch Not_found if a breakpoint file doesn't exist

* don't mess up blocks if we're debugging

* support captured variables

* use intermediate functions instead of print_endline so they can be modified

* restructure a bit

* rework debug representation to support up/down/frame

* adjust to vshaxe-debug requirements

* always print prompt

* match hxcpp-debugger output more accurately

* minor

* hook up names

* keep variable types around

* fix var info lookup

* fix breakpoint pattern parsing

* fixes

* support `print obj.field`

* automatically reset to real env instead of complaining about it

* print values in a way the debugger accepts it

* lose var type information

* more hxcpp-debugger sync

* quote string values

* unify set/print

* resolve idents to prototypes

* support more identifier resolution

* return real paths

* support column breakpoints

* readjust to picky debugger

* support socket connections via -D interp-debugger-socket=host:port

* actuall call recv

* asdfg

* output some json

* consistency

* send data length

* add value_to_json

* output breakpoint setting result as int

* sync breakpoint names

* thread debug experiment

* don't ctx.eval() so much

* keep main thread separate

* fix some threading

* remove Thread implementation, at lest for now

* branching is faster

* avoid unnecessary function call

* use macro call position if that's all we have

* rename interp- stuff to eval- stuff

* add test (closes #5155)

* add tests (closes #5160) (closes #6145)

* maybe fix timer accumulation

* fix call stack handling if record_stack is false

* small opt

* optimize null checks

* improve int equality check

* fix flag implications

* close env timers in case of exceptions

* remove check because bools don't trigger the write barrier

* guard against failing C#/php test

* fix timers, again

* make StringMap implementation faster

* emit breakpoint_stop event

* output some info about the exception

* command for getting scopes and vars within scope

* some hackery

* revert stack (so the frame with id=0 comes first), output response to move_frame commands

* don't skip, but mark artifical frames

* make "frame" accept ids returned by "w"

* can now use zero-based scope numbers

* wip on scope variable output

* add 'structured' flag for the var output

* wip

* flat var repr

* show object internals

* display arrays the same way as objects

* some value display improvements

* have instance_fields fields, next to object_fields

* more wip on var introspection

* support array access in expr_to_value

* improve enum printing, fix array printing order

* support enum value introspection

* output "access" field so we don't have to do the magic on the adapter side to know how to access subvars

* wip on setting vars

* use native crc32 implementation for Crc32.make

* skip empty scopes in "scopes" request

* swap argument order for jit_expr

* optimize method calls a little

* optimize calls to singly-implemented interface fields

* some minor cleanup

* don't make pointless vnull assignments when declaring variables without init

* use some `[@@inline]` to restructure call code

* don't mess up override calls

* check if 4.02.3 accepts this

* Revert "check if 4.02.3 accepts this"

This reverts commit e20311c.

* add position info to scope

* rename vars_scope to simply vars, rename vars_inner to structure

* remove `[@@inline]` for now

* ctrl s

* make fastCodeAt a bit faster

* don't use the default env if we want to record a stack

* Bring back VArray and VString (#49)

* bring back VString

* bring back VArray too

* change stack trace output

* reset ctx.curapi after call_path

* implement Haxe serialization algorithm and use it for Context.signature

* use full enum path (see #6273)

* set error state on eval context

* start separating connection from EvalDebug, since we want two different connection interfaces

* add EvalDebugSocket module which is the main goal to complete right now

* select connection based on whether there's a socket (do it the ugly way for now)

* rework EvalDebugSocket to a json-rpc protocol

* camelcase

* don't care about `id` structure, just return it as is

* conform to jsonrpc spec better by always supplying `id` for errors (should be null if there's no id)

* minor

* clean up EvalDebugCLI from the json socket stuff

* remove unused value_string

* add a method to replace all breakpoints within file

* make sure we actually compare the same enums (closes #6273)

* remove "created socket" print

* add eval.vm.Context.breakHere

* play it safe with compare/equals

* don't comment out what you want to test

* optimize int/enum switches

* get exception message _before_ resetting the context

* reset caught_types within catch blocks

* catch exception on recv

* re-work function argument handling

* add rev_file_hash

* [debug] don't stop at field access expressions

* let prototypes keep a reference to their own value

* rely on physical equality for equals

* [eval] initial vector implementation (#51)

* [eval] initial vector implementation

* [eval] add missing Vector key

* optimize Vector.get/set

* use native Vector.map

* optimize new Vector a bit

* improve Vector/Array.map

* [eval] vector should use ocaml implementations

* implement Vector.join natively and improve Array.join

* [eval] add special cases in jit to improve vector performance, add array access to eval.Vector to detect them, bugfixing

* fix Vector warnings

* remove unused eval.Vector.get/set

* compare prototypes by path (see #6308)

* check for uncaught haxe.macro.Error exceptions (closes #53)

* fix env_captures initialization

* always initialize vars

because nadako doesn't

* Revert "fix env_captures initialization"

This reverts commit cfc4fe2.

* [eval] add missing VVector handling in various places (#52)

* [eval] add missing VVector handling in various places

* [eval] handle vector.length like array.length, but don't support write access

* [eval] don't expose set and get of eval.Vector, we only handle array access

* add eval.vm.Context.loadPlugin

* expose decode_expr again

* expose encode_expr as well so we can do macros \o/

* expose encode_ctype

* add decode_type

* More work on cppiaast

* [lua] get rid of unused variable (and warning)

* Add cppiaast define to test unified cppia generation

* deal with `if (throw)` situations (closes #6315)

* Normalize class names in cppia-ast

* save locals in typing_timer

* subdate upmodule

* add back dynlink

* fix Uncompress
nadako pushed a commit to nadako/haxe that referenced this issue Apr 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant