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

Side by Side Diff: lib/src/checker/checker.dart

Issue 1316723003: implement null aware ops, fixes #249 (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « lib/runtime/dart_runtime.js ('k') | lib/src/codegen/ast_builder.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dev_compiler.src.checker.checker; 5 library dev_compiler.src.checker.checker;
6 6
7 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 import 'package:analyzer/src/generated/ast.dart'; 8 import 'package:analyzer/src/generated/ast.dart';
9 import 'package:analyzer/src/generated/element.dart'; 9 import 'package:analyzer/src/generated/element.dart';
10 import 'package:analyzer/src/generated/scanner.dart' show Token, TokenType; 10 import 'package:analyzer/src/generated/scanner.dart' show Token, TokenType;
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 final node = init[i]; 382 final node = init[i];
383 if (node is SuperConstructorInvocation) { 383 if (node is SuperConstructorInvocation) {
384 _recordMessage(new InvalidSuperInvocation(node)); 384 _recordMessage(new InvalidSuperInvocation(node));
385 } 385 }
386 } 386 }
387 } 387 }
388 388
389 @override 389 @override
390 void visitConstructorFieldInitializer(ConstructorFieldInitializer node) { 390 void visitConstructorFieldInitializer(ConstructorFieldInitializer node) {
391 var field = node.fieldName; 391 var field = node.fieldName;
392 DartType staticType = rules.elementType(field.staticElement); 392 var element = field.staticElement;
393 DartType staticType = rules.elementType(element);
393 checkAssignment(node.expression, staticType); 394 checkAssignment(node.expression, staticType);
394 node.visitChildren(this); 395 node.visitChildren(this);
395 } 396 }
396 397
397 @override 398 @override
398 void visitForEachStatement(ForEachStatement node) { 399 void visitForEachStatement(ForEachStatement node) {
399 // Check that the expression is an Iterable. 400 // Check that the expression is an Iterable.
400 var expr = node.iterable; 401 var expr = node.iterable;
401 var iterableType = node.awaitKeyword != null 402 var iterableType = node.awaitKeyword != null
402 ? rules.provider.streamType 403 ? rules.provider.streamType
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 } else { 786 } else {
786 // Non-method operator. 787 // Non-method operator.
787 switch (op.type) { 788 switch (op.type) {
788 case TokenType.AMPERSAND_AMPERSAND: 789 case TokenType.AMPERSAND_AMPERSAND:
789 case TokenType.BAR_BAR: 790 case TokenType.BAR_BAR:
790 checkBoolean(node.leftOperand); 791 checkBoolean(node.leftOperand);
791 checkBoolean(node.rightOperand); 792 checkBoolean(node.rightOperand);
792 break; 793 break;
793 case TokenType.BANG_EQ: 794 case TokenType.BANG_EQ:
794 break; 795 break;
796 case TokenType.QUESTION_QUESTION:
797 break;
795 default: 798 default:
796 assert(false); 799 assert(false);
797 } 800 }
798 } 801 }
799 node.visitChildren(this); 802 node.visitChildren(this);
800 } 803 }
801 804
802 @override 805 @override
803 void visitConditionalExpression(ConditionalExpression node) { 806 void visitConditionalExpression(ConditionalExpression node) {
804 checkBoolean(node.condition); 807 checkBoolean(node.condition);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 if (info is CoercionInfo) { 937 if (info is CoercionInfo) {
935 // TODO(jmesserly): if we're run again on the same AST, we'll produce the 938 // TODO(jmesserly): if we're run again on the same AST, we'll produce the
936 // same annotations. This should be harmless. This might go away once 939 // same annotations. This should be harmless. This might go away once
937 // CodeChecker is integrated better with analyzer, as it will know that 940 // CodeChecker is integrated better with analyzer, as it will know that
938 // checking has already been performed. 941 // checking has already been performed.
939 // assert(CoercionInfo.get(info.node) == null); 942 // assert(CoercionInfo.get(info.node) == null);
940 CoercionInfo.set(info.node, info); 943 CoercionInfo.set(info.node, info);
941 } 944 }
942 } 945 }
943 } 946 }
OLDNEW
« no previous file with comments | « lib/runtime/dart_runtime.js ('k') | lib/src/codegen/ast_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698