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:
parent
c280fe816c
commit
83f1856d6a
|
@ -303,6 +303,10 @@ class _CodegenState {
|
|||
rhs = '$context.${r.name}';
|
||||
break;
|
||||
|
||||
case RECORD_TYPE_SAFE_PROPERTY:
|
||||
rhs = '${_UTIL}.isValueBlank(${context}) ? null : ${context}.${r.name}';
|
||||
break;
|
||||
|
||||
case RECORD_TYPE_LOCAL:
|
||||
rhs = '$_LOCALS_ACCESSOR.get("${r.name}")';
|
||||
break;
|
||||
|
@ -311,6 +315,11 @@ class _CodegenState {
|
|||
rhs = '$context.${r.name}($argString)';
|
||||
break;
|
||||
|
||||
case RECORD_TYPE_SAFE_INVOKE_METHOD:
|
||||
rhs = '${_UTIL}.isValueBlank(${context}) '
|
||||
'? null : ${context}.${r.name}(${argString})';
|
||||
break;
|
||||
|
||||
case RECORD_TYPE_INVOKE_CLOSURE:
|
||||
rhs = '$context($argString)';
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue