Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
latte
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zygzagZ
latte
Commits
519005ca
Commit
519005ca
authored
Dec 12, 2020
by
zygzagZ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eager class names fetching
parent
067f6adb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
TypeCheck.cpp
TypeCheck.cpp
+13
-4
TypeCheck.h
TypeCheck.h
+2
-0
No files found.
TypeCheck.cpp
View file @
519005ca
...
...
@@ -21,10 +21,7 @@ void TypeCheck::visitClassDef(ClassDef *t) {
t
->
getName
()
->
var
=
c
;
scope
->
classes
<<
c
;
scope
->
currentBinding
=
scope
->
currentClass
=
c
;
t
->
getBlock
()
->
accept
(
this
);
scope
->
currentClass
=
nullptr
;
scope
->
currentBinding
=
scope
;
classDefs
.
emplace_back
(
c
,
t
);
}
void
TypeCheck
::
visitPIdent
(
PIdent
*
p_ident
)
...
...
@@ -564,8 +561,20 @@ void TypeCheck::check(Visitable *v)
scope
->
currentBinding
=
scope
;
// najpierw zebranie nazw klas
v
->
accept
(
this
);
// teraz bloki klas jak juz znamy wszystkie istniejace klasy
for
(
auto
p
:
classDefs
)
{
scope
->
currentBinding
=
scope
->
currentClass
=
p
.
first
;
p
.
second
->
getBlock
()
->
accept
(
this
);
scope
->
currentClass
=
nullptr
;
scope
->
currentBinding
=
scope
;
}
classDefs
.
clear
();
// a teraz mozna funkcje w klasach
for
(
auto
c
:
scope
->
classes
)
{
scope
->
currentClass
=
c
;
try
{
...
...
TypeCheck.h
View file @
519005ca
...
...
@@ -20,6 +20,8 @@ class TypeCheck : public Visitor
shared_ptr
<
Type
>
lastType
,
returnType
;
set
<
int
>
posv
;
vector
<
pair
<
ClassInfoPtr
,
ClassDef
*>>
classDefs
;
void
checkFunction
(
FunctionInfoPtr
f
);
void
checkReturnStatement
(
shared_ptr
<
Type
>
type
,
Stmt
*
stmt
);
void
checkFunctionRet
();
...
...
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