Skip to content

Commit ffdeac2

Browse files
committed
Merge pull request stepcode#125 from mpictor/review/second-edition-error
Add a warning for unsupported language features, and print it for indexing upon a binary
2 parents 8dcfec4 + 4cd7e7c commit ffdeac2

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

include/express/express.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ GLOBAL SCL_EXPRESS_EXPORT Error ERROR_syntax INITIALLY( ERROR_none );
125125
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_unlabelled_param_type INITIALLY( ERROR_none );
126126
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_file_unreadable;
127127
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_file_unwriteable;
128+
GLOBAL SCL_EXPRESS_EXPORT Error ERROR_warn_unsupported_lang_feat;
128129

129130
GLOBAL SCL_EXPRESS_EXPORT struct Scope_ * FUNC_NVL;
130131
GLOBAL SCL_EXPRESS_EXPORT struct Scope_ * FUNC_USEDIN;

src/express/expr.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22

3-
/************************************************************************
4-
** Module: Expression
3+
/** **********************************************************************
4+
** Module: Expression \file expr.c
55
** Description: This module implements the Expression abstraction. Several
66
** types of expressions are supported: identifiers, literals,
77
** operations (arithmetic, logical, array indexing, etc.), and
@@ -667,6 +667,9 @@ Type EXPresolve_op_array_like( Expression e, Scope s ) {
667667
return( op1type );
668668
} else if( op1type == Type_Runtime ) {
669669
return( Type_Runtime );
670+
} else if( op1type->u.type->body->type == binary_ ) {
671+
ERRORreport_with_symbol( ERROR_warn_unsupported_lang_feat, &e->symbol, "indexing on a BINARY",__FILE__, __LINE__ );
672+
return( Type_Binary );
670673
} else if( op1type->u.type->body->type == generic_ ) {
671674
return( Type_Generic );
672675
} else if( TYPEis_select( op1type ) ) {

src/express/express.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,14 @@ EXPRESSinitialize( void ) {
350350
"Schema %s was not found in its own schema file (%s)", SEVERITY_ERROR );
351351
ERROR_unlabelled_param_type = ERRORcreate(
352352
"Return type or local variable requires type label in `%s'", SEVERITY_ERROR );
353-
ERROR_file_unreadable = ERRORcreate(
354-
"Could not read file %s: %s", SEVERITY_ERROR );
355-
ERROR_file_unwriteable = ERRORcreate(
356-
"Could not write file %s: %s", SEVERITY_ERROR );
353+
ERROR_file_unreadable = ERRORcreate( "Could not read file %s: %s", SEVERITY_ERROR );
354+
ERROR_file_unwriteable = ERRORcreate( "Could not write file %s: %s", SEVERITY_ERROR );
355+
ERROR_warn_unsupported_lang_feat = ERRORcreate("Unsupported language feature (%s) at %s:%d",SEVERITY_WARNING);
356+
357357
OBJcreate( OBJ_EXPRESS, EXPRESS_get_symbol, "express file", OBJ_UNUSED_BITS );
358358

359359
ERRORcreate_warning( "unknown_subtype", ERROR_unknown_subtype );
360+
ERRORcreate_warning( "unsupported", ERROR_warn_unsupported_lang_feat );
360361

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

0 commit comments

Comments
 (0)