core: Throw an error when defining MAIN: with a stack effect other than ( -- ). Fixes #1060.
parent
309ce3aa69
commit
afcb610960
|
@ -127,3 +127,10 @@ M: effect clone
|
|||
[ in>> length ] [ out>> length ] [ terminated?>> ] tri
|
||||
pick 0 = [ [ 1 + ] dip ] [ [ 1 - ] 2dip ] if
|
||||
[ [ "x" <array> ] bi@ ] dip <terminated-effect> ;
|
||||
|
||||
ERROR: bad-stack-effect word expected got ;
|
||||
|
||||
: check-stack-effect ( word effect -- )
|
||||
[ dup stack-effect ] dip
|
||||
2dup effect=
|
||||
[ 3drop ] [ bad-stack-effect ] if ;
|
||||
|
|
|
@ -4,11 +4,11 @@ USING: accessors arrays byte-arrays byte-vectors
|
|||
classes.algebra.private classes.builtin classes.intersection
|
||||
classes.maybe classes.mixin classes.parser classes.predicate
|
||||
classes.singleton classes.tuple classes.tuple.parser
|
||||
classes.union combinators compiler.units definitions
|
||||
classes.union combinators compiler.units definitions effects
|
||||
effects.parser generic generic.hook generic.math generic.parser
|
||||
generic.standard hash-sets hashtables io.pathnames kernel lexer
|
||||
math namespaces parser quotations sbufs sequences slots
|
||||
source-files splitting strings strings.parser vectors
|
||||
source-files splitting strings strings.parser vectors vocabs
|
||||
vocabs.parser words words.alias words.constant words.symbol ;
|
||||
IN: bootstrap.syntax
|
||||
|
||||
|
@ -233,6 +233,7 @@ IN: bootstrap.syntax
|
|||
|
||||
"MAIN:" [
|
||||
scan-word
|
||||
dup ( -- ) check-stack-effect
|
||||
[ current-vocab main<< ]
|
||||
[ file get [ main<< ] [ drop ] if* ] bi
|
||||
] define-core-syntax
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2007, 2009 Eduardo Cavazos, Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors assocs definitions kernel namespaces sequences
|
||||
sorting splitting strings ;
|
||||
USING: accessors assocs definitions kernel namespaces
|
||||
sequences sorting splitting strings ;
|
||||
IN: vocabs
|
||||
|
||||
SYMBOL: dictionary
|
||||
|
|
Loading…
Reference in New Issue