object IntermediateCodeTypeInference
Class containing code for determining the type of ImpLan expressions and adding casts. Does not perform type checking in any way. Hence this class should only be used for code which is known to be type correct.
- Alphabetic
- By Inheritance
- IntermediateCodeTypeInference
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def castExpression(exp: ImpLanExpr, target: Option[ImpLanType], varTypes: Map[String, ImpLanType]): ImpLanExpr
Casts an expression to a target type if necessary.
Casts an expression to a target type if necessary. Also assures type equality by wrapping sub-expressions into casts where necessary.
- exp
Expression to be casted
- target
Type to which the expression should be casted. Optional. If None only the sub-expressions are casted if necessary.
- varTypes
Type environment, mapping every possibly involved variable identifier to its type
- returns
Expression potentially wrapped into a IntermediateCode.CastingExpression and all sub-expression with non-expected type also wrapped into a cast expression.
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def generateCodeWithCasts(stmts: Seq[ImpLanStmt], varTypes: Map[String, ImpLanType], retType: Option[ImpLanType] = None): Seq[ImpLanStmt]
Adds casts to sub-expressions of a statement sequence where necessary
Adds casts to sub-expressions of a statement sequence where necessary
- stmts
Statements to be examined.
- varTypes
Type environment, mapping every possibly involved variable identifier to its type
- retType
Type to which return statements from stmts are casted. Optional. If None, no casting is performed for these return statements (but still for sub-expressions)
- returns
Statement sequence with casts added
- def generateCodeWithCasts(listing: SourceListing, varTypes: Map[String, ImpLanType]): SourceListing
Includes casts where necessary in a source listing
Includes casts where necessary in a source listing
- listing
The source listing to be examined
- varTypes
Type environment, mapping every possibly involved variable identifier to its type
- returns
The source listing with casts added
- def generateFunctionCast(innerExp: ImpLanExpr, from: FunctionType, to: FunctionType, varTypes: Map[String, ImpLanType]): ImpLanExpr
Casts a function expression into a function expression with another signature by wrapping a lambda expression around the original function.
Casts a function expression into a function expression with another signature by wrapping a lambda expression around the original function. The parameters and return value are casted in the usual way when calling the original function.
Example:
f : LongType x LongType -> LongType casted to Lazy[GeneralType] x Lazy[GeneralType] -> Lazy[GeneralType]
would produce
(tp1: Lazy[GeneralType], tp2: Lazy[GeneralType]) => {(Lazy[GeneralType])(f((LongType)tp1, (LongType)tp2)}
- innerExp
Expression to be casted.
- from
Type of innerExp
- to
Type to cast to
- varTypes
Type environment, mapping every possibly involved variable identifier to its type
- returns
Casted expression (wrapped into lambda)
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def typeInference(impLanExpr: ImpLanExpr, varTypes: Map[String, ImpLanType]): ImpLanType
Determines the type of an IntermediateCode.ImpLanExpr.
Determines the type of an IntermediateCode.ImpLanExpr. This function may return error-prone results if the examined expression is not type-correct.
- impLanExpr
Expression to be examined
- varTypes
Type environment, mapping every possibly involved variable identifier to its type
- returns
Type of the expression
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated