lingua-franca 0.10.1
Lingua Franca code generator
Loading...
Searching...
No Matches
org.lflang.InferredType Class Reference

A helper class that represents an inferred type. More...

Public Member Functions

String baseType ()
 Convert the inferred type to its textual representation while ignoring any list qualifiers or type arguments.
boolean isUndefined ()
 Check if the inferred type is undefined.
String toOriginalText ()
 Convert the inferred type to its textual representation as it would appear in LF code, without CodeMap tags inserted.
String toText ()
 Convert the inferred type to its textual representation as it would appear in LF code, with CodeMap tags inserted.

Static Public Member Functions

static InferredType fromAST (Type type)
 Create an inferred type from an AST node.
static InferredType time ()
 Create an inferred type representing time.
static InferredType undefined ()
 Create an undefined inferred type.

Public Attributes

final Type astType
 The AST node representing the inferred type if such a node exists.
final boolean isTime
 A flag indicating whether the inferred type has the base type time.

Detailed Description

A helper class that represents an inferred type.

This class helps to separate the rules of type inference from code generation for types. It is particularly useful in cases when the type is not given directly in LF code, but is inferred from the context. In this case it could happen that no ASTNode representing the type does not exist. For instance when a parameter type is inferred from a time value. All in all, this class provides a clean interface between type inference in ASTUtils and code generation.

ASTUtils provides functionality to create an inferred type from Lingua Franca variables (getInferredType). This inferred type can than be translated to target code using the code generators or be converted to a general textual representation using toText().

Author
Christian Menard

Member Function Documentation

◆ baseType()

String org.lflang.InferredType.baseType ( )

Convert the inferred type to its textual representation while ignoring any list qualifiers or type arguments.

Returns
Textual representation of this inferred type without list qualifiers

◆ fromAST()

InferredType org.lflang.InferredType.fromAST ( Type type)
static

Create an inferred type from an AST node.

Parameters
typean AST node
Returns
A new inferred type representing the given AST node

◆ isUndefined()

boolean org.lflang.InferredType.isUndefined ( )

Check if the inferred type is undefined.

◆ time()

InferredType org.lflang.InferredType.time ( )
static

Create an inferred type representing time.

◆ toOriginalText()

String org.lflang.InferredType.toOriginalText ( )

Convert the inferred type to its textual representation as it would appear in LF code, without CodeMap tags inserted.

◆ toText()

String org.lflang.InferredType.toText ( )

Convert the inferred type to its textual representation as it would appear in LF code, with CodeMap tags inserted.

◆ undefined()

InferredType org.lflang.InferredType.undefined ( )
static

Create an undefined inferred type.

Member Data Documentation

◆ astType

final Type org.lflang.InferredType.astType

The AST node representing the inferred type if such a node exists.

◆ isTime

final boolean org.lflang.InferredType.isTime

A flag indicating whether the inferred type has the base type time.


The documentation for this class was generated from the following file:
  • /Users/runner/work/lingua-franca/lingua-franca/core/src/main/java/org/lflang/InferredType.java