Analyzer checks access permissions when using named types
This commit is contained in:
parent
159317965d
commit
ed498a3bc0
@ -99,10 +99,19 @@ func (this *Tree) analyzeTypeInternal (
|
|||||||
Unit: unit,
|
Unit: unit,
|
||||||
Name: ty.Name,
|
Name: ty.Name,
|
||||||
}, acceptIncomplete)
|
}, acceptIncomplete)
|
||||||
if err == nil {
|
if err != nil {
|
||||||
ty.Type = def.Type
|
return nil, err
|
||||||
}
|
}
|
||||||
return ty, err
|
|
||||||
|
// check access permissions
|
||||||
|
if def.Acc == entity.AccessPrivate && def.Unit != this.unit {
|
||||||
|
return nil, errors.Errorf (
|
||||||
|
ty.Position, "type %v is private",
|
||||||
|
ty)
|
||||||
|
}
|
||||||
|
|
||||||
|
ty.Type = def.Type
|
||||||
|
return ty, nil
|
||||||
|
|
||||||
// pointer type
|
// pointer type
|
||||||
case *entity.TypePointer:
|
case *entity.TypePointer:
|
||||||
|
Loading…
Reference in New Issue
Block a user