Commit 7308254f authored by Dag Sverre Seljebotn's avatar Dag Sverre Seljebotn

Now handles the case of pipeline raising exception correctly

parent 1ccf0b8e
...@@ -325,15 +325,15 @@ def create_parse(context): ...@@ -325,15 +325,15 @@ def create_parse(context):
return tree return tree
return parse return parse
def create_generate_code(context, options): def create_generate_code(context, options, result):
def generate_code(module_node): def generate_code(module_node):
scope = module_node.scope scope = module_node.scope
result = create_default_resultobj(module_node.compilation_source, options)
module_node.process_implementation(options, result) module_node.process_implementation(options, result)
result.compilation_source = module_node.compilation_source
return result return result
return generate_code return generate_code
def create_default_pipeline(context, options): def create_default_pipeline(context, options, result):
from ParseTreeTransforms import WithTransform, PostParse from ParseTreeTransforms import WithTransform, PostParse
from ParseTreeTransforms import AnalyseDeclarationsTransform, AnalyseExpressionsTransform from ParseTreeTransforms import AnalyseDeclarationsTransform, AnalyseExpressionsTransform
from ModuleNode import check_c_classes from ModuleNode import check_c_classes
...@@ -345,7 +345,7 @@ def create_default_pipeline(context, options): ...@@ -345,7 +345,7 @@ def create_default_pipeline(context, options):
AnalyseDeclarationsTransform(), AnalyseDeclarationsTransform(),
check_c_classes, check_c_classes,
AnalyseExpressionsTransform(), AnalyseExpressionsTransform(),
create_generate_code(context, options) create_generate_code(context, options, result)
] ]
def create_default_resultobj(compilation_source, options): def create_default_resultobj(compilation_source, options):
...@@ -380,11 +380,14 @@ def run_pipeline(source, options, full_module_name = None): ...@@ -380,11 +380,14 @@ def run_pipeline(source, options, full_module_name = None):
full_module_name = full_module_name or context.extract_module_name(source, options) full_module_name = full_module_name or context.extract_module_name(source, options)
source = CompilationSource(source_desc, full_module_name, cwd) source = CompilationSource(source_desc, full_module_name, cwd)
# Set up result object
result = create_default_resultobj(source, options)
# Get pipeline # Get pipeline
pipeline = create_default_pipeline(context, options) pipeline = create_default_pipeline(context, options, result)
context.setup_errors(options) context.setup_errors(options)
errors_occurred, result = context.run_pipeline(pipeline, source) errors_occurred, enddata = context.run_pipeline(pipeline, source)
context.teardown_errors(errors_occurred, options, result) context.teardown_errors(errors_occurred, options, result)
return result return result
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment