~eda-qa/leaflang/cpp

« back to all changes in this revision

Viewing changes to src/test/type_converter_common.hpp

  • Committer: edA-qa mort-ora-y
  • Date: 2017-06-03 05:03:54 UTC
  • mfrom: (98.1.18 typefixes)
  • Revision ID: eda-qa@disemia.com-20170603050354-6hfg5huvq56zjs66
merging typefixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
        typer the_typer;
25
25
        context the_context;
26
26
        type_converter tcvt;
27
 
        type_identifier tid;
28
27
        
29
28
        type_converter_tester() : 
30
29
                sc( scope::create(scope_style_t::declarative) ),
31
30
                the_typer( sc ),
32
31
                the_context( &the_typer, sc ),
33
 
                tcvt( the_context ), 
34
 
                tid( the_context ) { 
 
32
                tcvt( the_context ) { 
35
33
        }
36
34
        type_converter_tester( shared_ptr<scope> sc ) :
37
35
                sc( sc ),
38
36
                the_typer( sc ),
39
37
                the_context( &the_typer, sc ),
40
 
                tcvt( the_context ),
41
 
                tid( the_context ) {
 
38
                tcvt( the_context ) {
42
39
        }
43
40
        
44
41
        shared_ptr<type_spec> parse_spec( char const * code) {
49
46
 
50
47
        type_ref determine_type( char const * code, unsigned flags = 0 ) {
51
48
                auto vts = parse_spec( code );
52
 
                auto vt = tid.determine( vts, flags );
 
49
                auto vt = type_identifier::determine( the_context, vts, flags );
53
50
                STATE_CHECK(vt.okay(),vt.explain_error());
54
51
                DEBUG( code, dump::get(vts), dump::get(vt.result) );
55
52
                return vt.result;
57
54
        
58
55
        shared_ptr<intr_type_value_list const> parse_value_list( char const * code ) {
59
56
                auto vts = parse_spec( code );
60
 
                auto vt = tid.determine( vts );
 
57
                auto vt = type_identifier::determine( the_context, vts );
61
58
                STATE_CHECK(vt.okay(),vt.explain_error());
62
59
                auto vl = std::dynamic_pointer_cast<intr_type_value_list const>(vt.result.extr().intr);
63
60
                STATE_CHECK(vl);
97
94
        
98
95
        struct add_class_return {
99
96
                shared_ptr<scope> context;
100
 
                shared_ptr<intr_type_class> type;
 
97
                shared_ptr<intr_type_classlike> type;
101
98
        };
102
99
        add_class_return add_class( std::string const & name ) {
103
100
                auto ctx = make_shared<intr_type_class>();
123
120
        void add_type_alias( std::string name, char const * code ) {
124
121
                auto s = source::create( code, std::strlen(code) );
125
122
                auto spec = node_converter::convert(intr_type_parser::parse( *s ));
126
 
                auto err = tid.expand( *spec );
 
123
                auto err = type_identifier::expand( the_context, *spec );
127
124
                PRE_CHECK( err.okay(), err.explain_error() );
128
125
                sc->add_type_alias( name, spec );
129
126
        }