Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
ee67bc7a
Commit
ee67bc7a
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 class functions parser implementation.
parent
3862cdab
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
0 deletions
+37
-0
parse.h
dlls/vbscript/parse.h
+1
-0
parser.y
dlls/vbscript/parser.y
+24
-0
lang.vbs
dlls/vbscript/tests/lang.vbs
+12
-0
No files found.
dlls/vbscript/parse.h
View file @
ee67bc7a
...
...
@@ -148,6 +148,7 @@ typedef struct _function_statement_t {
typedef
struct
_class_decl_t
{
const
WCHAR
*
name
;
function_decl_t
*
funcs
;
struct
_class_decl_t
*
next
;
}
class_decl_t
;
...
...
dlls/vbscript/parser.y
View file @
ee67bc7a
...
...
@@ -59,7 +59,9 @@ 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,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*);
static class_decl_t *add_class_function(parser_ctx_t*,class_decl_t*,function_decl_t*);
#define STORAGE_IS_PRIVATE 1
#define STORAGE_IS_DEFAULT 2
...
...
@@ -289,6 +291,7 @@ ClassDeclaration
ClassBody
: /* empty */ { $$ = new_class_decl(ctx); }
| FunctionDecl tNL ClassBody { $$ = add_class_function(ctx, $3, $1); CHECK_ERROR; }
FunctionDecl
: Storage_opt tSUB tIdentifier ArgumentsDecl_opt tNL StatementsNl_opt tEND tSUB
...
...
@@ -599,6 +602,7 @@ static function_decl_t *new_function_decl(parser_ctx_t *ctx, const WCHAR *name,
decl->is_public = !(storage_flags & STORAGE_IS_PRIVATE);
decl->args = arg_decl;
decl->body = body;
decl->next = NULL;
return decl;
}
...
...
@@ -622,10 +626,30 @@ static class_decl_t *new_class_decl(parser_ctx_t *ctx)
if(!class_decl)
return NULL;
class_decl->funcs = NULL;
class_decl->next = NULL;
return class_decl;
}
static class_decl_t *add_class_function(parser_ctx_t *ctx, class_decl_t *class_decl, function_decl_t *decl)
{
function_decl_t *iter;
for(iter = class_decl->funcs; iter; iter = iter->next) {
if(!strcmpiW(iter->name, decl->name)) {
if(decl->type == FUNC_SUB || decl->type == FUNC_FUNCTION) {
FIXME("Redefinition of %s::%s\n", debugstr_w(class_decl->name), debugstr_w(decl->name));
ctx->hres = E_FAIL;
return NULL;
}
}
}
decl->next = class_decl->funcs;
class_decl->funcs = decl;
return class_decl;
}
void *parser_alloc(parser_ctx_t *ctx, size_t size)
{
void *ret;
...
...
dlls/vbscript/tests/lang.vbs
View file @
ee67bc7a
...
...
@@ -386,4 +386,16 @@ Call ok(getVT(obj) = "VT_DISPATCH*", "getVT(obj) = " & getVT(obj))
Class
EmptyClass
End
Class
Class
TestClass
Public
Function
publicFunction
()
publicFunction
=
4
End
Function
Public
Sub
publicSub
End
Sub
Public
Sub
privateSub
End
Sub
End
Class
reportSuccess
()
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