Skip to content

Commit

Permalink
Merge pull request #64 from Sei-Lisa/sei-fix-const-vec-rot-elems
Browse files Browse the repository at this point in the history
Give error when trying to extract a member of a constant vector/rot
  • Loading branch information
Makopo authored Dec 3, 2017
2 parents cee1a50 + fc15513 commit cf881f4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lslmini.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ void LLASTNode::define_symbol(LLScriptSymbol *symbol) {
if ( parent ) {
shadow = parent->lookup_symbol(symbol->get_name(), SYM_ANY);

if ( shadow!= NULL ) {
if ( shadow != NULL ) {
if (shadow->get_sub_type() == SYM_BUILTIN) {

// Events and constants are reserved; functions aren't.
Expand Down Expand Up @@ -256,7 +256,7 @@ void LLScriptGlobalVariable::define_symbols() {
identifier->set_symbol( new LLScriptSymbol(identifier->get_name(), identifier->get_type(), SYM_VARIABLE, SYM_GLOBAL, identifier->get_lloc()));
define_symbol(identifier->get_symbol());

// if it's initialized, set it's constant value
// if it's initialized, set its constant value
if ( get_child(1)->get_node_type() == NODE_SIMPLE_ASSIGNABLE )
identifier->get_symbol()->set_constant_value( get_child(1)->get_child(0)->get_constant_value() );
}
Expand Down Expand Up @@ -638,6 +638,9 @@ void LLScriptFunctionExpression::determine_type() {
void LLScriptLValueExpression::determine_type() {
LLScriptIdentifier *id = (LLScriptIdentifier *) get_child(0);
id->resolve_symbol( SYM_VARIABLE );
if ( id->get_symbol() != NULL && id->get_symbol()->get_sub_type() == SYM_BUILTIN && id->get_member() != NULL ) {
ERROR( HERE, E_INVALID_MEMBER, id->get_name(), id->get_member() );
}
type = id->get_type();
}

Expand Down
12 changes: 12 additions & 0 deletions scripts/bugs/0063.lsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
default{timer(){

vector v;
ZERO_VECTOR.x; // $[E10008] Invalid member ZERO_VECTOR.x
ZERO_ROTATION.s; // $[E10008]
TOUCH_INVALID_TEXCOORD.z; // $[E10008]
<1,0,0>.x; // $[E10019] syntax error, unexpected PERIOD
llGetPos().z; // $[E10019]
v.s; // $[E10008]
v.y; // works

}}

0 comments on commit cf881f4

Please sign in to comment.