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 export 'frontend_accessors.dart' show wrapInvalid; | 7 export 'frontend_accessors.dart' show wrapInvalid; |
8 | 8 |
9 import 'frontend_accessors.dart' show Accessor, buildIsNull, makeLet; | 9 import 'frontend_accessors.dart' show Accessor, buildIsNull, makeLet; |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 Uri get uri; | 36 Uri get uri; |
37 | 37 |
38 Constructor lookupConstructor(Name name, {bool isSuper}); | 38 Constructor lookupConstructor(Name name, {bool isSuper}); |
39 | 39 |
40 Expression toSuperMethodInvocation(MethodInvocation node); | 40 Expression toSuperMethodInvocation(MethodInvocation node); |
41 | 41 |
42 Expression toValue(node); | 42 Expression toValue(node); |
43 | 43 |
44 Member lookupSuperMember(Name name, {bool isSetter: false}); | 44 Member lookupSuperMember(Name name, {bool isSetter: false}); |
45 | 45 |
46 scopeLookup(Scope scope, String name, int offset, {bool isQualified: false}); | 46 scopeLookup(Scope scope, String name, int offset, |
| 47 {bool isQualified: false, PrefixBuilder prefix}); |
47 | 48 |
48 finishSend(Object receiver, Arguments arguments, int offset); | 49 finishSend(Object receiver, Arguments arguments, int offset); |
49 | 50 |
50 Expression buildCompileTimeError(error, [int offset]); | 51 Expression buildCompileTimeError(error, [int offset]); |
51 | 52 |
52 Initializer buildCompileTimeErrorIntializer(error, [int offset]); | 53 Initializer buildCompileTimeErrorIntializer(error, [int offset]); |
53 | 54 |
54 Expression buildStaticInvocation(Procedure target, Arguments arguments); | 55 Expression buildStaticInvocation(Procedure target, Arguments arguments); |
55 | 56 |
56 Expression buildProblemExpression(ProblemBuilder builder, int offset); | 57 Expression buildProblemExpression(ProblemBuilder builder, int offset); |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 /// `SomeType?.toString` is the same as `SomeType.toString`, not | 426 /// `SomeType?.toString` is the same as `SomeType.toString`, not |
426 /// `(SomeType).toString`. | 427 /// `(SomeType).toString`. |
427 isNullAware = false; | 428 isNullAware = false; |
428 } | 429 } |
429 if (receiver is FastaAccessor) { | 430 if (receiver is FastaAccessor) { |
430 return receiver.buildPropertyAccess(this, isNullAware); | 431 return receiver.buildPropertyAccess(this, isNullAware); |
431 } | 432 } |
432 if (receiver is PrefixBuilder) { | 433 if (receiver is PrefixBuilder) { |
433 PrefixBuilder prefix = receiver; | 434 PrefixBuilder prefix = receiver; |
434 receiver = helper.scopeLookup(prefix.exports, name.name, offset, | 435 receiver = helper.scopeLookup(prefix.exports, name.name, offset, |
435 isQualified: true); | 436 isQualified: true, prefix: prefix); |
436 return helper.finishSend(receiver, arguments, offset); | 437 return helper.finishSend(receiver, arguments, offset); |
437 } | 438 } |
438 Expression result; | 439 Expression result; |
439 if (receiver is KernelClassBuilder) { | 440 if (receiver is KernelClassBuilder) { |
440 Builder builder = receiver.findStaticBuilder(name.name, offset, uri); | 441 Builder builder = receiver.findStaticBuilder(name.name, offset, uri); |
441 if (builder == null || builder is AccessErrorBuilder) { | 442 if (builder == null || builder is AccessErrorBuilder) { |
442 return buildThrowNoSuchMethodError(arguments); | 443 return buildThrowNoSuchMethodError(arguments); |
443 } | 444 } |
444 if (builder.hasProblem) { | 445 if (builder.hasProblem) { |
445 result = helper.buildProblemExpression(builder, offset); | 446 result = helper.buildProblemExpression(builder, offset); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 /// `SomeType.toString`, not `(SomeType).toString`. WTAF!?! | 512 /// `SomeType.toString`, not `(SomeType).toString`. WTAF!?! |
512 // | 513 // |
513 isNullAware = false; | 514 isNullAware = false; |
514 } | 515 } |
515 if (receiver is FastaAccessor) { | 516 if (receiver is FastaAccessor) { |
516 return receiver.buildPropertyAccess(this, isNullAware); | 517 return receiver.buildPropertyAccess(this, isNullAware); |
517 } | 518 } |
518 if (receiver is PrefixBuilder) { | 519 if (receiver is PrefixBuilder) { |
519 PrefixBuilder prefix = receiver; | 520 PrefixBuilder prefix = receiver; |
520 return helper.scopeLookup(prefix.exports, name.name, offset, | 521 return helper.scopeLookup(prefix.exports, name.name, offset, |
521 isQualified: true); | 522 isQualified: true, prefix: prefix); |
522 } | 523 } |
523 if (receiver is KernelClassBuilder) { | 524 if (receiver is KernelClassBuilder) { |
524 Builder builder = receiver.findStaticBuilder(name.name, offset, uri); | 525 Builder builder = receiver.findStaticBuilder(name.name, offset, uri); |
525 if (builder == null) { | 526 if (builder == null) { |
526 // If we find a setter, [builder] is an [AccessErrorBuilder], not null. | 527 // If we find a setter, [builder] is an [AccessErrorBuilder], not null. |
527 return buildThrowNoSuchMethodError(new Arguments.empty(), | 528 return buildThrowNoSuchMethodError(new Arguments.empty(), |
528 isGetter: true); | 529 isGetter: true); |
529 } | 530 } |
530 Builder setter; | 531 Builder setter; |
531 if (builder.isSetter) { | 532 if (builder.isSetter) { |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 new ConditionalExpression( | 872 new ConditionalExpression( |
872 buildIsNull(new VariableGet(variable)), | 873 buildIsNull(new VariableGet(variable)), |
873 new NullLiteral(), | 874 new NullLiteral(), |
874 new MethodInvocation(new VariableGet(variable), name, arguments) | 875 new MethodInvocation(new VariableGet(variable), name, arguments) |
875 ..fileOffset = offset, | 876 ..fileOffset = offset, |
876 const DynamicType())); | 877 const DynamicType())); |
877 } else { | 878 } else { |
878 return new MethodInvocation(receiver, name, arguments)..fileOffset = offset; | 879 return new MethodInvocation(receiver, name, arguments)..fileOffset = offset; |
879 } | 880 } |
880 } | 881 } |
OLD | NEW |