public final class WyilFile
extends wybs.util.AbstractCompilationUnit
Provides an in-memory representation of a binary WyIL file. This is an Intermediate Representation of Whiley (and potentially other) files, where all aspects of name resolution and type checking are already resolved. Furthermore, the Whiley Intermediate Language (WyIL) is a low-level, register-based bytecode format where control-flow constructs are flattened into unstructured control flow using conditional and unconditional branching.
The purpose of the WyIL file format is to simply the construction of back-ends for the Whiley compiler, as well as simplifying the process of name and type resolution in libraries. The format achieves a similar goal to that Java ClassFile format, except that it is geared towards Whiley rather than Java.
| Modifier and Type | Class and Description |
|---|---|
static class |
WyilFile.Block
A block is an chunk of information within a WyIL file.
|
static class |
WyilFile.Constant
A constant declaration is a top-level block within a WyilFile that
associates a name with a given constant value.
|
static class |
WyilFile.Declaration
A declaration is a named entity within a WyIL file, and is either a type,
constant, function or method declaration.
|
static class |
WyilFile.FunctionOrMethod |
static class |
WyilFile.FunctionOrMethodOrProperty |
static class |
WyilFile.Property |
static class |
WyilFile.Type
A type declaration is a top-level block within a WyilFile that associates
a name with a given type.
|
| Modifier and Type | Field and Description |
|---|---|
static wyfs.lang.Content.Type<WyilFile> |
ContentType
Responsible for identifying and reading/writing WyilFiles.
|
| Constructor and Description |
|---|
WyilFile(wyfs.lang.Path.Entry<? extends wybs.lang.CompilationUnit> entry)
Construct a WyilFile objects with a given identifier, originating
filename and list of declarations.
|
| Modifier and Type | Method and Description |
|---|---|
List<WyilFile.Block> |
blocks()
Returns all declarations declared in this WyilFile.
|
WyilFile.Constant |
constant(String name)
Looks up a constant declaration in this WyilFile with the given name; if none
exists, returns null.
|
Collection<WyilFile.Constant> |
constants()
Returns all constant declarations in this WyilFile.
|
List<WyilFile.FunctionOrMethodOrProperty> |
functionOrMethodOrProperty(String name)
Returns all function or method declarations in this WyilFile with the
given name.
|
WyilFile.FunctionOrMethodOrProperty |
functionOrMethodOrProperty(String name,
Type.FunctionOrMethod ft)
Looks up a function or method declaration in this WyilFile with the given
name and type; if none exists, returns null.
|
Collection<WyilFile.FunctionOrMethod> |
functionOrMethods()
Returns all function or method declarations in this WyilFile.
|
boolean |
hasName(String name)
Determines whether a declaration exists with the given name.
|
void |
replace(WyilFile.Block old,
WyilFile.Block nuw) |
WyilFile.Type |
type(String name)
Looks up a type declaration in this WyilFile with the given name; if none
exists, returns null.
|
Collection<WyilFile.Type> |
types()
Returns all type declarations in this WyilFile.
|
public static final wyfs.lang.Content.Type<WyilFile> ContentType
public WyilFile(wyfs.lang.Path.Entry<? extends wybs.lang.CompilationUnit> entry)
mid - filename - declarations - public boolean hasName(String name)
name - public List<WyilFile.Block> blocks()
public WyilFile.Type type(String name)
name - public Collection<WyilFile.Type> types()
name - public WyilFile.Constant constant(String name)
name - public Collection<WyilFile.Constant> constants()
name - public List<WyilFile.FunctionOrMethodOrProperty> functionOrMethodOrProperty(String name)
name - public WyilFile.FunctionOrMethodOrProperty functionOrMethodOrProperty(String name, Type.FunctionOrMethod ft)
name - public Collection<WyilFile.FunctionOrMethod> functionOrMethods()
name - public void replace(WyilFile.Block old, WyilFile.Block nuw)
Copyright © 2017. All rights reserved.