OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library dart2js.ir_nodes; | 4 library dart2js.ir_nodes; |
5 | 5 |
6 import '../constants/expressions.dart'; | 6 import '../constants/expressions.dart'; |
7 import '../constants/values.dart' as values show ConstantValue; | 7 import '../constants/values.dart' as values show ConstantValue; |
8 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; | 8 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; |
9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
10 import '../io/source_information.dart' show SourceInformation; | 10 import '../io/source_information.dart' show SourceInformation; |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
357 List<Primitive> args, | 357 List<Primitive> args, |
358 Continuation cont) | 358 Continuation cont) |
359 : arguments = _referenceList(args), | 359 : arguments = _referenceList(args), |
360 continuation = new Reference<Continuation>(cont); | 360 continuation = new Reference<Continuation>(cont); |
361 | 361 |
362 accept(Visitor visitor) => visitor.visitInvokeConstructor(this); | 362 accept(Visitor visitor) => visitor.visitInvokeConstructor(this); |
363 } | 363 } |
364 | 364 |
365 /// An "is" type test. | 365 /// An "is" type test. |
366 /// | 366 /// |
367 /// Returns `true` if [value] not `null` and is an instance of [type]. | 367 /// Returns `true` if [value] is an instance of [type]. |
368 /// | 368 /// |
369 /// [type] must not be the [Object], `dynamic` or [Null] types (though it might | 369 /// [type] must not be the [Object], `dynamic` or [Null] types (though it might |
370 /// be a type variable containing one of these types). This design is chosen | 370 /// be a type variable containing one of these types). This design is chosen |
371 /// to simplify code generation for type tests. | 371 /// to simplify code generation for type tests. |
372 class TypeTest extends Primitive { | 372 class TypeTest extends Primitive { |
373 Reference<Primitive> value; | 373 Reference<Primitive> value; |
374 final DartType type; | 374 final DartType type; |
375 | 375 |
376 /// If [type] is an [InterfaceType], this holds the internal representation of | 376 /// If [type] is an [InterfaceType], this holds the internal representation of |
377 /// the type arguments to [type]. Since these may reference type variables | 377 /// the type arguments to [type]. Since these may reference type variables |
378 /// from the enclosing class, they are not constant. | 378 /// from the enclosing class, they are not constant. |
379 /// | 379 /// |
380 /// If [type] is a [TypeVariableType], this is a singleton list with | 380 /// If [type] is a [TypeVariableType], this is a singleton list with |
381 /// the internal representation of the type held in that type variable. | 381 /// the internal representation of the type held in that type variable. |
382 /// | 382 /// |
383 /// If [type] is a [FunctionType], this is a singleton list with the | |
384 /// internal representation of that type, | |
385 /// | |
383 /// Otherwise the list is empty. | 386 /// Otherwise the list is empty. |
384 final List<Reference<Primitive>> typeArguments; | 387 final List<Reference<Primitive>> typeArguments; |
karlklose
2015/06/18 07:45:02
We should rename this field. How about 'typeRepre
asgerf
2015/06/18 09:20:38
Well, at least now it makes sense for the Interfac
| |
385 | 388 |
386 TypeTest(Primitive value, | 389 TypeTest(Primitive value, |
387 this.type, | 390 this.type, |
388 List<Primitive> typeArguments) | 391 List<Primitive> typeArguments) |
389 : this.value = new Reference<Primitive>(value), | 392 : this.value = new Reference<Primitive>(value), |
390 this.typeArguments = _referenceList(typeArguments); | 393 this.typeArguments = _referenceList(typeArguments); |
391 | 394 |
392 accept(Visitor visitor) => visitor.visitTypeTest(this); | 395 accept(Visitor visitor) => visitor.visitTypeTest(this); |
393 } | 396 } |
394 | 397 |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1260 const RemovalVisitor(); | 1263 const RemovalVisitor(); |
1261 | 1264 |
1262 processReference(Reference reference) { | 1265 processReference(Reference reference) { |
1263 reference.unlink(); | 1266 reference.unlink(); |
1264 } | 1267 } |
1265 | 1268 |
1266 static void remove(Node node) { | 1269 static void remove(Node node) { |
1267 (const RemovalVisitor()).visit(node); | 1270 (const RemovalVisitor()).visit(node); |
1268 } | 1271 } |
1269 } | 1272 } |
OLD | NEW |