feat(dart/transform): Add support for the safe navigation operator

Adds support for ?. to pregenerated Dart Change Detectors.

Closes #791
This commit is contained in:
Tim Blasi 2015-06-02 18:07:44 -07:00
parent c280fe816c
commit 83f1856d6a
1 changed files with 9 additions and 0 deletions

View File

@ -303,6 +303,10 @@ class _CodegenState {
rhs = '$context.${r.name}'; rhs = '$context.${r.name}';
break; break;
case RECORD_TYPE_SAFE_PROPERTY:
rhs = '${_UTIL}.isValueBlank(${context}) ? null : ${context}.${r.name}';
break;
case RECORD_TYPE_LOCAL: case RECORD_TYPE_LOCAL:
rhs = '$_LOCALS_ACCESSOR.get("${r.name}")'; rhs = '$_LOCALS_ACCESSOR.get("${r.name}")';
break; break;
@ -311,6 +315,11 @@ class _CodegenState {
rhs = '$context.${r.name}($argString)'; rhs = '$context.${r.name}($argString)';
break; break;
case RECORD_TYPE_SAFE_INVOKE_METHOD:
rhs = '${_UTIL}.isValueBlank(${context}) '
'? null : ${context}.${r.name}(${argString})';
break;
case RECORD_TYPE_INVOKE_CLOSURE: case RECORD_TYPE_INVOKE_CLOSURE:
rhs = '$context($argString)'; rhs = '$context($argString)';
break; break;