Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bpftrace
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bpftrace
Commits
0d465821
Commit
0d465821
authored
Jan 05, 2018
by
Alastair Robertson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Semantic analyser wait until final pass to declare invalid field accesses
parent
ab16f8b7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
src/ast/semantic_analyser.cpp
src/ast/semantic_analyser.cpp
+5
-3
tests/semantic_analyser.cpp
tests/semantic_analyser.cpp
+1
-1
No files found.
src/ast/semantic_analyser.cpp
View file @
0d465821
...
...
@@ -282,9 +282,11 @@ void SemanticAnalyser::visit(FieldAccess &acc)
acc
.
expr
->
accept
(
*
this
);
if
(
acc
.
expr
->
type
.
type
!=
Type
::
cast
)
{
if
(
is_final_pass
())
{
err_
<<
"Can not access field '"
<<
acc
.
field
<<
"' on expression of type '"
<<
acc
.
expr
->
type
<<
"'"
<<
std
::
endl
;
}
return
;
}
...
...
tests/semantic_analyser.cpp
View file @
0d465821
...
...
@@ -346,7 +346,7 @@ TEST(semantic_analyser, field_access_wrong_field)
TEST
(
semantic_analyser
,
field_access_wrong_expr
)
{
test
(
"kprobe:f { 1234->field }"
,
1
);
test
(
"kprobe:f { 1234->field }"
,
1
0
);
}
TEST
(
semantic_analyser
,
field_access_types
)
...
...
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