Commit cfeb815f authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

jscript: Store the head of statement list instead of the list structure.

parent c129d13c
...@@ -2510,7 +2510,7 @@ static HRESULT init_code(compiler_ctx_t *compiler, const WCHAR *source, UINT64 s ...@@ -2510,7 +2510,7 @@ static HRESULT init_code(compiler_ctx_t *compiler, const WCHAR *source, UINT64 s
return S_OK; return S_OK;
} }
static HRESULT compile_function(compiler_ctx_t *ctx, statement_list_t *source, function_expression_t *func_expr, static HRESULT compile_function(compiler_ctx_t *ctx, statement_t *source, function_expression_t *func_expr,
BOOL from_eval, function_code_t *func) BOOL from_eval, function_code_t *func)
{ {
function_expression_t *iter; function_expression_t *iter;
...@@ -2568,7 +2568,7 @@ static HRESULT compile_function(compiler_ctx_t *ctx, statement_list_t *source, f ...@@ -2568,7 +2568,7 @@ static HRESULT compile_function(compiler_ctx_t *ctx, statement_list_t *source, f
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
hres = visit_block_statement(ctx, NULL, source ? source->head : NULL); hres = visit_block_statement(ctx, NULL, source);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -2609,7 +2609,7 @@ static HRESULT compile_function(compiler_ctx_t *ctx, statement_list_t *source, f ...@@ -2609,7 +2609,7 @@ static HRESULT compile_function(compiler_ctx_t *ctx, statement_list_t *source, f
ctx->current_function_expr = ctx->func_head; ctx->current_function_expr = ctx->func_head;
off = ctx->code_off; off = ctx->code_off;
hres = compile_block_statement(ctx, NULL, source ? source->head : NULL); hres = compile_block_statement(ctx, NULL, source);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
......
...@@ -19,11 +19,6 @@ ...@@ -19,11 +19,6 @@
typedef struct _expression_t expression_t; typedef struct _expression_t expression_t;
typedef struct _statement_t statement_t; typedef struct _statement_t statement_t;
typedef struct _statement_list_t {
statement_t *head;
statement_t *tail;
} statement_list_t;
struct _bytecode_t; struct _bytecode_t;
typedef struct { typedef struct {
...@@ -41,7 +36,7 @@ typedef struct _parser_ctx_t { ...@@ -41,7 +36,7 @@ typedef struct _parser_ctx_t {
script_ctx_t *script; script_ctx_t *script;
struct _compiler_ctx_t *compiler; struct _compiler_ctx_t *compiler;
statement_list_t *source; statement_t *source;
BOOL nl; BOOL nl;
BOOL implicit_nl_semicolon; BOOL implicit_nl_semicolon;
BOOL is_html; BOOL is_html;
...@@ -301,7 +296,7 @@ typedef struct _function_expression_t { ...@@ -301,7 +296,7 @@ typedef struct _function_expression_t {
const WCHAR *identifier; const WCHAR *identifier;
const WCHAR *event_target; const WCHAR *event_target;
parameter_t *parameter_list; parameter_t *parameter_list;
statement_list_t *statement_list; statement_t *statement_list;
const WCHAR *src_str; const WCHAR *src_str;
DWORD src_len; DWORD src_len;
unsigned func_id; unsigned func_id;
......
...@@ -65,6 +65,11 @@ typedef struct _case_list_t { ...@@ -65,6 +65,11 @@ typedef struct _case_list_t {
case_clausule_t *tail; case_clausule_t *tail;
} case_list_t; } case_list_t;
typedef struct _statement_list_t {
statement_t *head;
statement_t *tail;
} statement_list_t;
static catch_block_t *new_catch_block(parser_ctx_t*,const WCHAR*,statement_t*); static catch_block_t *new_catch_block(parser_ctx_t*,const WCHAR*,statement_t*);
static case_clausule_t *new_case_clausule(parser_ctx_t*,unsigned,expression_t*,statement_list_t*); static case_clausule_t *new_case_clausule(parser_ctx_t*,unsigned,expression_t*,statement_list_t*);
static case_list_t *new_case_list(parser_ctx_t*,case_clausule_t*); static case_list_t *new_case_list(parser_ctx_t*,case_clausule_t*);
...@@ -98,11 +103,6 @@ static statement_t *new_switch_statement(parser_ctx_t*,unsigned,expression_t*,ca ...@@ -98,11 +103,6 @@ static statement_t *new_switch_statement(parser_ctx_t*,unsigned,expression_t*,ca
static statement_t *new_throw_statement(parser_ctx_t*,unsigned,expression_t*); static statement_t *new_throw_statement(parser_ctx_t*,unsigned,expression_t*);
static statement_t *new_try_statement(parser_ctx_t*,statement_t*,catch_block_t*,statement_t*,unsigned); static statement_t *new_try_statement(parser_ctx_t*,statement_t*,catch_block_t*,statement_t*,unsigned);
struct statement_list_t {
statement_t *head;
statement_t *tail;
};
static statement_list_t *new_statement_list(parser_ctx_t*,statement_t*); static statement_list_t *new_statement_list(parser_ctx_t*,statement_t*);
static statement_list_t *statement_list_add(statement_list_t*,statement_t*); static statement_list_t *statement_list_add(statement_list_t*,statement_t*);
...@@ -249,7 +249,7 @@ static expression_t *new_prop_and_value_expression(parser_ctx_t*,property_list_t ...@@ -249,7 +249,7 @@ static expression_t *new_prop_and_value_expression(parser_ctx_t*,property_list_t
/* ECMA-262 10th Edition 15.1 */ /* ECMA-262 10th Edition 15.1 */
Script Script
: ScriptBody HtmlComment { ctx->source = $1; } : ScriptBody HtmlComment { ctx->source = $1 ? $1->head : NULL; }
/* ECMA-262 10th Edition 15.1 */ /* ECMA-262 10th Edition 15.1 */
ScriptBody ScriptBody
...@@ -1440,7 +1440,7 @@ static expression_t *new_function_expression(parser_ctx_t *ctx, const WCHAR *ide ...@@ -1440,7 +1440,7 @@ static expression_t *new_function_expression(parser_ctx_t *ctx, const WCHAR *ide
ret->identifier = identifier; ret->identifier = identifier;
ret->parameter_list = parameter_list ? parameter_list->head : NULL; ret->parameter_list = parameter_list ? parameter_list->head : NULL;
ret->statement_list = statement_list; ret->statement_list = statement_list ? statement_list->head : NULL;
ret->event_target = event_target; ret->event_target = event_target;
ret->src_str = src_str; ret->src_str = src_str;
ret->src_len = src_len; ret->src_len = src_len;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment