P. 1
ECMA-262 JavaScript 5

ECMA-262 JavaScript 5

|Views: 218|Likes:
Publicado porGregoryDonaghy

More info:

Published by: GregoryDonaghy on Mar 12, 2010
Direitos Autorais:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

08/16/2013

pdf

text

original

Syntax

ConditionalExpression :
LogicalORExpression
LogicalORExpression
? AssignmentExpression : AssignmentExpression

ConditionalExpressionNoIn :
LogicalORExpressionNoIn
LogicalORExpressionNoIn
? AssignmentExpression : AssignmentExpressionNoIn

Semantics

The production ConditionalExpression : LogicalORExpression ? AssignmentExpression : AssignmentExpression is
evaluated as follows:

1. Let lref be the result of evaluating LogicalORExpression.
2. If ToBoolean(GetValue(lref)) is true, then
a. Let trueRef be the result of evaluating the first AssignmentExpression.
b. Return GetValue(trueRef).

3. Else

a. Let falseRef be the result of evaluating the second AssignmentExpression.
b. Return GetValue(falseRef).

© Ecma International 2009

83

The ConditionalExpressionNoIn production is evaluated in the same manner as the ConditionalExpression
production except that the contained LogicalORExpressionNoIn, AssignmentExpression and
AssignmentExpressionNoIn are evaluated instead of the contained LogicalORExpression, first
AssignmentExpression and second AssignmentExpression, respectively.

NOTE

The grammar for a ConditionalExpression in ECMAScript is a little bit different from that in C and Java, which
each allow the second subexpression to be an Expression but restrict the third expression to be a ConditionalExpression.
The motivation for this difference in ECMAScript is to allow an assignment expression to be governed by either arm of a
conditional and to eliminate the confusing and fairly useless case of a comma expression as the centre expression.

You're Reading a Free Preview

Descarregar
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->