@@ -1273,7 +1273,10 @@ object Semantic:
12731273 *
12741274 * This method only handles cache logic and delegates the work to `cases`.
12751275 *
1276- * The parameter `cacheResult` is used to reduce the size of the cache.
1276+ * @param expr The expression to be evaluated.
1277+ * @param thisV The value for `C.this` where `C` is represented by the parameter `klass`.
1278+ * @param klass The enclosing class where the expression is located.
1279+ * @param cacheResult It is used to reduce the size of the cache.
12771280 */
12781281 def eval (expr : Tree , thisV : Ref , klass : ClassSymbol , cacheResult : Boolean = false ): Contextual [Value ] = log(" evaluating " + expr.show + " , this = " + thisV.show + " in " + klass.show, printer, (_ : Value ).show) {
12791282 cache.get(thisV, expr) match
@@ -1303,6 +1306,10 @@ object Semantic:
13031306 /** Handles the evaluation of different expressions
13041307 *
13051308 * Note: Recursive call should go to `eval` instead of `cases`.
1309+ *
1310+ * @param expr The expression to be evaluated.
1311+ * @param thisV The value for `C.this` where `C` is represented by the parameter `klass`.
1312+ * @param klass The enclosing class where the expression `expr` is located.
13061313 */
13071314 def cases (expr : Tree , thisV : Ref , klass : ClassSymbol ): Contextual [Value ] =
13081315 val trace2 = trace.add(expr)
@@ -1480,7 +1487,14 @@ object Semantic:
14801487 report.error(" [Internal error] unexpected tree" + Trace .show, expr)
14811488 Hot
14821489
1483- /** Handle semantics of leaf nodes */
1490+ /** Handle semantics of leaf nodes
1491+ *
1492+ * For leaf nodes, their semantics is determined by their types.
1493+ *
1494+ * @param tp The type to be evaluated.
1495+ * @param thisV The value for `C.this` where `C` is represented by the parameter `klass`.
1496+ * @param klass The enclosing class where the type `tp` is located.
1497+ */
14841498 def cases (tp : Type , thisV : Ref , klass : ClassSymbol ): Contextual [Value ] = log(" evaluating " + tp.show, printer, (_ : Value ).show) {
14851499 tp match
14861500 case _ : ConstantType =>
@@ -1518,7 +1532,12 @@ object Semantic:
15181532 Hot
15191533 }
15201534
1521- /** Resolve C.this that appear in `klass` */
1535+ /** Resolve C.this that appear in `klass`
1536+ *
1537+ * @param target The class symbol for `C` for which `C.this` is to be resolved.
1538+ * @param thisV The value for `D.this` where `D` is represented by the parameter `klass`.
1539+ * @param klass The enclosing class where the type `C.this` is located.
1540+ */
15221541 def resolveThis (target : ClassSymbol , thisV : Value , klass : ClassSymbol ): Contextual [Value ] = log(" resolving " + target.show + " , this = " + thisV.show + " in " + klass.show, printer, (_ : Value ).show) {
15231542 if target == klass then thisV
15241543 else if target.is(Flags .Package ) then Hot
@@ -1543,7 +1562,12 @@ object Semantic:
15431562
15441563 }
15451564
1546- /** Compute the outer value that correspond to `tref.prefix` */
1565+ /** Compute the outer value that correspond to `tref.prefix`
1566+ *
1567+ * @param tref The type whose prefix is to be evaluated.
1568+ * @param thisV The value for `C.this` where `C` is represented by the parameter `klass`.
1569+ * @param klass The enclosing class where the type `tref` is located.
1570+ */
15471571 def outerValue (tref : TypeRef , thisV : Ref , klass : ClassSymbol ): Contextual [Value ] =
15481572 val cls = tref.classSymbol.asClass
15491573 if tref.prefix == NoPrefix then
@@ -1554,7 +1578,12 @@ object Semantic:
15541578 if cls.isAllOf(Flags .JavaInterface ) then Hot
15551579 else cases(tref.prefix, thisV, klass)
15561580
1557- /** Initialize part of an abstract object in `klass` of the inheritance chain */
1581+ /** Initialize part of an abstract object in `klass` of the inheritance chain
1582+ *
1583+ * @param tpl The class body to be evaluated.
1584+ * @param thisV The value of the current object to be initialized.
1585+ * @param klass The class to which the template belongs.
1586+ */
15581587 def init (tpl : Template , thisV : Ref , klass : ClassSymbol ): Contextual [Value ] = log(" init " + klass.show, printer, (_ : Value ).show) {
15591588 val paramsMap = tpl.constr.termParamss.flatten.map { vdef =>
15601589 vdef.name -> thisV.objekt.field(vdef.symbol)
0 commit comments