--- a/ByteCodeCompiler.st Sat Nov 10 02:06:10 2001 +0100
+++ b/ByteCodeCompiler.st Thu Nov 15 21:03:13 2001 +0100
@@ -21,7 +21,7 @@
ShareCode STCKeepSTIntermediate STCKeepCIntermediate
STCModulePath CCCompilationOptions CC STC ListCompiledMethods
STCKeepOIntermediate Verbose NewCodeSet NewPrimitives
- AllowExtensionsToPrivateClasses'
+ AllowExtensionsToPrivateClasses RestartCompilationSignal'
poolDictionaries:''
category:'System-Compiler'
!
@@ -454,6 +454,7 @@
STCModulePath := './modules'.
ListCompiledMethods := false.
AllowExtensionsToPrivateClasses := true.
+ RestartCompilationSignal := Signal new.
"
STCKeepCIntermediate := true.
@@ -461,7 +462,7 @@
STCKeepSTIntermediate := true.
"
- "Modified: / 21.10.1998 / 15:39:52 / cg"
+ "Modified: / 15.11.2001 / 17:20:51 / cg"
!
newCodeSet
@@ -490,6 +491,14 @@
"
! !
+!ByteCodeCompiler class methodsFor:'Signal constants'!
+
+restartCompilationSignal
+ ^ RestartCompilationSignal
+
+ "Created: / 15.11.2001 / 17:20:59 / cg"
+! !
+
!ByteCodeCompiler class methodsFor:'compiling methods'!
compile:methodText forClass:classToCompileFor
@@ -596,7 +605,7 @@
foldConstants:true
!
-compile:aString forClass:aClass inCategory:cat notifying:requestor
+compile:aString forClass:aClassArg inCategory:cat notifying:requestor
install:install skipIfSame:skipIfSame silent:silent foldConstants:fold
"the basic workhorse method for compiling:
@@ -614,7 +623,9 @@
|compiler newMethod tree symbolicCodeArray oldMethod lazy silencio
sourceFile sourceStream newSource primNr pos sel keptOldCode msg answer
- pkg|
+ pkg aClass errorOccurred|
+
+ aClass := aClassArg.
aString isNil ifTrue:[^ nil].
silencio := silent
@@ -626,27 +637,34 @@
"/ no longer ...
lazy := false.
- "create a compiler, let it parse and create the parsetree"
-
- compiler := self for:(ReadStream on:aString) in:aClass.
- compiler parseForCode.
- fold ifFalse:[compiler foldConstants:nil].
- compiler notifying:requestor.
- silent ifTrue:[
-"/ compiler ignoreErrors.
- compiler ignoreWarnings.
- compiler warnUndeclared:false.
+ RestartCompilationSignal handle:[:ex |
+ "/ class could have changed ...
+ aClass := compiler classToCompileFor.
+ ex restart
+ ] do:[
+ "create a compiler, let it parse and create the parsetree"
+
+ compiler := self for:(ReadStream on:aString) in:aClass.
+ compiler parseForCode.
+ fold ifFalse:[compiler foldConstants:nil].
+ compiler notifying:requestor.
+ silent ifTrue:[
+ "/ compiler ignoreErrors.
+ compiler ignoreWarnings.
+ compiler warnUndeclared:false.
+ ].
+ "/ compiler nextToken.
+
+ (errorOccurred := (compiler parseMethodSpec == #Error)) ifTrue:[
+ compiler parseError:'syntax error in method specification'.
+ tree := #Error.
+ ] ifFalse:[
+ tree := compiler parseMethodBody.
+ compiler checkForEndOfInput.
+ compiler tree:tree.
+ ].
].
-"/ compiler nextToken.
-
- (compiler parseMethodSpec == #Error) ifTrue:[
- compiler parseError:'syntax error in method specification'.
- tree := #Error
- ] ifFalse:[
- tree := compiler parseMethodBody.
- compiler checkForEndOfInput.
- compiler tree:tree.
-
+ errorOccurred ifFalse:[
(aClass isNil or:[AllowExtensionsToPrivateClasses or:[aClass owningClass isNil]]) ifTrue:[
(requestor respondsTo:#packageToInstall) ifFalse:[
pkg := Class packageQuerySignal query.
@@ -945,8 +963,8 @@
^ newMethod
"Created: / 29.10.1995 / 19:59:36 / cg"
- "Modified: / 13.6.1998 / 13:51:31 / cg"
"Modified: / 19.3.1999 / 08:31:09 / stefan"
+ "Modified: / 15.11.2001 / 17:21:42 / cg"
!
compile:methodText forClass:classToCompileFor notifying:requestor
@@ -3754,6 +3772,6 @@
!ByteCodeCompiler class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.192 2001-11-10 00:50:26 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.193 2001-11-15 20:03:13 cg Exp $'
! !
ByteCodeCompiler initialize!