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

Unified Diff: pkg/analyzer/lib/src/fasta/resolution_applier.dart

Issue 2980053002: Further integration of front end type inference into analyzer. (Closed)
Patch Set: Created 3 years, 5 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 | « no previous file | pkg/analyzer/lib/src/fasta/resolution_storer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/fasta/resolution_applier.dart
diff --git a/pkg/analyzer/lib/src/fasta/resolution_applier.dart b/pkg/analyzer/lib/src/fasta/resolution_applier.dart
index dedddee32efc59e6dd5b08541c65a022e9eed761..a2fe075233fbb7790bd44e6c988e9f57db1aa4ee 100644
--- a/pkg/analyzer/lib/src/fasta/resolution_applier.dart
+++ b/pkg/analyzer/lib/src/fasta/resolution_applier.dart
@@ -37,7 +37,27 @@ class ResolutionApplier extends GeneralizingAstVisitor {
node.staticType = _getTypeFor(node);
}
- DartType _getTypeFor(Expression node) {
+ @override
+ void visitVariableDeclarationList(VariableDeclarationList node) {
+ if (node.variables.length != 1) {
+ // TODO(paulberry): handle this case
+ throw new UnimplementedError('Multiple variables in one declaration');
+ }
+ if (node.metadata.isNotEmpty) {
+ // TODO(paulberry): handle this case
+ throw new UnimplementedError('Metadata on a variable declaration list');
+ }
+ node.variables.accept(this);
+ if (node.type != null) {
+ _applyTypeAnnotation(node.variables[0].name.staticType, node.type);
+ }
+ }
+
+ void _applyTypeAnnotation(DartType type, TypeAnnotation typeAnnotation) {
scheglov 2017/07/13 21:15:17 I think it will do the opposite - apply "type" _to
Paul Berry 2017/07/13 21:17:05 Done.
+ // TODO(paulberry): implement this.
+ }
+
+ DartType _getTypeFor(AstNode node) {
return _types[_typeIndex++];
}
}
@@ -63,7 +83,7 @@ class ValidatingResolutionApplier extends ResolutionApplier {
}
@override
- DartType _getTypeFor(Expression node) {
+ DartType _getTypeFor(AstNode node) {
if (_debug) print('Getting type for $node');
if (node.offset != _typeOffsets[_typeIndex]) {
throw new StateError(
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/fasta/resolution_storer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698