update ooo310-m15
[ooovba.git] / applied_patches / 0422-basic-allow-objectforerror-symbol.diff
blob0501d3c2e49ddb6280452ed9be27c6bbc83efbfd
1 diff --git basic/source/comp/exprtree.cxx basic/source/comp/exprtree.cxx
2 index 88b51d1..8e78aba 100644
3 --- basic/source/comp/exprtree.cxx
4 +++ basic/source/comp/exprtree.cxx
5 @@ -378,8 +378,12 @@ SbiExprNode* SbiExpression::Term( void )
6 // Typ SbxOBJECT sein
7 if( pDef->GetType() != SbxOBJECT && pDef->GetType() != SbxVARIANT )
9 - pParser->Error( SbERR_BAD_DECLARATION, aSym );
10 - bError = TRUE;
11 + // defer error until runtime if in vba mode
12 + if ( !pParser->IsVBASupportOn() )
13 + {
14 + pParser->Error( SbERR_BAD_DECLARATION, aSym );
15 + bError = TRUE;
16 + }
18 if( !bError )
19 pNd->aVar.pNext = ObjTerm( *pDef );
20 diff --git basic/source/comp/parser.cxx basic/source/comp/parser.cxx
21 index 1a4dc06..dea8d79 100644
22 --- basic/source/comp/parser.cxx
23 +++ basic/source/comp/parser.cxx
24 @@ -405,6 +405,18 @@ BOOL SbiParser::Parse()
25 Next(); return TRUE;
28 + // In vba it's possible to do Error.foobar ( even if it results in
29 + // a runtime error
30 + if ( eCurTok == _ERROR_ && IsVBASupportOn() ) // we probably need to define a subset of keywords where this madness applies e.g. if ( IsVBASupportOn() && SymbolCanBeRedined( eCurTok ) )
31 + {
32 + SbiTokenizer tokens( *(SbiTokenizer*)this );
33 + tokens.Next();
34 + if ( tokens.Peek() == DOT )
35 + {
36 + eCurTok = SYMBOL;
37 + ePush = eCurTok;
38 + }
39 + }
40 // Kommt ein Symbol, ist es entweder eine Variable( LET )
41 // oder eine SUB-Prozedur( CALL ohne Klammern )
42 // DOT fuer Zuweisungen im WITH-Block: .A=5