Thread: [Nice-commit] Nice/src/bossa/syntax NiceClass.java,1.71,1.72 Constructor.java,1.7,1.8
Brought to you by:
bonniot
From: <bo...@us...> - 2003-11-26 16:25:58
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv3482/src/bossa/syntax Modified Files: NiceClass.java Constructor.java Log Message: Do not regenerate constructors for compiled packages. Index: NiceClass.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceClass.java,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** NiceClass.java 26 Nov 2003 10:06:30 -0000 1.71 --- NiceClass.java 26 Nov 2003 16:25:55 -0000 1.72 *************** *** 549,553 **** + serialUIDFieldString() + Util.map("", ";\n", ";\n", overrides) - + Util.map("{\n", "\n", "}\n", initializers) + "}\n\n" ); --- 549,552 ---- Index: Constructor.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Constructor.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Constructor.java 11 Aug 2003 19:31:31 -0000 1.7 --- Constructor.java 26 Nov 2003 16:25:55 -0000 1.8 *************** *** 57,78 **** { getCode(); ! ConstructorExp lambda = // lambdaOmitDefaults is null if the two versions are identical ! omitDefaults && lambdaOmitDefaults != null ! ? lambdaOmitDefaults : this.lambda; ! return new QuoteExp(new InitializeProc(lambda)); } ! /** The constructor, with all the arguments. */ ! private ConstructorExp lambda; ! /** The constructor, with only non-default. */ ! private ConstructorExp lambdaOmitDefaults; protected Expression computeCode() { ! this.lambdaOmitDefaults = createBytecode(true); ! this.lambda = createBytecode(false); ! return new QuoteExp(new InstantiateProc(this.lambda)); } --- 57,80 ---- { getCode(); ! return // lambdaOmitDefaults is null if the two versions are identical ! omitDefaults && initializeOmitDefaults != null ! ? initializeOmitDefaults : initialize; } ! /** Call the constructor, with all the arguments. */ ! private Expression initialize; ! /** Call the constructor, with only non-default arguments. */ ! private Expression initializeOmitDefaults; ! ! /** Instantiate the class, calling the constructor with all the arguments. */ ! private Expression instantiate; protected Expression computeCode() { ! createBytecode(true); ! createBytecode(false); ! return instantiate; } *************** *** 81,85 **** default values as parameters, but use that default instead. */ ! private ConstructorExp createBytecode(boolean omitDefaults) { ClassType thisType = (ClassType) javaReturnType(); --- 83,87 ---- default values as parameters, but use that default instead. */ ! private void createBytecode(boolean omitDefaults) { ClassType thisType = (ClassType) javaReturnType(); *************** *** 104,113 **** // no default to omit! if (omitDefaults && args.size() == fullArgs.length) ! return null; ConstructorExp lambda = Gen.createConstructor ! (thisType, ! (Type[]) argTypes.toArray(new Type[argTypes.size()]), ! (MonoSymbol[]) args.toArray(new MonoSymbol[args.size()])); Expression[] body = --- 106,133 ---- // no default to omit! if (omitDefaults && args.size() == fullArgs.length) ! return; ! ! Type[] argTypesArray = (Type[]) argTypes.toArray(new Type[argTypes.size()]); ! MonoSymbol[] argsArray = (MonoSymbol[]) args.toArray(new MonoSymbol[args.size()]); ! ! if (classe.definition.inInterfaceFile()) ! { ! Method m = classe.getClassExp().getClassType().getDeclaredMethod ! ("<init>", argTypesArray); ! ! if (omitDefaults) ! { ! initializeOmitDefaults = new QuoteExp(new InitializeProc(m)); ! } ! else ! { ! initialize = new QuoteExp(new InitializeProc(m)); ! instantiate = new QuoteExp(new InstantiateProc(m)); ! } ! return; ! } ConstructorExp lambda = Gen.createConstructor ! (thisType, argTypesArray, argsArray); Expression[] body = *************** *** 140,144 **** classe.getClassExp().addMethod(lambda); ! return lambda; } --- 160,172 ---- classe.getClassExp().addMethod(lambda); ! if (omitDefaults) ! { ! initializeOmitDefaults = new QuoteExp(new InitializeProc(lambda)); ! } ! else ! { ! initialize = new QuoteExp(new InitializeProc(lambda)); ! instantiate = new QuoteExp(new InstantiateProc(lambda)); ! } } |