@@ -1273,7 +1273,10 @@ object Semantic:
1273
1273
*
1274
1274
* This method only handles cache logic and delegates the work to `cases`.
1275
1275
*
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.
1277
1280
*/
1278
1281
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) {
1279
1282
cache.get(thisV, expr) match
@@ -1303,6 +1306,10 @@ object Semantic:
1303
1306
/** Handles the evaluation of different expressions
1304
1307
*
1305
1308
* 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.
1306
1313
*/
1307
1314
def cases (expr : Tree , thisV : Ref , klass : ClassSymbol ): Contextual [Value ] =
1308
1315
val trace2 = trace.add(expr)
@@ -1480,7 +1487,14 @@ object Semantic:
1480
1487
report.error(" [Internal error] unexpected tree" + Trace .show, expr)
1481
1488
Hot
1482
1489
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
+ */
1484
1498
def cases (tp : Type , thisV : Ref , klass : ClassSymbol ): Contextual [Value ] = log(" evaluating " + tp.show, printer, (_ : Value ).show) {
1485
1499
tp match
1486
1500
case _ : ConstantType =>
@@ -1518,7 +1532,12 @@ object Semantic:
1518
1532
Hot
1519
1533
}
1520
1534
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
+ */
1522
1541
def resolveThis (target : ClassSymbol , thisV : Value , klass : ClassSymbol ): Contextual [Value ] = log(" resolving " + target.show + " , this = " + thisV.show + " in " + klass.show, printer, (_ : Value ).show) {
1523
1542
if target == klass then thisV
1524
1543
else if target.is(Flags .Package ) then Hot
@@ -1543,7 +1562,12 @@ object Semantic:
1543
1562
1544
1563
}
1545
1564
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
+ */
1547
1571
def outerValue (tref : TypeRef , thisV : Ref , klass : ClassSymbol ): Contextual [Value ] =
1548
1572
val cls = tref.classSymbol.asClass
1549
1573
if tref.prefix == NoPrefix then
@@ -1554,7 +1578,12 @@ object Semantic:
1554
1578
if cls.isAllOf(Flags .JavaInterface ) then Hot
1555
1579
else cases(tref.prefix, thisV, klass)
1556
1580
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
+ */
1558
1587
def init (tpl : Template , thisV : Ref , klass : ClassSymbol ): Contextual [Value ] = log(" init " + klass.show, printer, (_ : Value ).show) {
1559
1588
val paramsMap = tpl.constr.termParamss.flatten.map { vdef =>
1560
1589
vdef.name -> thisV.objekt.field(vdef.symbol)
0 commit comments