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

Side by Side Diff: pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart

Issue 2788153002: Create separate scopes for constructors, setters, and other members. (Closed)
Patch Set: Update subpackage dependencies. Created 3 years, 8 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
OLDNEW
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 'package:kernel/frontend/accessors.dart' show wrapInvalid; 7 export 'package:kernel/frontend/accessors.dart' show wrapInvalid;
8 8
9 import 'package:kernel/frontend/accessors.dart' 9 import 'package:kernel/frontend/accessors.dart'
10 show Accessor, buildIsNull, makeLet; 10 show Accessor, buildIsNull, makeLet;
11 11
12 import 'package:kernel/ast.dart'; 12 import 'package:kernel/ast.dart';
13 13
14 import '../errors.dart' show internalError; 14 import '../errors.dart' show internalError;
15 15
16 import '../scope.dart' show AccessErrorBuilder, ProblemBuilder; 16 import '../scope.dart' show AccessErrorBuilder, ProblemBuilder, Scope;
17 17
18 import 'package:kernel/frontend/accessors.dart' as kernel 18 import 'package:kernel/frontend/accessors.dart' as kernel
19 show 19 show
20 IndexAccessor, 20 IndexAccessor,
21 NullAwarePropertyAccessor, 21 NullAwarePropertyAccessor,
22 PropertyAccessor, 22 PropertyAccessor,
23 ReadOnlyAccessor, 23 ReadOnlyAccessor,
24 StaticAccessor, 24 StaticAccessor,
25 SuperIndexAccessor, 25 SuperIndexAccessor,
26 SuperPropertyAccessor, 26 SuperPropertyAccessor,
(...skipping 10 matching lines...) Expand all
37 Uri get uri; 37 Uri get uri;
38 38
39 Constructor lookupConstructor(Name name, {bool isSuper}); 39 Constructor lookupConstructor(Name name, {bool isSuper});
40 40
41 Expression toSuperMethodInvocation(MethodInvocation node); 41 Expression toSuperMethodInvocation(MethodInvocation node);
42 42
43 Expression toValue(node); 43 Expression toValue(node);
44 44
45 Member lookupSuperMember(Name name, {bool isSetter: false}); 45 Member lookupSuperMember(Name name, {bool isSetter: false});
46 46
47 builderToFirstExpression(Builder builder, String name, int offset); 47 scopeLookup(Scope scope, String name, int offset, {bool isQualified: false});
48 48
49 finishSend(Object receiver, Arguments arguments, int offset); 49 finishSend(Object receiver, Arguments arguments, int offset);
50 50
51 Expression buildCompileTimeError(error, [int offset]); 51 Expression buildCompileTimeError(error, [int offset]);
52 52
53 Initializer buildCompileTimeErrorIntializer(error, [int offset]); 53 Initializer buildCompileTimeErrorIntializer(error, [int offset]);
54 54
55 Expression buildStaticInvocation(Procedure target, Arguments arguments); 55 Expression buildStaticInvocation(Procedure target, Arguments arguments);
56 56
57 Expression buildProblemExpression(ProblemBuilder builder, int offset); 57 Expression buildProblemExpression(ProblemBuilder builder, int offset);
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 if (receiver is TypeDeclarationBuilder) { 425 if (receiver is TypeDeclarationBuilder) {
426 /// `SomeType?.toString` is the same as `SomeType.toString`, not 426 /// `SomeType?.toString` is the same as `SomeType.toString`, not
427 /// `(SomeType).toString`. 427 /// `(SomeType).toString`.
428 isNullAware = false; 428 isNullAware = false;
429 } 429 }
430 if (receiver is FastaAccessor) { 430 if (receiver is FastaAccessor) {
431 return receiver.buildPropertyAccess(this, isNullAware); 431 return receiver.buildPropertyAccess(this, isNullAware);
432 } 432 }
433 if (receiver is PrefixBuilder) { 433 if (receiver is PrefixBuilder) {
434 PrefixBuilder prefix = receiver; 434 PrefixBuilder prefix = receiver;
435 receiver = helper.builderToFirstExpression( 435 receiver = helper.scopeLookup(prefix.exports, name.name, offset,
436 prefix.exports[name.name], "${prefix.name}.${name.name}", offset); 436 isQualified: true);
437 return helper.finishSend(receiver, arguments, offset); 437 return helper.finishSend(receiver, arguments, offset);
438 } 438 }
439 Expression result; 439 Expression result;
440 if (receiver is KernelClassBuilder) { 440 if (receiver is KernelClassBuilder) {
441 Builder builder = receiver.findStaticBuilder(name.name, offset, uri); 441 Builder builder = receiver.findStaticBuilder(name.name, offset, uri);
442 if (builder == null || builder is AccessErrorBuilder) { 442 if (builder == null || builder is AccessErrorBuilder) {
443 return buildThrowNoSuchMethodError(arguments); 443 return buildThrowNoSuchMethodError(arguments);
444 } 444 }
445 if (builder.hasProblem) { 445 if (builder.hasProblem) {
446 result = helper.buildProblemExpression(builder, offset); 446 result = helper.buildProblemExpression(builder, offset);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 /// For reasons beyond comprehension, `SomeType?.toString` is the same as 511 /// For reasons beyond comprehension, `SomeType?.toString` is the same as
512 /// `SomeType.toString`, not `(SomeType).toString`. WTAF!?! 512 /// `SomeType.toString`, not `(SomeType).toString`. WTAF!?!
513 // 513 //
514 isNullAware = false; 514 isNullAware = false;
515 } 515 }
516 if (receiver is FastaAccessor) { 516 if (receiver is FastaAccessor) {
517 return receiver.buildPropertyAccess(this, isNullAware); 517 return receiver.buildPropertyAccess(this, isNullAware);
518 } 518 }
519 if (receiver is PrefixBuilder) { 519 if (receiver is PrefixBuilder) {
520 PrefixBuilder prefix = receiver; 520 PrefixBuilder prefix = receiver;
521 return helper.builderToFirstExpression( 521 return helper.scopeLookup(prefix.exports, name.name, offset,
522 prefix.exports[name.name], name.name, offset); 522 isQualified: true);
523 } 523 }
524 if (receiver is KernelClassBuilder) { 524 if (receiver is KernelClassBuilder) {
525 Builder builder = receiver.findStaticBuilder(name.name, offset, uri); 525 Builder builder = receiver.findStaticBuilder(name.name, offset, uri);
526 if (builder == null) { 526 if (builder == null) {
527 // If we find a setter, [builder] is an [AccessErrorBuilder], not null. 527 // If we find a setter, [builder] is an [AccessErrorBuilder], not null.
528 return buildThrowNoSuchMethodError(new Arguments.empty(), 528 return buildThrowNoSuchMethodError(new Arguments.empty(),
529 isGetter: true); 529 isGetter: true);
530 } 530 }
531 Builder setter; 531 Builder setter;
532 if (builder.isSetter) { 532 if (builder.isSetter) {
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 new ConditionalExpression( 872 new ConditionalExpression(
873 buildIsNull(new VariableGet(variable)), 873 buildIsNull(new VariableGet(variable)),
874 new NullLiteral(), 874 new NullLiteral(),
875 new MethodInvocation(new VariableGet(variable), name, arguments) 875 new MethodInvocation(new VariableGet(variable), name, arguments)
876 ..fileOffset = offset, 876 ..fileOffset = offset,
877 const DynamicType())); 877 const DynamicType()));
878 } else { 878 } else {
879 return new MethodInvocation(receiver, name, arguments)..fileOffset = offset; 879 return new MethodInvocation(receiver, name, arguments)..fileOffset = offset;
880 } 880 }
881 } 881 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698