ByteCodeCompiler.st
changeset 2462 02ed895be692
parent 2428 3e8b7caa22cb
child 2469 ac59d3aa4a61
--- a/ByteCodeCompiler.st	Thu Nov 25 20:14:39 2010 +0100
+++ b/ByteCodeCompiler.st	Thu Nov 25 20:18:53 2010 +0100
@@ -2878,7 +2878,7 @@
 
     |newMethod tree symbolicCodeArray oldMethod silencio newSource primNr keptOldCode answer
      aClass sourceCodeString hasErrorInMethodHeader oldCategory newCategory oldPackage 
-     newPackage installSelector ns|
+     newPackage installSelector ns dialogText failureReason|
 
     aClass := aClassArg.
     sourceCodeString := sourceCodeStringArg.
@@ -3013,7 +3013,11 @@
      and:[(ParserFlags stcCompilation ~~ #never)
      and:[NewPrimitives ~~ true]]) ifTrue:[
         Parser::ParseError handle:[:ex |
-            self parseError:(ex description) position:1.
+            ex lineNumber notNil ifTrue:[
+                self parseError:(ex description) line:ex lineNumber.
+            ] ifFalse:[
+                self parseError:(ex description) position:1.
+            ].
             newMethod := #Error.
         ] do:[
             newMethod :=
@@ -3032,10 +3036,11 @@
 
         newMethod == #Error ifTrue:[
             self showErrorMessageForClass:aClass.
-            ^ failBlock value
+"/            ^ failBlock value
         ].
 
-        (newMethod == #CannotLoad) ifTrue:[
+        (newMethod == #CannotLoad or:[newMethod == #Error]) ifTrue:[
+            failureReason := newMethod.
             newMethod := self trappingStubMethodFor:sourceCodeString inCategory:newCategory.
             newMethod setPackage:newPackage.
             keptOldCode := false.
@@ -3045,9 +3050,23 @@
                 "/ (otherwise, you could easily make your system unusable in systems which cannot load)
                 "/
                 (oldMethod notNil and:[oldMethod code ~= newMethod code]) ifTrue:[
-                    answer := Dialog
-                                 confirm:
-'installation of binary code for ''' , aClass name , '>>' , selector , '''
+                    failureReason == #Error ifTrue:[
+                        dialogText :=     
+'STC-compilation of ''%1>>%2''
+to machine code failed .
+
+Shall I use the old methods functionality
+or instead create a dummy trap method for it ?
+
+Hint:
+  if that method is needed by the system, you better leave the
+  original functionality in the system.
+
+Close this warnBox to abort the compilation.
+'
+                    ] ifFalse:[
+                        dialogText :=     
+'installation of binary code for ''%1>>%2''
 is not possible or disabled.
 
 Shall I use the old methods functionality
@@ -3059,8 +3078,11 @@
 
 Close this warnBox to abort the compilation.
 '
-                                 yesLabel:'trap code'
-                                 noLabel:'keep old'.
+                    ].
+                    answer := Dialog
+                                 confirmWithCancel:(dialogText bindWith:aClass name with:selector)
+                                 labels:#('cancel' 'keep old' 'trap code')
+                                 default:2.
                     answer isNil ifTrue:[
                         ^ failBlock value
                     ].
@@ -3465,11 +3487,11 @@
 !ByteCodeCompiler class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.255 2010-10-15 08:39:50 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.256 2010-11-25 19:18:53 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.255 2010-10-15 08:39:50 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.256 2010-11-25 19:18:53 stefan Exp $'
 ! !
 
 ByteCodeCompiler initialize!