Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
3862cdab
Commit
3862cdab
authored
Sep 15, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 15, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Added function storage specifiers support.
parent
dfc74ac0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
7 deletions
+47
-7
compile.c
dlls/vbscript/compile.c
+1
-0
parse.h
dlls/vbscript/parse.h
+1
-0
parser.y
dlls/vbscript/parser.y
+28
-7
lang.vbs
dlls/vbscript/tests/lang.vbs
+16
-0
vbscript.h
dlls/vbscript/vbscript.h
+1
-0
No files found.
dlls/vbscript/compile.c
View file @
3862cdab
...
...
@@ -760,6 +760,7 @@ static HRESULT create_function(compile_ctx_t *ctx, function_decl_t *decl, functi
func
->
var_cnt
=
0
;
func
->
code_ctx
=
ctx
->
code
;
func
->
type
=
decl
->
type
;
func
->
is_public
=
decl
->
is_public
;
func
->
arg_cnt
=
0
;
if
(
decl
->
args
)
{
...
...
dlls/vbscript/parse.h
View file @
3862cdab
...
...
@@ -135,6 +135,7 @@ typedef struct _arg_decl_t {
typedef
struct
_function_decl_t
{
const
WCHAR
*
name
;
function_type_t
type
;
BOOL
is_public
;
arg_decl_t
*
args
;
statement_t
*
body
;
struct
_function_decl_t
*
next
;
...
...
dlls/vbscript/parser.y
View file @
3862cdab
...
...
@@ -31,7 +31,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(vbscript);
static int parser_error(const char*);
static void parse_complete(parser_ctx_t*,BOOL);
static void parse_complete(parser_ctx_t*,BOOL);
static void source_add_statement(parser_ctx_t*,statement_t*);
static void source_add_class(parser_ctx_t*,class_decl_t*);
...
...
@@ -57,10 +57,13 @@ static statement_t *new_function_statement(parser_ctx_t*,function_decl_t*);
static dim_decl_t *new_dim_decl(parser_ctx_t*,const WCHAR*,dim_decl_t*);
static elseif_decl_t *new_elseif_decl(parser_ctx_t*,expression_t*,statement_t*);
static function_decl_t *new_function_decl(parser_ctx_t*,const WCHAR*,function_type_t,arg_decl_t*,statement_t*);
static function_decl_t *new_function_decl(parser_ctx_t*,const WCHAR*,function_type_t,
unsigned,
arg_decl_t*,statement_t*);
static arg_decl_t *new_argument_decl(parser_ctx_t*,const WCHAR*,BOOL);
static class_decl_t *new_class_decl(parser_ctx_t*);
#define STORAGE_IS_PRIVATE 1
#define STORAGE_IS_DEFAULT 2
#define CHECK_ERROR if(((parser_ctx_t*)ctx)->hres != S_OK) YYABORT
%}
...
...
@@ -78,6 +81,7 @@ static class_decl_t *new_class_decl(parser_ctx_t*);
function_decl_t *func_decl;
arg_decl_t *arg_decl;
class_decl_t *class_decl;
unsigned uint;
LONG lng;
BOOL bool;
double dbl;
...
...
@@ -111,6 +115,7 @@ static class_decl_t *new_class_decl(parser_ctx_t*);
%type <func_decl> FunctionDecl
%type <elseif> ElseIfs_opt ElseIfs ElseIf
%type <class_decl> ClassDeclaration ClassBody
%type <uint> Storage Storage_opt
%type <dim_decl> DimDeclList
%%
...
...
@@ -286,10 +291,19 @@ ClassBody
: /* empty */ { $$ = new_class_decl(ctx); }
FunctionDecl
: /* Storage_opt */ tSUB tIdentifier ArgumentsDecl_opt tNL StatementsNl_opt tEND tSUB
{ $$ = new_function_decl(ctx, $2, FUNC_SUB, $3, $5); CHECK_ERROR; }
| /* Storage_opt */ tFUNCTION tIdentifier ArgumentsDecl_opt tNL StatementsNl_opt tEND tFUNCTION
{ $$ = new_function_decl(ctx, $2, FUNC_FUNCTION, $3, $5); CHECK_ERROR; }
: Storage_opt tSUB tIdentifier ArgumentsDecl_opt tNL StatementsNl_opt tEND tSUB
{ $$ = new_function_decl(ctx, $3, FUNC_SUB, $1, $4, $6); CHECK_ERROR; }
| Storage_opt tFUNCTION tIdentifier ArgumentsDecl_opt tNL StatementsNl_opt tEND tFUNCTION
{ $$ = new_function_decl(ctx, $3, FUNC_FUNCTION, $1, $4, $6); CHECK_ERROR; }
Storage_opt
: /* empty*/ { $$ = 0; }
| Storage { $$ = $1; }
Storage
: tPUBLIC tDEFAULT { $$ = STORAGE_IS_DEFAULT; }
| tPUBLIC { $$ = 0; }
| tPRIVATE { $$ = STORAGE_IS_PRIVATE; }
ArgumentsDecl_opt
: EmptyBrackets_opt { $$ = NULL; }
...
...
@@ -566,16 +580,23 @@ static arg_decl_t *new_argument_decl(parser_ctx_t *ctx, const WCHAR *name, BOOL
}
static function_decl_t *new_function_decl(parser_ctx_t *ctx, const WCHAR *name, function_type_t type,
arg_decl_t *arg_decl, statement_t *body)
unsigned storage_flags,
arg_decl_t *arg_decl, statement_t *body)
{
function_decl_t *decl;
if(storage_flags & STORAGE_IS_DEFAULT) {
FIXME("Function declared as default property\n");
ctx->hres = E_FAIL;
return NULL;
}
decl = parser_alloc(ctx, sizeof(*decl));
if(!decl)
return NULL;
decl->name = name;
decl->type = type;
decl->is_public = !(storage_flags & STORAGE_IS_PRIVATE);
decl->args = arg_decl;
decl->body = body;
return decl;
...
...
dlls/vbscript/tests/lang.vbs
View file @
3862cdab
...
...
@@ -271,6 +271,14 @@ y = true
Call
TestSubLocalVal
Call
ok
(
x
,
"global x is not true?"
)
Public
Sub
TestPublicSub
End
Sub
Call
TestPublicSub
Private
Sub
TestPrivateSub
End
Sub
Call
TestPrivateSub
if
false
then
Function
testfunc
x
=
true
...
...
@@ -360,6 +368,14 @@ x = false
ok
SetVal
(
x
,
true
),
"SetVal returned false?"
Call
ok
(
x
,
"x is not set to true by SetVal?"
)
Public
Function
TestPublicFunc
End
Function
Call
TestPublicFunc
Private
Function
TestPrivateFunc
End
Function
Call
TestPrivateFunc
set
x
=
testObj
Call
ok
(
getVT
(
x
)
=
"VT_DISPATCH*"
,
"getVT(x=testObj) = "
&
getVT
(
x
))
...
...
dlls/vbscript/vbscript.h
View file @
3862cdab
...
...
@@ -204,6 +204,7 @@ typedef struct {
struct
_function_t
{
function_type_t
type
;
const
WCHAR
*
name
;
BOOL
is_public
;
arg_desc_t
*
args
;
unsigned
arg_cnt
;
var_desc_t
*
vars
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment