Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart

Issue 2862043002: Infer AsExpression types. (Closed)
Patch Set: Fixes for review comments. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart ('k') | pkg/front_end/test/fasta/strong.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
index 182b654675acfd59052ba63c887e1564608f5eb4..5c9d6ee8ed9ff30c801009ae389e8a7052793ab0 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
@@ -82,6 +82,16 @@ abstract class TypeInferrerImpl<S, E, V, F> extends TypeInferrer<S, E, V, F> {
/// initializer.
E getFieldInitializer(F field);
+ /// Performs the core type inference algorithm for type cast expressions.
+ ///
+ /// [typeContext], [typeNeeded], and the return value behave as described in
+ /// [inferExpression].
+ DartType inferAsExpression(
+ DartType typeContext, bool typeNeeded, E operand, DartType type) {
+ inferExpression(operand, null, false);
+ return typeNeeded ? type : null;
+ }
+
/// Performs the core type inference algorithm for boolean literals.
///
/// [typeContext], [typeNeeded], and the return value behave as described in
@@ -249,14 +259,6 @@ abstract class TypeInferrerImpl<S, E, V, F> extends TypeInferrer<S, E, V, F> {
return typeNeeded ? getterType : null;
}
- /// Performs the core type inference algorithm for string literals.
- ///
- /// [typeContext], [typeNeeded], and the return value behave as described in
- /// [inferExpression].
- DartType inferStringLiteral(DartType typeContext, bool typeNeeded) {
- return typeNeeded ? coreTypes.stringClass.rawType : null;
- }
-
/// Performs the core type inference algorithm for string concatenations.
///
/// [typeContext], [typeNeeded], and the return value behave as described in
@@ -269,6 +271,14 @@ abstract class TypeInferrerImpl<S, E, V, F> extends TypeInferrer<S, E, V, F> {
return typeNeeded ? coreTypes.stringClass.rawType : null;
}
+ /// Performs the core type inference algorithm for string literals.
+ ///
+ /// [typeContext], [typeNeeded], and the return value behave as described in
+ /// [inferExpression].
+ DartType inferStringLiteral(DartType typeContext, bool typeNeeded) {
+ return typeNeeded ? coreTypes.stringClass.rawType : null;
+ }
+
/// Performs the core type inference algorithm for variable declarations.
///
/// [declaredType] is the declared type of the variable, or `null` if the type
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart ('k') | pkg/front_end/test/fasta/strong.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698