diff options
author | Adrian Thurston <thurston@complang.org> | 2014-01-04 11:23:41 -0500 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2014-01-04 11:23:41 -0500 |
commit | 83a6e3659b1a8e7ce19318535abca126a240459d (patch) | |
tree | 2846182f055f075512d8129f5f68fca691e2a357 | |
parent | df04e25ec6b977f272fd0ff273ac6be04308f8b2 (diff) | |
download | colm-83a6e3659b1a8e7ce19318535abca126a240459d.tar.gz |
moved init object functions up out of synthesis pass
-rw-r--r-- | src/compiler.cc | 11 | ||||
-rw-r--r-- | src/declare.cc | 2 | ||||
-rw-r--r-- | src/parsedata.h | 4 | ||||
-rw-r--r-- | src/synthesis.cc | 19 |
4 files changed, 16 insertions, 20 deletions
diff --git a/src/compiler.cc b/src/compiler.cc index ae892849..417e33ba 100644 --- a/src/compiler.cc +++ b/src/compiler.cc @@ -1139,6 +1139,17 @@ void Compiler::compile() prepGrammar(); + initIntObject(); + initStrObject(); + initStreamObject(); + initTokenObjects(); + initAllLanguageObjects(); + initGenericTypes(); + initGlobalFunctions(); + + for ( FunctionList::Iter f = functionList; f.lte(); f++ ) + initUserFunctions( f, f->isUserIter ); + /* Compile bytecode. */ compileByteCode(); diff --git a/src/declare.cc b/src/declare.cc index dc8086f1..eb9c4cbb 100644 --- a/src/declare.cc +++ b/src/declare.cc @@ -729,7 +729,7 @@ void Compiler::declarePass() makeIgnoreCollectors(); for ( FunctionList::Iter f = functionList; f.lte(); f++ ) - makeFuncVisible1( f, f->isUserIter ); + makeFuncVisible( f, f->isUserIter ); rootNamespace->declare( this ); diff --git a/src/parsedata.h b/src/parsedata.h index c71c0f94..e1c2ebcb 100644 --- a/src/parsedata.h +++ b/src/parsedata.h @@ -775,8 +775,8 @@ struct Compiler void resolveListElementOf( ObjectDef *container, ObjectDef *obj, ElementOf *elof ); void resolveMapElementOf( ObjectDef *container, ObjectDef *obj, ElementOf *elof ); void resolveElementOf( ObjectDef *obj ); - void makeFuncVisible1( Function *func, bool isUserIter ); - void makeFuncVisible2( Function *func, bool isUserIter ); + void makeFuncVisible( Function *func, bool isUserIter ); + void initUserFunctions( Function *func, bool isUserIter ); void declareFunction( Function *func ); void declareReductionCode( Production *prod ); diff --git a/src/synthesis.cc b/src/synthesis.cc index 33853bd4..36c68136 100644 --- a/src/synthesis.cc +++ b/src/synthesis.cc @@ -2825,7 +2825,7 @@ void Compiler::initGenericTypes() } } -void Compiler::makeFuncVisible1( Function *func, bool isUserIter ) +void Compiler::makeFuncVisible( Function *func, bool isUserIter ) { func->localFrame = func->codeBlock->localFrame; @@ -2861,7 +2861,7 @@ void Compiler::makeFuncVisible1( Function *func, bool isUserIter ) func->objMethod = objMethod; } -void Compiler::makeFuncVisible2( Function *func, bool isUserIter ) +void Compiler::initUserFunctions( Function *func, bool isUserIter ) { /* Set up the parameters. */ long paramPos = 0, paramListSize = 0; @@ -3158,21 +3158,6 @@ void Compiler::removeNonUnparsableRepls() void Compiler::compileByteCode() { - initIntObject(); - initStrObject(); - initStreamObject(); - initTokenObjects(); - initAllLanguageObjects(); - initGenericTypes(); - - initGlobalFunctions(); - - for ( FunctionList::Iter f = functionList; f.lte(); f++ ) - makeFuncVisible2( f, f->isUserIter ); - - /* This may be comment rot: The function info structure relies on functions - * being compiled first, then iterators. */ - /* Compile functions. */ for ( FunctionList::Iter f = functionList; f.lte(); f++ ) { if ( f->isUserIter ) |