git.asbjorn.biz
/
swftools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
afb504a
)
construct superclass in default constructor
author
kramm
<kramm>
Fri, 2 Jan 2009 19:49:57 +0000
(19:49 +0000)
committer
kramm
<kramm>
Fri, 2 Jan 2009 19:49:57 +0000
(19:49 +0000)
lib/as3/parser.y
patch
|
blob
|
history
diff --git
a/lib/as3/parser.y
b/lib/as3/parser.y
index
5aeee28
..
7023420
100644
(file)
--- a/
lib/as3/parser.y
+++ b/
lib/as3/parser.y
@@
-250,6
+250,7
@@
typedef struct _classstate {
abc_class_t*abc;
code_t*init;
code_t*static_init;
abc_class_t*abc;
code_t*init;
code_t*static_init;
+ char has_constructor;
} classstate_t;
typedef struct _methodstate {
} classstate_t;
typedef struct _methodstate {
@@
-609,6
+610,13
@@
static code_t* wrap_function(code_t*c,code_t*initcode, code_t*body)
static void endclass()
{
static void endclass()
{
+ if(!state->cls->has_constructor) {
+ code_t*c = 0;
+ c = abc_getlocal_0(c);
+ c = abc_constructsuper(c, 0);
+ state->cls->init = code_append(state->cls->init, c);
+ }
+
if(state->cls->init) {
abc_method_t*m = abc_class_getconstructor(state->cls->abc, 0);
m->body->code = wrap_function(0, state->cls->init, m->body->code);
if(state->cls->init) {
abc_method_t*m = abc_class_getconstructor(state->cls->abc, 0);
m->body->code = wrap_function(0, state->cls->init, m->body->code);
@@
-789,6
+797,8
@@
static void startfunction(token_t*ns, int flags, enum yytokentype getset, char*n
state->method->initcode = 0;
state->method->is_constructor = !strcmp(state->cls->info->name,name);
state->method->has_super = 0;
state->method->initcode = 0;
state->method->is_constructor = !strcmp(state->cls->info->name,name);
state->method->has_super = 0;
+
+ state->cls->has_constructor |= state->method->is_constructor;
global->variable_count = 0;
global->variable_count = 0;