OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 fasta.fasta_accessors; | 5 library fasta.fasta_accessors; |
6 | 6 |
7 import 'package:kernel/ast.dart' | 7 import 'package:kernel/ast.dart' |
8 hide InvalidExpression, InvalidInitializer, InvalidStatement; | 8 hide InvalidExpression, InvalidInitializer, InvalidStatement; |
9 | 9 |
10 import '../../scanner/token.dart' show Token; | 10 import '../../scanner/token.dart' show Token; |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 return receiver.buildPropertyAccess(this, operatorOffset, isNullAware); | 504 return receiver.buildPropertyAccess(this, operatorOffset, isNullAware); |
505 } | 505 } |
506 if (receiver is PrefixBuilder) { | 506 if (receiver is PrefixBuilder) { |
507 PrefixBuilder prefix = receiver; | 507 PrefixBuilder prefix = receiver; |
508 if (isNullAware) { | 508 if (isNullAware) { |
509 helper.deprecated_addCompileTimeError( | 509 helper.deprecated_addCompileTimeError( |
510 offsetForToken(token), | 510 offsetForToken(token), |
511 "Library prefix '${prefix.name}' can't be used with null-aware " | 511 "Library prefix '${prefix.name}' can't be used with null-aware " |
512 "operator.\nTry removing '?'."); | 512 "operator.\nTry removing '?'."); |
513 } | 513 } |
514 receiver = helper.scopeLookup(prefix.exports, name.name, token, | 514 receiver = helper.scopeLookup(prefix.exportScope, name.name, token, |
515 isQualified: true, prefix: prefix); | 515 isQualified: true, prefix: prefix); |
516 return helper.finishSend(receiver, arguments, offsetForToken(token)); | 516 return helper.finishSend(receiver, arguments, offsetForToken(token)); |
517 } | 517 } |
518 return helper.buildMethodInvocation( | 518 return helper.buildMethodInvocation( |
519 helper.toValue(receiver), name, arguments, offsetForToken(token), | 519 helper.toValue(receiver), name, arguments, offsetForToken(token), |
520 isNullAware: isNullAware); | 520 isNullAware: isNullAware); |
521 } | 521 } |
522 | 522 |
523 Expression buildNullAwareAssignment( | 523 Expression buildNullAwareAssignment( |
524 Expression value, DartType type, int offset, | 524 Expression value, DartType type, int offset, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 return receiver.buildPropertyAccess(this, operatorOffset, isNullAware); | 576 return receiver.buildPropertyAccess(this, operatorOffset, isNullAware); |
577 } | 577 } |
578 if (receiver is PrefixBuilder) { | 578 if (receiver is PrefixBuilder) { |
579 PrefixBuilder prefix = receiver; | 579 PrefixBuilder prefix = receiver; |
580 if (isNullAware) { | 580 if (isNullAware) { |
581 helper.deprecated_addCompileTimeError( | 581 helper.deprecated_addCompileTimeError( |
582 offsetForToken(token), | 582 offsetForToken(token), |
583 "Library prefix '${prefix.name}' can't be used with null-aware " | 583 "Library prefix '${prefix.name}' can't be used with null-aware " |
584 "operator.\nTry removing '?'."); | 584 "operator.\nTry removing '?'."); |
585 } | 585 } |
586 return helper.scopeLookup(prefix.exports, name.name, token, | 586 return helper.scopeLookup(prefix.exportScope, name.name, token, |
587 isQualified: true, prefix: prefix); | 587 isQualified: true, prefix: prefix); |
588 } | 588 } |
589 | 589 |
590 return PropertyAccessor.make( | 590 return PropertyAccessor.make( |
591 helper, token, helper.toValue(receiver), name, null, null, isNullAware); | 591 helper, token, helper.toValue(receiver), name, null, null, isNullAware); |
592 } | 592 } |
593 | 593 |
594 Expression buildNullAwareAssignment( | 594 Expression buildNullAwareAssignment( |
595 Expression value, DartType type, int offset, | 595 Expression value, DartType type, int offset, |
596 {bool voidContext: false}) { | 596 {bool voidContext: false}) { |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 offset ??= offsetForToken(this.token); | 1057 offset ??= offsetForToken(this.token); |
1058 return helper.throwNoSuchMethodError(new NullLiteral()..fileOffset = offset, | 1058 return helper.throwNoSuchMethodError(new NullLiteral()..fileOffset = offset, |
1059 plainNameForRead, arguments, offset, | 1059 plainNameForRead, arguments, offset, |
1060 isGetter: isGetter, isSetter: isSetter); | 1060 isGetter: isGetter, isSetter: isSetter); |
1061 } | 1061 } |
1062 } | 1062 } |
1063 | 1063 |
1064 bool isFieldOrGetter(Member member) { | 1064 bool isFieldOrGetter(Member member) { |
1065 return member is Field || (member is Procedure && member.isGetter); | 1065 return member is Field || (member is Procedure && member.isGetter); |
1066 } | 1066 } |
OLD | NEW |