Skip to content

Commit 6b15b82

Browse files
author
Nicholas Reed
committed
Warn about indexing binary types instead of failing. Allows fedex_plus to produce output for ap221 and ap235 express schemas. SCL git 4cd7e7c.
1 parent 173de43 commit 6b15b82

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

include/express/express.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ extern SCL_EXPRESS_EXPORT Error ERROR_syntax;
108108
extern SCL_EXPRESS_EXPORT Error ERROR_unlabelled_param_type;
109109
extern SCL_EXPRESS_EXPORT Error ERROR_file_unreadable;
110110
extern SCL_EXPRESS_EXPORT Error ERROR_file_unwriteable;
111+
extern SCL_EXPRESS_EXPORT Error ERROR_warn_unsupported_lang_feat;
111112

112113
extern SCL_EXPRESS_EXPORT struct Scope_ * FUNC_NVL;
113114
extern SCL_EXPRESS_EXPORT struct Scope_ * FUNC_USEDIN;

src/express/expr.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,6 @@ Type EXPresolve_op_logical( Expression e, Scope s ) {
651651
EXPresolve_op_default( e, s );
652652
return( Type_Logical );
653653
}
654-
655654
Type EXPresolve_op_array_like( Expression e, Scope s ) {
656655

657656
Type op1type;
@@ -664,6 +663,9 @@ Type EXPresolve_op_array_like( Expression e, Scope s ) {
664663
return( op1type );
665664
} else if( op1type == Type_Runtime ) {
666665
return( Type_Runtime );
666+
} else if( op1type->u.type->body->type == binary_ ) {
667+
ERRORreport_with_symbol( ERROR_warn_unsupported_lang_feat, &e->symbol, "indexing on a BINARY",__FILE__, __LINE__ );
668+
return( Type_Binary );
667669
} else if( op1type->u.type->body->type == generic_ ) {
668670
return( Type_Generic );
669671
} else if( TYPEis_select( op1type ) ) {

src/express/express.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ Error ERROR_syntax = ERROR_none;
107107
Error ERROR_unlabelled_param_type = ERROR_none;
108108
Error ERROR_file_unreadable;
109109
Error ERROR_file_unwriteable;
110+
Error ERROR_warn_unsupported_lang_feat;
110111

111112
struct Scope_ * FUNC_NVL;
112113
struct Scope_ * FUNC_USEDIN;
@@ -469,13 +470,14 @@ void EXPRESSinitialize( void ) {
469470
"Schema %s was not found in its own schema file (%s)", SEVERITY_ERROR );
470471
ERROR_unlabelled_param_type = ERRORcreate(
471472
"Return type or local variable requires type label in `%s'", SEVERITY_ERROR );
472-
ERROR_file_unreadable = ERRORcreate(
473-
"Could not read file %s: %s", SEVERITY_ERROR );
474-
ERROR_file_unwriteable = ERRORcreate(
475-
"Could not write file %s: %s", SEVERITY_ERROR );
473+
ERROR_file_unreadable = ERRORcreate( "Could not read file %s: %s", SEVERITY_ERROR );
474+
ERROR_file_unwriteable = ERRORcreate( "Could not write file %s: %s", SEVERITY_ERROR );
475+
ERROR_warn_unsupported_lang_feat = ERRORcreate("Unsupported language feature (%s) at %s:%d",SEVERITY_WARNING);
476+
476477
OBJcreate( OBJ_EXPRESS, EXPRESS_get_symbol, "express file", OBJ_UNUSED_BITS );
477478

478479
ERRORcreate_warning( "unknown_subtype", ERROR_unknown_subtype );
480+
ERRORcreate_warning( "unsupported", ERROR_warn_unsupported_lang_feat );
479481

480482
EXPRESS_PATHinit(); /* note, must follow defn of errors it needs! */
481483
}

0 commit comments

Comments
 (0)