equal
deleted
inserted
replaced
286 |
286 |
287 //the qualifying expression is treated as a special captured arg |
287 //the qualifying expression is treated as a special captured arg |
288 JCExpression init; |
288 JCExpression init; |
289 switch(tree.kind) { |
289 switch(tree.kind) { |
290 |
290 |
291 case IMPLICIT_INNER: /** Inner # new */ |
291 case IMPLICIT_INNER: /** Inner :: new */ |
292 case SUPER: /** super # instMethod */ |
292 case SUPER: /** super :: instMethod */ |
293 init = makeThis( |
293 init = makeThis( |
294 localContext.owner.owner.asType(), |
294 localContext.owner.owner.asType(), |
295 localContext.owner); |
295 localContext.owner); |
296 break; |
296 break; |
297 |
297 |
298 case BOUND: /** Expr # instMethod */ |
298 case BOUND: /** Expr :: instMethod */ |
299 init = tree.getQualifierExpression(); |
299 init = tree.getQualifierExpression(); |
300 break; |
300 break; |
301 |
301 |
302 case STATIC_EVAL: /** Expr # staticMethod */ |
302 case UNBOUND: /** Type :: instMethod */ |
303 case UNBOUND: /** Type # instMethod */ |
303 case STATIC: /** Type :: staticMethod */ |
304 case STATIC: /** Type # staticMethod */ |
304 case TOPLEVEL: /** Top level :: new */ |
305 case TOPLEVEL: /** Top level # new */ |
|
306 init = null; |
305 init = null; |
307 break; |
306 break; |
308 |
307 |
309 default: |
308 default: |
310 throw new InternalError("Should not have an invalid kind"); |
309 throw new InternalError("Should not have an invalid kind"); |
313 List<JCExpression> indy_args = init==null? List.<JCExpression>nil() : translate(List.of(init), localContext.prev); |
312 List<JCExpression> indy_args = init==null? List.<JCExpression>nil() : translate(List.of(init), localContext.prev); |
314 |
313 |
315 |
314 |
316 //build a sam instance using an indy call to the meta-factory |
315 //build a sam instance using an indy call to the meta-factory |
317 result = makeMetaFactoryIndyCall(tree, tree.targetType, localContext.referenceKind(), refSym, indy_args); |
316 result = makeMetaFactoryIndyCall(tree, tree.targetType, localContext.referenceKind(), refSym, indy_args); |
318 |
|
319 //if we had a static reference with non-static qualifier, add a let |
|
320 //expression to force the evaluation of the qualifier expr |
|
321 if (tree.hasKind(ReferenceKind.STATIC_EVAL)) { |
|
322 VarSymbol rec = new VarSymbol(0, names.fromString("rec$"), tree.getQualifierExpression().type, localContext.owner); |
|
323 JCVariableDecl recDef = make.VarDef(rec, tree.getQualifierExpression()); |
|
324 result = make.LetExpr(recDef, result).setType(tree.type); |
|
325 } |
|
326 } |
317 } |
327 |
318 |
328 /** |
319 /** |
329 * Translate identifiers within a lambda to the mapped identifier |
320 * Translate identifiers within a lambda to the mapped identifier |
330 * @param tree |
321 * @param tree |