Changeset 4318 for trunk/ProjectFortress/src
- Timestamp:
- 11/06/09 14:37:52 (3 weeks ago)
- Location:
- trunk/ProjectFortress/src/com/sun/fortress
- Files:
-
- 2 modified
-
compiler/codegen/CodeGen.java (modified) (5 diffs)
-
scala_src/typechecker/AbstractMethodChecker.scala (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ProjectFortress/src/com/sun/fortress/compiler/codegen/CodeGen.java
r4315 r4318 524 524 private void doStatements(List<Expr> stmts) { 525 525 int onStack = 0; 526 if (stmts.isEmpty()) { 527 pushVoid(); 528 return; 529 } 526 530 for ( Expr e : stmts ) { 527 531 popAll(onStack); … … 555 559 inABlock=oldInABlock; 556 560 } 561 557 562 public void forChainExpr(ChainExpr x) { 558 563 debug( "forChainExpr", x); … … 651 656 652 657 dumpClass( packageAndClassName ); 653 658 654 659 try { 655 660 jos.close(); … … 2410 2415 Type receiverType = exprType(obj); 2411 2416 if (!(receiverType instanceof TraitType)) { 2412 sayWhat(x, "receiver type is not TraitType in " + x);2417 sayWhat(x, "receiver type "+receiverType+" is not TraitType in " + x); 2413 2418 } 2414 2419 … … 2482 2487 public void for_RewriteFnApp(_RewriteFnApp x) { 2483 2488 debug("for_RewriteFnApp ", x, 2484 " args = ", x.getArgument(), " function = ", x.getFunction(), 2489 " args = ", x.getArgument(), " function = ", x.getFunction(), 2485 2490 " function class = ", x.getFunction()); 2486 2491 // This is a little weird. If a function takes no arguments the parser gives me a void literal expr -
trunk/ProjectFortress/src/com/sun/fortress/scala_src/typechecker/AbstractMethodChecker.scala
r4309 r4318 74 74 val inherited = inheritedMethods(traits, extendsC, Set(), typeAnalyzer) 75 75 .map(t => t._1.asInstanceOf[IdOrOp].getText) 76 for ( d <- decls ; if d.isInstanceOf[FnDecl] ) { 77 if ( NU.isFunctionalMethod(NU.getParams(d.asInstanceOf[FnDecl])) && 78 ! inherited.exists(NU.getName(d.asInstanceOf[FnDecl]).asInstanceOf[IdOrOp].getText.equals(_)) ) 79 error(span, "Object expressions should not define any new " + 80 "functional methods.") 81 } 76 for { 77 d <- decls; 78 if d.isInstanceOf[FnDecl]; 79 if NU.isFunctionalMethod(NU.getParams(d.asInstanceOf[FnDecl])); 80 if !inherited.exists(NU.getName(d.asInstanceOf[FnDecl]).asInstanceOf[IdOrOp] 81 .getText.equals(_)) 82 } error(span, "Object expressions should not define any new " + 83 "functional methods.") 82 84 83 85 case _ => super.walk(node) … … 95 97 typeAnalyzer = typeAnalyzer.extend(sparams, None) 96 98 val toCheck = inheritedAbstractMethods(extendsC) 97 for ( (owner, d) <- toCheck ) { 98 if ( ! implement(d, decls, owner) ) { 99 for ( (owner, d) <- toCheck; if (!implement(d, decls, owner)) ) { 99 100 error(span, 100 101 "The inherited abstract method " + d + " from the trait " + owner + 101 102 "\n in the object " + name + 102 103 " is not defined in the component " + componentName + ".") 103 }104 104 } 105 105 typeAnalyzer = oldTypeAnalyzer … … 129 129 private def collectAbstractMethods(name: IdOrOp, decls: List[Decl]) = { 130 130 val set = new HashSet[FnDecl] 131 decls.foreach( (d: Decl) => d match { 132 case fd@SFnDecl(_,SFnHeader(_,mods,_,_,_,_,_,_),_,body,_) => 133 if ( component.typeConses.containsKey(name) ) { 134 if ( ! body.isDefined ) set += fd 135 } else if ( mods.isAbstract ) set += fd 136 case _ => }) 131 for ( fd@SFnDecl(_,SFnHeader(_,mods,_,_,_,_,_,_),_,body,_) <- decls ) { 132 if ( component.typeConses.containsKey(name) ) { 133 if ( ! body.isDefined ) set += fd 134 } else if ( mods.isAbstract ) set += fd 135 } 137 136 set 138 137 }

