parent
25dcc7631f
commit
9ba5344f3e
@ -593,7 +593,7 @@ class _AstToIrVisitor implements cdAst.AstVisitor {
|
|||||||
// an expression that guards the access to the member by checking the receiver for blank. As
|
// an expression that guards the access to the member by checking the receiver for blank. As
|
||||||
// execution proceeds from left to right, the left most part of the expression must be guarded
|
// execution proceeds from left to right, the left most part of the expression must be guarded
|
||||||
// first but, because member access is left associative, the right side of the expression is at
|
// first but, because member access is left associative, the right side of the expression is at
|
||||||
// the top of the AST. The desired result requires lifting a copy of the the left part of the
|
// the top of the AST. The desired result requires lifting a copy of the left part of the
|
||||||
// expression up to test it for blank before generating the unguarded version.
|
// expression up to test it for blank before generating the unguarded version.
|
||||||
|
|
||||||
// Consider, for example the following expression: a?.b.c?.d.e
|
// Consider, for example the following expression: a?.b.c?.d.e
|
||||||
@ -673,10 +673,10 @@ class _AstToIrVisitor implements cdAst.AstVisitor {
|
|||||||
return convertToStatementIfNeeded(mode, condition.conditional(o.literal(null), access));
|
return convertToStatementIfNeeded(mode, condition.conditional(o.literal(null), access));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Given a expression of the form a?.b.c?.d.e the the left most safe node is
|
// Given an expression of the form a?.b.c?.d.e then the left most safe node is
|
||||||
// the (a?.b). The . and ?. are left associative thus can be rewritten as:
|
// the (a?.b). The . and ?. are left associative thus can be rewritten as:
|
||||||
// ((((a?.c).b).c)?.d).e. This returns the most deeply nested safe read or
|
// ((((a?.c).b).c)?.d).e. This returns the most deeply nested safe read or
|
||||||
// safe method call as this needs be transform initially to:
|
// safe method call as this needs to be transformed initially to:
|
||||||
// a == null ? null : a.c.b.c?.d.e
|
// a == null ? null : a.c.b.c?.d.e
|
||||||
// then to:
|
// then to:
|
||||||
// a == null ? null : a.b.c == null ? null : a.b.c.d.e
|
// a == null ? null : a.b.c == null ? null : a.b.c.d.e
|
||||||
@ -768,7 +768,7 @@ class _AstToIrVisitor implements cdAst.AstVisitor {
|
|||||||
* show where the span is within the overall source file.
|
* show where the span is within the overall source file.
|
||||||
*
|
*
|
||||||
* @param span the relative span to convert.
|
* @param span the relative span to convert.
|
||||||
* @returns a `ParseSourceSpan` for the the given span or null if no
|
* @returns a `ParseSourceSpan` for the given span or null if no
|
||||||
* `baseSourceSpan` was provided to this class.
|
* `baseSourceSpan` was provided to this class.
|
||||||
*/
|
*/
|
||||||
private convertSourceSpan(span: cdAst.ParseSpan) {
|
private convertSourceSpan(span: cdAst.ParseSpan) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user