Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
962a9eb4
Commit
962a9eb4
authored
Aug 13, 2010
by
Roberto Raggi
Browse files
More work on the objc class and declaration symbols.
parent
72c806ab
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/shared/cplusplus/Bind.cpp
View file @
962a9eb4
...
...
@@ -69,6 +69,7 @@ Bind::Bind(TranslationUnit *unit)
_name
(
0
),
_declaratorId
(
0
),
_visibility
(
Symbol
::
Public
),
_objcVisibility
(
Symbol
::
Public
),
_methodKey
(
Function
::
NormalMethod
),
_skipFunctionBodies
(
false
)
{
...
...
@@ -135,6 +136,12 @@ int Bind::switchVisibility(int visibility)
return
visibility
;
}
int
Bind
::
switchObjCVisibility
(
int
visibility
)
{
std
::
swap
(
_objcVisibility
,
visibility
);
return
visibility
;
}
int
Bind
::
switchMethodKey
(
int
methodKey
)
{
std
::
swap
(
_methodKey
,
methodKey
);
...
...
@@ -2113,10 +2120,17 @@ bool Bind::visit(ObjCClassDeclarationAST *ast)
}
this
->
objCProtocolRefs
(
ast
->
protocol_refs
,
klass
);
const
int
previousObjCVisibility
=
switchObjCVisibility
(
Function
::
Protected
);
this
->
objCInstanceVariablesDeclaration
(
ast
->
inst_vars_decl
,
klass
);
(
void
)
switchObjCVisibility
(
Function
::
Public
);
for
(
DeclarationListAST
*
it
=
ast
->
member_declaration_list
;
it
;
it
=
it
->
next
)
{
this
->
declaration
(
it
->
value
);
}
(
void
)
switchObjCVisibility
(
previousObjCVisibility
);
(
void
)
switchScope
(
previousScope
);
return
false
;
}
...
...
@@ -2175,18 +2189,21 @@ bool Bind::visit(ObjCProtocolDeclarationAST *ast)
_scope
->
addMember
(
protocol
);
Scope
*
previousScope
=
switchScope
(
protocol
);
const
int
previousObjCVisibility
=
switchObjCVisibility
(
Function
::
Public
);
this
->
objCProtocolRefs
(
ast
->
protocol_refs
,
protocol
);
for
(
DeclarationListAST
*
it
=
ast
->
member_declaration_list
;
it
;
it
=
it
->
next
)
{
this
->
declaration
(
it
->
value
);
}
(
void
)
switchObjCVisibility
(
previousObjCVisibility
);
(
void
)
switchScope
(
previousScope
);
return
false
;
}
bool
Bind
::
visit
(
ObjCVisibilityDeclarationAST
*
ast
)
{
(
void
)
ast
;
// unsigned visibility_token = ast->visibility_token;
_objcVisibility
=
visibilityForObjCAccessSpecifier
(
tokenKind
(
ast
->
visibility_token
));
return
false
;
}
...
...
@@ -2798,3 +2815,19 @@ int Bind::visibilityForClassKey(int tokenKind)
return
Symbol
::
Public
;
}
}
int
Bind
::
visibilityForObjCAccessSpecifier
(
int
tokenKind
)
{
switch
(
tokenKind
)
{
case
T_AT_PUBLIC
:
return
Symbol
::
Public
;
case
T_AT_PROTECTED
:
return
Symbol
::
Protected
;
case
T_AT_PRIVATE
:
return
Symbol
::
Private
;
case
T_AT_PACKAGE
:
return
Symbol
::
Package
;
default:
return
Symbol
::
Protected
;
}
}
src/shared/cplusplus/Bind.h
View file @
962a9eb4
...
...
@@ -71,6 +71,7 @@ protected:
static
int
visibilityForAccessSpecifier
(
int
tokenKind
);
static
int
visibilityForClassKey
(
int
tokenKind
);
static
int
visibilityForObjCAccessSpecifier
(
int
tokenKind
);
void
setDeclSpecifiers
(
Symbol
*
symbol
,
const
FullySpecifiedType
&
declSpecifiers
);
...
...
@@ -90,6 +91,7 @@ protected:
Scope
*
switchScope
(
Scope
*
scope
);
int
switchVisibility
(
int
visibility
);
int
switchMethodKey
(
int
methodKey
);
int
switchObjCVisibility
(
int
visibility
);
unsigned
calculateScopeStart
(
ObjCClassDeclarationAST
*
ast
)
const
;
unsigned
calculateScopeStart
(
ObjCProtocolDeclarationAST
*
ast
)
const
;
...
...
@@ -291,6 +293,7 @@ private:
FullySpecifiedType
_type
;
DeclaratorIdAST
**
_declaratorId
;
int
_visibility
;
int
_objcVisibility
;
int
_methodKey
;
bool
_skipFunctionBodies
;
};
...
...
Write
Preview
Supports
Markdown
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