Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give error when trying to extract a member of a constant vector/rot #64

Merged
merged 1 commit into from
Dec 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

}}