78915: Subject: [PATCH 13/19 try2] vbscript: Added class functions parser implementation

buildbot at kegel.com buildbot at kegel.com
Thu Sep 15 12:14:29 CDT 2011


This is an experimental automated build and test service.
Please feel free to ignore this email while we work the kinks out.

For more info about this message, see http://wiki.winehq.org/BuildBot

The Buildbot has detected a failed build on builder runtests-default while building Wine.
Full details are available at: http://buildbot.kegel.com/builders/runtests-default/builds/108 (though maybe not for long, as I'm still reinstalling the buildbot periodically while experimenting)
BUILD FAILED: failed git

Errors:
error: patch failed: dlls/vbscript/parse.h:148
error: dlls/vbscript/parse.h: patch does not apply
error: patch failed: dlls/vbscript/parser.y:59
error: dlls/vbscript/parser.y: patch does not apply
error: patch failed: dlls/vbscript/tests/lang.vbs:386
error: dlls/vbscript/tests/lang.vbs: patch does not apply

-------------- next part --------------
From: Jacek Caban <jacek at codeweavers.com>
Subject: [PATCH 13/19 try2] vbscript: Added class functions parser implementation
Message-Id: <4E72302B.40901 at codeweavers.com>
Date: Thu, 15 Sep 2011 19:04:43 +0200

try2: Fixes warn+heap test

---
  dlls/vbscript/parse.h        |    1 +
  dlls/vbscript/parser.y       |   24 ++++++++++++++++++++++++
  dlls/vbscript/tests/lang.vbs |   12 ++++++++++++
  3 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/dlls/vbscript/parse.h b/dlls/vbscript/parse.h
index 3a4d03b..94ba0cf 100644
--- a/dlls/vbscript/parse.h
+++ b/dlls/vbscript/parse.h
@@ -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;
 
diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y
index e310a70..3eacf2f 100644
--- a/dlls/vbscript/parser.y
+++ b/dlls/vbscript/parser.y
@@ -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;
diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs
index bc64f85..2f78403 100644
--- a/dlls/vbscript/tests/lang.vbs
+++ b/dlls/vbscript/tests/lang.vbs
@@ -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()



More information about the wine-tests-results mailing list