public class ReadableRecordExtractor extends AbstractTypeExtractor<WyalFile.Type.Record>
Responsible for extracting a "readable record" from a given type. A readable
record is a conservative approximation of the records described in a given
type. Furthermore, it is safe used when reading field values from that type.
For example, the type {int f}|{bool f} has a readable record
type of {int|bool f}. This is the readable type as, if we were
to read field f from either bound, the return type would be in
int|bool. However, we cannot use type for writing as this could
be unsafe. For example, if we actually had a record of type
{int f}, then writing a boolean value is not permitted.
Not all types have readable record type and, furthermore, care must be
exercised for those that do. For example, {int f}|int does not
have a readable record type. Likewise, the readable record type for
{int f, int g}|{bool f} is {int|bool f, ...}.
Finally, negations play an important role in determining the readable record
type. For example, {int|null f} & !{int f} generates the
readable record type {null f}.
AbstractTypeExtractor.Conjunct, AbstractTypeExtractor.Disjunct, AbstractTypeExtractor.Signedresolver, typeSystem| Constructor and Description |
|---|
ReadableRecordExtractor(wybs.lang.NameResolver resolver,
TypeSystem typeSystem) |
| Modifier and Type | Method and Description |
|---|---|
protected WyalFile.Type.Record |
construct(WyalFile.Type.Atom type) |
protected int |
countMatchingFields(WyalFile.FieldDeclaration[] lhsFields,
WyalFile.FieldDeclaration[] rhsFields)
Count the number of matching fields.
|
protected int |
extractMatchingFields(WyalFile.FieldDeclaration[] lhsFields,
WyalFile.FieldDeclaration[] rhsFields,
WyalFile.FieldDeclaration[] result)
Extract all matching fields (i.e.
|
protected int |
extractNonMatchingFields(WyalFile.FieldDeclaration[] lhsFields,
WyalFile.FieldDeclaration[] rhsFields,
WyalFile.FieldDeclaration[] result,
int index)
Extract fields from lhs which do not match any field in the rhs.
|
protected WyalFile.Type.Record |
intersect(WyalFile.Type.Record lhs,
WyalFile.Type.Record rhs) |
protected WyalFile.Type.Record |
subtract(WyalFile.Type.Record lhs,
WyalFile.Type.Record rhs) |
protected WyalFile.Type.Record |
union(WyalFile.Type.Record lhs,
WyalFile.Type.Record rhs) |
construct, construct, extract, intersectionHelper, isVoid, toDisjunctiveNormalForm, toDisjunctiveNormalForm, toDisjunctiveNormalForm, toDisjunctiveNormalForm, toDisjunctiveNormalForm, toDisjunctiveNormalForm, toDisjunctiveNormalForm, toDisjunctiveNormalForm, toDisjunctiveNormalForm, toDisjunctiveNormalForm, unionHelperpublic ReadableRecordExtractor(wybs.lang.NameResolver resolver,
TypeSystem typeSystem)
protected WyalFile.Type.Record construct(WyalFile.Type.Atom type)
construct in class AbstractTypeExtractor<WyalFile.Type.Record>protected WyalFile.Type.Record union(WyalFile.Type.Record lhs, WyalFile.Type.Record rhs)
union in class AbstractTypeExtractor<WyalFile.Type.Record>protected WyalFile.Type.Record subtract(WyalFile.Type.Record lhs, WyalFile.Type.Record rhs)
subtract in class AbstractTypeExtractor<WyalFile.Type.Record>protected WyalFile.Type.Record intersect(WyalFile.Type.Record lhs, WyalFile.Type.Record rhs)
intersect in class AbstractTypeExtractor<WyalFile.Type.Record>protected int countMatchingFields(WyalFile.FieldDeclaration[] lhsFields, WyalFile.FieldDeclaration[] rhsFields)
lhsFields - rhsFields - protected int extractMatchingFields(WyalFile.FieldDeclaration[] lhsFields, WyalFile.FieldDeclaration[] rhsFields, WyalFile.FieldDeclaration[] result)
lhsFields - rhsFields - result - protected int extractNonMatchingFields(WyalFile.FieldDeclaration[] lhsFields, WyalFile.FieldDeclaration[] rhsFields, WyalFile.FieldDeclaration[] result, int index)
lhsFields - rhsFields - result - index - Copyright © 2017. All rights reserved.