class: ByteCodeCompiler
changed: #compile:forClass:inCategory:notifying:install:skipIfSame:silent:foldConstants:ifFail:
care for failBlock
--- a/ByteCodeCompiler.st Wed Nov 19 21:03:55 2014 +0100
+++ b/ByteCodeCompiler.st Thu Nov 20 00:24:10 2014 +0100
@@ -3003,31 +3003,39 @@
currentBlock := nil.
ex restart
] do:[
- "create a compiler, let it parse and create the parsetree"
-
- self source:(ReadStream on:sourceCodeString string).
- self nextToken.
-
- self setClassToCompileFor:aClass.
-
- self parseForCode.
- fold ifFalse:[self foldConstants:nil].
- self notifying:aRequestor.
- silent ifTrue:[
- "/ self ignoreErrors:true.
- self ignoreWarnings:true.
- self warnUndeclared:false.
- ].
-
- hasErrorInMethodHeader := (self parseMethodSpec == #Error).
- hasErrorInMethodHeader ifTrue:[
- self parseError:'syntax error in method specification'.
- tree := #Error.
- ] ifFalse:[
- tree := self parseMethodBody.
- tree == #Error ifFalse:[
- self checkForEndOfInput.
- self tree:tree.
+ ParseError handle:[:ex |
+ failBlock isNil ifTrue:[
+ ex reject
+ ].
+ self showErrorMessageForClass:aClass.
+ ^ failBlock value.
+ ] do:[
+ "create a compiler, let it parse and create the parsetree"
+
+ self source:(ReadStream on:sourceCodeString string).
+ self nextToken.
+
+ self setClassToCompileFor:aClass.
+
+ self parseForCode.
+ fold ifFalse:[self foldConstants:nil].
+ self notifying:aRequestor.
+ silent ifTrue:[
+ "/ self ignoreErrors:true.
+ self ignoreWarnings:true.
+ self warnUndeclared:false.
+ ].
+
+ hasErrorInMethodHeader := (self parseMethodSpec == #Error).
+ hasErrorInMethodHeader ifTrue:[
+ self parseError:'syntax error in method specification'.
+ tree := #Error.
+ ] ifFalse:[
+ tree := self parseMethodBody.
+ tree == #Error ifFalse:[
+ self checkForEndOfInput.
+ self tree:tree.
+ ].
].
].
].
@@ -3610,11 +3618,11 @@
!ByteCodeCompiler class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.288 2014-09-30 09:24:59 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.289 2014-11-19 23:24:10 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.288 2014-09-30 09:24:59 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.289 2014-11-19 23:24:10 cg Exp $'
!
version_SVN