[cfe] Move inference visitor to its own library and rename kernel_shadow_ast to internal_ast
Change-Id: I2a30efc08568380017230dd2af16329488687e9a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126041 Reviewed-by: Dmitry Stefantsov <dmitryas@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
committed by
commit-bot@chromium.org
parent
f2b7af83e7
commit
ecaa3e643a
@@ -29,7 +29,7 @@ import '../source/source_loader.dart' show SourceLoader;
|
||||
|
||||
import '../kernel/body_builder.dart' show BodyBuilder;
|
||||
|
||||
import '../kernel/kernel_shadow_ast.dart' show VariableDeclarationImpl;
|
||||
import '../kernel/internal_ast.dart' show VariableDeclarationImpl;
|
||||
|
||||
import 'builder.dart';
|
||||
import 'class_builder.dart';
|
||||
|
||||
@@ -15,7 +15,7 @@ import '../identifiers.dart';
|
||||
import '../scope.dart';
|
||||
|
||||
import '../kernel/class_hierarchy_builder.dart' show ClassMember;
|
||||
import '../kernel/kernel_shadow_ast.dart' show VariableDeclarationImpl;
|
||||
import '../kernel/internal_ast.dart' show VariableDeclarationImpl;
|
||||
import '../kernel/redirecting_factory_body.dart' show RedirectingFactoryBody;
|
||||
|
||||
import '../loader.dart' show Loader;
|
||||
|
||||
@@ -84,7 +84,7 @@ import 'hybrid_file_system.dart' show HybridFileSystem;
|
||||
|
||||
import 'kernel/kernel_builder.dart' show ClassHierarchyBuilder;
|
||||
|
||||
import 'kernel/kernel_shadow_ast.dart' show VariableDeclarationImpl;
|
||||
import 'kernel/internal_ast.dart' show VariableDeclarationImpl;
|
||||
|
||||
import 'kernel/kernel_target.dart' show KernelTarget;
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ import 'kernel_api.dart';
|
||||
|
||||
import 'kernel_ast_api.dart';
|
||||
|
||||
import 'kernel_shadow_ast.dart';
|
||||
import 'internal_ast.dart';
|
||||
|
||||
import 'kernel_builder.dart';
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ import 'kernel_ast_api.dart'
|
||||
|
||||
import 'kernel_builder.dart' show LoadLibraryBuilder;
|
||||
|
||||
import 'kernel_shadow_ast.dart';
|
||||
import 'internal_ast.dart';
|
||||
|
||||
/// A generator represents a subexpression for which we can't yet build an
|
||||
/// expression because we don't yet know the context in which it's used.
|
||||
|
||||
@@ -22,7 +22,7 @@ import 'collections.dart'
|
||||
IfMapEntry,
|
||||
SpreadElement;
|
||||
|
||||
import 'kernel_shadow_ast.dart';
|
||||
import 'internal_ast.dart';
|
||||
|
||||
/// A shadow tree factory.
|
||||
class Forest {
|
||||
|
||||
@@ -2,7 +2,73 @@
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
part of "kernel_shadow_ast.dart";
|
||||
import 'dart:core' hide MapEntry;
|
||||
|
||||
import 'package:kernel/ast.dart';
|
||||
|
||||
import 'package:kernel/type_algebra.dart' show Substitution;
|
||||
|
||||
import 'package:kernel/type_environment.dart';
|
||||
|
||||
import '../../base/instrumentation.dart'
|
||||
show
|
||||
InstrumentationValueForMember,
|
||||
InstrumentationValueForType,
|
||||
InstrumentationValueForTypeArgs;
|
||||
|
||||
import '../builder/library_builder.dart';
|
||||
|
||||
import '../fasta_codes.dart'
|
||||
show
|
||||
messageCantDisambiguateAmbiguousInformation,
|
||||
messageCantDisambiguateNotEnoughInformation,
|
||||
messageNonNullAwareSpreadIsNull,
|
||||
messageSwitchExpressionNotAssignableCause,
|
||||
noLength,
|
||||
templateCantInferTypeDueToCircularity,
|
||||
templateForInLoopElementTypeNotAssignable,
|
||||
templateForInLoopTypeNotIterable,
|
||||
templateIntegerLiteralIsOutOfRange,
|
||||
templateSpreadElementTypeMismatch,
|
||||
templateSpreadMapEntryElementKeyTypeMismatch,
|
||||
templateSpreadMapEntryElementValueTypeMismatch,
|
||||
templateSpreadMapEntryTypeMismatch,
|
||||
templateSpreadTypeMismatch,
|
||||
templateSwitchExpressionNotAssignable,
|
||||
templateUndefinedSetter;
|
||||
|
||||
import '../names.dart';
|
||||
|
||||
import '../problems.dart' show unhandled;
|
||||
|
||||
import '../source/source_library_builder.dart' show SourceLibraryBuilder;
|
||||
|
||||
import '../type_inference/type_inference_engine.dart';
|
||||
import '../type_inference/type_inferrer.dart';
|
||||
|
||||
import '../type_inference/type_schema.dart' show UnknownType;
|
||||
|
||||
import '../type_inference/type_schema_elimination.dart' show greatestClosure;
|
||||
|
||||
import 'body_builder.dart' show combineStatements;
|
||||
|
||||
import 'collections.dart'
|
||||
show
|
||||
ForElement,
|
||||
ForInElement,
|
||||
ForInMapEntry,
|
||||
ForMapEntry,
|
||||
IfElement,
|
||||
IfMapEntry,
|
||||
SpreadElement,
|
||||
SpreadMapEntry,
|
||||
convertToElement;
|
||||
|
||||
import 'implicit_type_argument.dart' show ImplicitTypeArgument;
|
||||
|
||||
import 'internal_ast.dart';
|
||||
|
||||
import 'late_lowering.dart' as late_lowering;
|
||||
|
||||
class InferenceVisitor
|
||||
implements
|
||||
@@ -701,7 +767,7 @@ class InferenceVisitor
|
||||
DartType elementType;
|
||||
bool typeNeeded = false;
|
||||
bool typeChecksNeeded = !inferrer.isTopLevel;
|
||||
if (VariableDeclarationImpl.isImplicitlyTyped(variable)) {
|
||||
if (variable is VariableDeclarationImpl && variable.isImplicitlyTyped) {
|
||||
typeNeeded = true;
|
||||
elementType = const UnknownType();
|
||||
} else {
|
||||
@@ -1047,7 +1113,7 @@ class InferenceVisitor
|
||||
inferrer.inferMetadataKeepingHelper(
|
||||
node.variable, node.variable.annotations);
|
||||
DartType returnContext =
|
||||
node._hasImplicitReturnType ? null : node.function.returnType;
|
||||
node.hasImplicitReturnType ? null : node.function.returnType;
|
||||
DartType inferredType =
|
||||
visitFunctionNode(node.function, null, returnContext, node.fileOffset);
|
||||
node.variable.type = inferredType;
|
||||
@@ -4958,12 +5024,12 @@ class InferenceVisitor
|
||||
StatementInferenceResult visitVariableDeclaration(
|
||||
covariant VariableDeclarationImpl node) {
|
||||
DartType declaredType =
|
||||
node.implicitlyTyped ? const UnknownType() : node.type;
|
||||
node.isImplicitlyTyped ? const UnknownType() : node.type;
|
||||
DartType inferredType;
|
||||
ExpressionInferenceResult initializerResult;
|
||||
if (node.initializer != null) {
|
||||
initializerResult = inferrer.inferExpression(node.initializer,
|
||||
declaredType, !inferrer.isTopLevel || node.implicitlyTyped,
|
||||
declaredType, !inferrer.isTopLevel || node.isImplicitlyTyped,
|
||||
isVoidAllowed: true);
|
||||
inferredType =
|
||||
inferrer.inferDeclarationType(initializerResult.inferredType);
|
||||
@@ -4971,7 +5037,7 @@ class InferenceVisitor
|
||||
} else {
|
||||
inferredType = const DynamicType();
|
||||
}
|
||||
if (node.implicitlyTyped) {
|
||||
if (node.isImplicitlyTyped) {
|
||||
inferrer.instrumentation?.record(
|
||||
inferrer.uriForInstrumentation,
|
||||
node.fileOffset,
|
||||
@@ -4987,7 +5053,7 @@ class InferenceVisitor
|
||||
}
|
||||
if (!inferrer.isTopLevel) {
|
||||
SourceLibraryBuilder library = inferrer.library;
|
||||
if (node.implicitlyTyped) {
|
||||
if (node.isImplicitlyTyped) {
|
||||
library.checkBoundsInVariableDeclaration(
|
||||
node, inferrer.typeSchemaEnvironment, inferrer.helper.uri,
|
||||
inferred: true);
|
||||
@@ -5095,9 +5161,9 @@ class InferenceVisitor
|
||||
if (inferrer.isNonNullableByDefault) {
|
||||
promotedType = inferrer.flowAnalysis.variableRead(node, variable);
|
||||
} else {
|
||||
bool mutatedInClosure = variable._mutatedInClosure;
|
||||
bool mutatedInClosure = variable.mutatedInClosure;
|
||||
promotedType = inferrer.typePromoter
|
||||
.computePromotedType(node._fact, node._scope, mutatedInClosure);
|
||||
.computePromotedType(node.fact, node.scope, mutatedInClosure);
|
||||
}
|
||||
if (promotedType != null) {
|
||||
inferrer.instrumentation?.record(
|
||||
@@ -5108,7 +5174,7 @@ class InferenceVisitor
|
||||
}
|
||||
node.promotedType = promotedType;
|
||||
DartType type = promotedType ?? declaredOrInferredType;
|
||||
if (variable._isLocalFunction) {
|
||||
if (variable.isLocalFunction) {
|
||||
return inferrer.instantiateTearOff(type, typeContext, node);
|
||||
} else if (variable.lateGetter != null) {
|
||||
return new ExpressionInferenceResult(
|
||||
|
||||
+37
-94
@@ -22,48 +22,17 @@ import 'dart:core' hide MapEntry;
|
||||
|
||||
import 'package:kernel/ast.dart';
|
||||
|
||||
import 'package:kernel/type_algebra.dart' show Substitution;
|
||||
|
||||
import 'package:kernel/type_environment.dart';
|
||||
|
||||
import 'package:kernel/core_types.dart';
|
||||
|
||||
import '../../base/instrumentation.dart'
|
||||
show
|
||||
InstrumentationValueForMember,
|
||||
InstrumentationValueForType,
|
||||
InstrumentationValueForTypeArgs;
|
||||
|
||||
import '../builder/library_builder.dart';
|
||||
|
||||
import '../fasta_codes.dart'
|
||||
show
|
||||
messageCantDisambiguateAmbiguousInformation,
|
||||
messageCantDisambiguateNotEnoughInformation,
|
||||
messageNonNullAwareSpreadIsNull,
|
||||
messageSwitchExpressionNotAssignableCause,
|
||||
noLength,
|
||||
templateCantInferTypeDueToCircularity,
|
||||
templateForInLoopElementTypeNotAssignable,
|
||||
templateForInLoopTypeNotIterable,
|
||||
templateIntegerLiteralIsOutOfRange,
|
||||
templateSpreadElementTypeMismatch,
|
||||
templateSpreadMapEntryElementKeyTypeMismatch,
|
||||
templateSpreadMapEntryElementValueTypeMismatch,
|
||||
templateSpreadMapEntryTypeMismatch,
|
||||
templateSpreadTypeMismatch,
|
||||
templateSwitchExpressionNotAssignable,
|
||||
templateUndefinedSetter,
|
||||
templateWebLiteralCannotBeRepresentedExactly;
|
||||
show noLength, templateWebLiteralCannotBeRepresentedExactly;
|
||||
|
||||
import '../names.dart';
|
||||
|
||||
import '../problems.dart' show unhandled, unsupported;
|
||||
import '../problems.dart' show unsupported;
|
||||
|
||||
import '../source/source_class_builder.dart' show SourceClassBuilder;
|
||||
|
||||
import '../source/source_library_builder.dart' show SourceLibraryBuilder;
|
||||
|
||||
import '../type_inference/type_inference_engine.dart';
|
||||
import '../type_inference/type_inferrer.dart';
|
||||
|
||||
@@ -72,30 +41,10 @@ import '../type_inference/type_promotion.dart'
|
||||
|
||||
import '../type_inference/type_schema.dart' show UnknownType;
|
||||
|
||||
import '../type_inference/type_schema_elimination.dart' show greatestClosure;
|
||||
|
||||
import '../type_inference/type_schema_environment.dart'
|
||||
show TypeSchemaEnvironment;
|
||||
|
||||
import 'body_builder.dart' show combineStatements;
|
||||
|
||||
import 'collections.dart'
|
||||
show
|
||||
ForElement,
|
||||
ForInElement,
|
||||
ForInMapEntry,
|
||||
ForMapEntry,
|
||||
IfElement,
|
||||
IfMapEntry,
|
||||
SpreadElement,
|
||||
SpreadMapEntry,
|
||||
convertToElement;
|
||||
|
||||
import 'implicit_type_argument.dart' show ImplicitTypeArgument;
|
||||
|
||||
import 'late_lowering.dart' as late_lowering;
|
||||
|
||||
part "inference_visitor.dart";
|
||||
import 'inference_visitor.dart';
|
||||
|
||||
/// Computes the return type of a (possibly factory) constructor.
|
||||
InterfaceType computeConstructorReturnType(
|
||||
@@ -497,7 +446,7 @@ class FactoryConstructorInvocationJudgment extends StaticInvocation
|
||||
|
||||
/// Front end specific implementation of [FunctionDeclaration].
|
||||
class FunctionDeclarationImpl extends FunctionDeclaration {
|
||||
bool _hasImplicitReturnType = false;
|
||||
bool hasImplicitReturnType = false;
|
||||
|
||||
FunctionDeclarationImpl(
|
||||
VariableDeclarationImpl variable, FunctionNode function)
|
||||
@@ -505,7 +454,7 @@ class FunctionDeclarationImpl extends FunctionDeclaration {
|
||||
|
||||
static void setHasImplicitReturnType(
|
||||
FunctionDeclarationImpl declaration, bool hasImplicitReturnType) {
|
||||
declaration._hasImplicitReturnType = hasImplicitReturnType;
|
||||
declaration.hasImplicitReturnType = hasImplicitReturnType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -864,7 +813,7 @@ class ShadowTypePromoter extends TypePromoterImpl {
|
||||
@override
|
||||
int getVariableFunctionNestingLevel(VariableDeclaration variable) {
|
||||
if (variable is VariableDeclarationImpl) {
|
||||
return variable._functionNestingLevel;
|
||||
return variable.functionNestingLevel;
|
||||
} else {
|
||||
// Hack to deal with the fact that BodyBuilder still creates raw
|
||||
// VariableDeclaration objects sometimes.
|
||||
@@ -878,7 +827,7 @@ class ShadowTypePromoter extends TypePromoterImpl {
|
||||
bool isPromotionCandidate(VariableDeclaration variable) {
|
||||
assert(variable is VariableDeclarationImpl);
|
||||
VariableDeclarationImpl kernelVariableDeclaration = variable;
|
||||
return !kernelVariableDeclaration._isLocalFunction;
|
||||
return !kernelVariableDeclaration.isLocalFunction;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -889,7 +838,7 @@ class ShadowTypePromoter extends TypePromoterImpl {
|
||||
@override
|
||||
void setVariableMutatedAnywhere(VariableDeclaration variable) {
|
||||
if (variable is VariableDeclarationImpl) {
|
||||
variable._mutatedAnywhere = true;
|
||||
variable.mutatedAnywhere = true;
|
||||
} else {
|
||||
// Hack to deal with the fact that BodyBuilder still creates raw
|
||||
// VariableDeclaration objects sometimes.
|
||||
@@ -901,7 +850,7 @@ class ShadowTypePromoter extends TypePromoterImpl {
|
||||
@override
|
||||
void setVariableMutatedInClosure(VariableDeclaration variable) {
|
||||
if (variable is VariableDeclarationImpl) {
|
||||
variable._mutatedInClosure = true;
|
||||
variable.mutatedInClosure = true;
|
||||
} else {
|
||||
// Hack to deal with the fact that BodyBuilder still creates raw
|
||||
// VariableDeclaration objects sometimes.
|
||||
@@ -913,7 +862,7 @@ class ShadowTypePromoter extends TypePromoterImpl {
|
||||
@override
|
||||
bool wasVariableMutatedAnywhere(VariableDeclaration variable) {
|
||||
if (variable is VariableDeclarationImpl) {
|
||||
return variable._mutatedAnywhere;
|
||||
return variable.mutatedAnywhere;
|
||||
} else {
|
||||
// Hack to deal with the fact that BodyBuilder still creates raw
|
||||
// VariableDeclaration objects sometimes.
|
||||
@@ -928,25 +877,35 @@ class ShadowTypePromoter extends TypePromoterImpl {
|
||||
class VariableDeclarationImpl extends VariableDeclaration {
|
||||
final bool forSyntheticToken;
|
||||
|
||||
final bool implicitlyTyped;
|
||||
/// Determine whether the given [VariableDeclarationImpl] had an implicit
|
||||
/// type.
|
||||
///
|
||||
/// This is static to avoid introducing a method that would be visible to
|
||||
/// the kernel.
|
||||
final bool isImplicitlyTyped;
|
||||
|
||||
// TODO(ahe): Remove this field. We can get rid of it by recording closure
|
||||
// mutation in [BodyBuilder].
|
||||
final int _functionNestingLevel;
|
||||
final int functionNestingLevel;
|
||||
|
||||
// TODO(ahe): Remove this field. It's only used locally when compiling a
|
||||
// method, and this can thus be tracked in a [Set] (actually, tracking this
|
||||
// information in a [List] is probably even faster as the average size will
|
||||
// be close to zero).
|
||||
bool _mutatedInClosure = false;
|
||||
bool mutatedInClosure = false;
|
||||
|
||||
// TODO(ahe): Investigate if this can be removed.
|
||||
bool _mutatedAnywhere = false;
|
||||
bool mutatedAnywhere = false;
|
||||
|
||||
/// Determines whether the given [VariableDeclarationImpl] represents a
|
||||
/// local function.
|
||||
///
|
||||
/// This is static to avoid introducing a method that would be visible to the
|
||||
/// kernel.
|
||||
// TODO(ahe): Investigate if this can be removed.
|
||||
final bool _isLocalFunction;
|
||||
final bool isLocalFunction;
|
||||
|
||||
VariableDeclarationImpl(String name, this._functionNestingLevel,
|
||||
VariableDeclarationImpl(String name, this.functionNestingLevel,
|
||||
{this.forSyntheticToken: false,
|
||||
Expression initializer,
|
||||
DartType type,
|
||||
@@ -957,8 +916,8 @@ class VariableDeclarationImpl extends VariableDeclaration {
|
||||
bool isLocalFunction: false,
|
||||
bool isLate: false,
|
||||
bool isRequired: false})
|
||||
: implicitlyTyped = type == null,
|
||||
_isLocalFunction = isLocalFunction,
|
||||
: isImplicitlyTyped = type == null,
|
||||
isLocalFunction = isLocalFunction,
|
||||
super(name,
|
||||
initializer: initializer,
|
||||
type: type ?? const DynamicType(),
|
||||
@@ -971,45 +930,29 @@ class VariableDeclarationImpl extends VariableDeclaration {
|
||||
|
||||
VariableDeclarationImpl.forEffect(Expression initializer)
|
||||
: forSyntheticToken = false,
|
||||
_functionNestingLevel = 0,
|
||||
implicitlyTyped = false,
|
||||
_isLocalFunction = false,
|
||||
functionNestingLevel = 0,
|
||||
isImplicitlyTyped = false,
|
||||
isLocalFunction = false,
|
||||
super.forValue(initializer);
|
||||
|
||||
VariableDeclarationImpl.forValue(Expression initializer)
|
||||
: forSyntheticToken = false,
|
||||
_functionNestingLevel = 0,
|
||||
implicitlyTyped = true,
|
||||
_isLocalFunction = false,
|
||||
functionNestingLevel = 0,
|
||||
isImplicitlyTyped = true,
|
||||
isLocalFunction = false,
|
||||
super.forValue(initializer);
|
||||
|
||||
VariableDeclaration lateGetter;
|
||||
VariableDeclaration lateSetter;
|
||||
|
||||
/// Determine whether the given [VariableDeclarationImpl] had an implicit
|
||||
/// type.
|
||||
///
|
||||
/// This is static to avoid introducing a method that would be visible to
|
||||
/// the kernel.
|
||||
static bool isImplicitlyTyped(VariableDeclarationImpl variable) =>
|
||||
variable.implicitlyTyped;
|
||||
|
||||
/// Determines whether the given [VariableDeclarationImpl] represents a
|
||||
/// local function.
|
||||
///
|
||||
/// This is static to avoid introducing a method that would be visible to the
|
||||
/// kernel.
|
||||
static bool isLocalFunction(VariableDeclarationImpl variable) =>
|
||||
variable._isLocalFunction;
|
||||
}
|
||||
|
||||
/// Front end specific implementation of [VariableGet].
|
||||
class VariableGetImpl extends VariableGet {
|
||||
final TypePromotionFact _fact;
|
||||
final TypePromotionFact fact;
|
||||
|
||||
final TypePromotionScope _scope;
|
||||
final TypePromotionScope scope;
|
||||
|
||||
VariableGetImpl(VariableDeclaration variable, this._fact, this._scope)
|
||||
VariableGetImpl(VariableDeclaration variable, this.fact, this.scope)
|
||||
: super(variable);
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ export 'package:kernel/ast.dart'
|
||||
VoidType,
|
||||
setParents;
|
||||
|
||||
export 'kernel_shadow_ast.dart'
|
||||
export 'internal_ast.dart'
|
||||
show
|
||||
ArgumentsImpl,
|
||||
Cascade,
|
||||
|
||||
@@ -170,7 +170,7 @@ import '../kernel/kernel_builder.dart'
|
||||
compareProcedures,
|
||||
toKernelCombinators;
|
||||
|
||||
import '../kernel/kernel_shadow_ast.dart';
|
||||
import '../kernel/internal_ast.dart';
|
||||
|
||||
import '../kernel/metadata_collector.dart';
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'dart:core' hide MapEntry;
|
||||
|
||||
import 'package:_fe_analyzer_shared/src/flow_analysis/flow_analysis.dart';
|
||||
|
||||
import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart';
|
||||
import 'package:front_end/src/fasta/kernel/internal_ast.dart';
|
||||
import 'package:front_end/src/fasta/type_inference/type_demotion.dart';
|
||||
|
||||
import 'package:kernel/ast.dart';
|
||||
@@ -33,12 +33,14 @@ import '../builder/member_builder.dart';
|
||||
|
||||
import '../fasta_codes.dart';
|
||||
|
||||
import '../kernel/kernel_shadow_ast.dart'
|
||||
import '../kernel/internal_ast.dart'
|
||||
show
|
||||
VariableDeclarationImpl,
|
||||
getExplicitTypeArguments,
|
||||
getExtensionTypeParameterCount;
|
||||
|
||||
import '../kernel/inference_visitor.dart';
|
||||
|
||||
import '../kernel/type_algorithms.dart' show hasAnyTypeVariables;
|
||||
|
||||
import '../names.dart';
|
||||
@@ -1425,7 +1427,7 @@ class TypeInferrerImpl implements TypeInferrer {
|
||||
}
|
||||
|
||||
void inferSyntheticVariable(VariableDeclarationImpl variable) {
|
||||
assert(variable.implicitlyTyped);
|
||||
assert(variable.isImplicitlyTyped);
|
||||
assert(variable.initializer != null);
|
||||
ExpressionInferenceResult result = inferExpression(
|
||||
variable.initializer, const UnknownType(), true,
|
||||
@@ -1969,7 +1971,7 @@ class TypeInferrerImpl implements TypeInferrer {
|
||||
// `Qi[T/S]` with respect to `?`. Otherwise, let `Ri` be `dynamic`.
|
||||
for (int i = 0; i < formals.length; i++) {
|
||||
VariableDeclarationImpl formal = formals[i];
|
||||
if (VariableDeclarationImpl.isImplicitlyTyped(formal)) {
|
||||
if (formal.isImplicitlyTyped) {
|
||||
DartType inferredType;
|
||||
if (formalTypesFromContext[i] == coreTypes.nullType) {
|
||||
inferredType = coreTypes.objectRawType(library.nullable);
|
||||
@@ -2840,8 +2842,7 @@ class TypeInferrerImpl implements TypeInferrer {
|
||||
}
|
||||
if (expression is VariableGet) {
|
||||
VariableDeclaration variable = expression.variable;
|
||||
if (variable is VariableDeclarationImpl &&
|
||||
VariableDeclarationImpl.isLocalFunction(variable)) {
|
||||
if (variable is VariableDeclarationImpl && variable.isLocalFunction) {
|
||||
return templateInvalidCastLocalFunction;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import '../fasta_codes.dart' show templateInternalProblemStackNotEmpty;
|
||||
|
||||
import '../problems.dart' show internalProblem;
|
||||
|
||||
import '../kernel/kernel_shadow_ast.dart' show ShadowTypePromoter;
|
||||
import '../kernel/internal_ast.dart' show ShadowTypePromoter;
|
||||
|
||||
import 'type_schema_environment.dart' show TypeSchemaEnvironment;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user