mirror of
https://github.com/adelphes/android-dev-ext.git
synced 2025-12-23 01:48:18 +00:00
improve support for ternary operators in assignments and method invocations
This commit is contained in:
@@ -244,7 +244,7 @@ const valid_primitive_types = {
|
||||
/**
|
||||
* Returns true if a value of value_type is assignable to a variable of dest_type
|
||||
* @param {JavaType} dest_type
|
||||
* @param {JavaType|NumberLiteral|LambdaType} value_type
|
||||
* @param {JavaType|NumberLiteral|LambdaType|MultiValueType} value_type
|
||||
*/
|
||||
function isTypeAssignable(dest_type, value_type) {
|
||||
|
||||
@@ -256,6 +256,14 @@ function isTypeAssignable(dest_type, value_type) {
|
||||
return isLambdaAssignable(dest_type, value_type) === true;
|
||||
}
|
||||
|
||||
if (value_type instanceof MultiValueType) {
|
||||
return value_type.types.every(t => {
|
||||
if (t instanceof JavaType || t instanceof NumberLiteral || t instanceof LambdaType || t instanceof MultiValueType)
|
||||
return isTypeAssignable(dest_type, t);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
let is_assignable = false;
|
||||
if (dest_type.typeSignature === value_type.typeSignature) {
|
||||
// exact signature match
|
||||
|
||||
Reference in New Issue
Block a user