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}';
|
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;
|
||||||
|
|
Loading…
Reference in New Issue