| OLD | NEW |
| 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 /// Defines static information collected by the type checker and used later by | 5 /// Defines static information collected by the type checker and used later by |
| 6 /// emitters to generate code. | 6 /// emitters to generate code. |
| 7 library ddc.src.info; | 7 library ddc.src.info; |
| 8 | 8 |
| 9 import 'dart:mirrors'; | 9 import 'dart:mirrors'; |
| 10 | 10 |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 class InvalidVariableDeclaration extends StaticError { | 367 class InvalidVariableDeclaration extends StaticError { |
| 368 final DartType expectedType; | 368 final DartType expectedType; |
| 369 | 369 |
| 370 InvalidVariableDeclaration( | 370 InvalidVariableDeclaration( |
| 371 TypeRules rules, AstNode declaration, this.expectedType) | 371 TypeRules rules, AstNode declaration, this.expectedType) |
| 372 : super(declaration); | 372 : super(declaration); |
| 373 | 373 |
| 374 String get message => 'Type check failed: null is not of type $expectedType'; | 374 String get message => 'Type check failed: null is not of type $expectedType'; |
| 375 } | 375 } |
| 376 | 376 |
| 377 class InvalidParameterDeclaration extends StaticError { |
| 378 final DartType expectedType; |
| 379 |
| 380 InvalidParameterDeclaration( |
| 381 TypeRules rules, FormalParameter declaration, this.expectedType) |
| 382 : super(declaration); |
| 383 |
| 384 String get message => 'Type check failed: $node is not of type $expectedType'; |
| 385 } |
| 386 |
| 377 class InvalidRuntimeCheckError extends StaticError { | 387 class InvalidRuntimeCheckError extends StaticError { |
| 378 final DartType type; | 388 final DartType type; |
| 379 | 389 |
| 380 InvalidRuntimeCheckError(AstNode node, this.type) : super(node) { | 390 InvalidRuntimeCheckError(AstNode node, this.type) : super(node) { |
| 381 assert(node is IsExpression || node is AsExpression); | 391 assert(node is IsExpression || node is AsExpression); |
| 382 } | 392 } |
| 383 | 393 |
| 384 String get message => "Invalid runtime check on non-ground type $type"; | 394 String get message => "Invalid runtime check on non-ground type $type"; |
| 385 } | 395 } |
| 386 | 396 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 for (var cls in lib.declarations.values.where((d) => d is ClassMirror)) { | 579 for (var cls in lib.declarations.values.where((d) => d is ClassMirror)) { |
| 570 if (cls.isSubtypeOf(infoMirror)) { | 580 if (cls.isSubtypeOf(infoMirror)) { |
| 571 allTypes.add(cls); | 581 allTypes.add(cls); |
| 572 baseTypes.add(cls.superclass); | 582 baseTypes.add(cls.superclass); |
| 573 } | 583 } |
| 574 } | 584 } |
| 575 allTypes.removeAll(baseTypes); | 585 allTypes.removeAll(baseTypes); |
| 576 return new List<Type>.from(allTypes.map((mirror) => mirror.reflectedType)) | 586 return new List<Type>.from(allTypes.map((mirror) => mirror.reflectedType)) |
| 577 ..sort((t1, t2) => '$t1'.compareTo('$t2')); | 587 ..sort((t1, t2) => '$t1'.compareTo('$t2')); |
| 578 }(); | 588 }(); |
| OLD | NEW |