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

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

Issue 2959823002: Add type inference for super property gets. (Closed)
Patch Set: Created 3 years, 5 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 /// A library to help transform compounds and null-aware accessors into 5 /// A library to help transform compounds and null-aware accessors into
6 /// let expressions. 6 /// let expressions.
7 7
8 import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart' 8 import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart'
9 show 9 show
10 KernelArguments, 10 KernelArguments,
11 KernelComplexAssignment, 11 KernelComplexAssignment,
12 KernelConditionalExpression, 12 KernelConditionalExpression,
13 KernelMethodInvocation, 13 KernelMethodInvocation,
14 KernelNullAwarePropertyGet, 14 KernelNullAwarePropertyGet,
15 KernelPropertyAssign, 15 KernelPropertyAssign,
16 KernelPropertyGet, 16 KernelPropertyGet,
17 KernelSuperPropertyGet,
17 KernelThisExpression, 18 KernelThisExpression,
18 KernelVariableDeclaration, 19 KernelVariableDeclaration,
19 KernelVariableGet; 20 KernelVariableGet;
20 21
21 import 'package:front_end/src/fasta/kernel/utils.dart' show offsetForToken; 22 import 'package:front_end/src/fasta/kernel/utils.dart' show offsetForToken;
22 23
23 import 'package:front_end/src/scanner/token.dart' show Token; 24 import 'package:front_end/src/scanner/token.dart' show Token;
24 25
25 import 'package:front_end/src/fasta/kernel/fasta_accessors.dart' 26 import 'package:front_end/src/fasta/kernel/fasta_accessors.dart'
26 show BuilderHelper; 27 show BuilderHelper;
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 Name name; 368 Name name;
368 Member getter, setter; 369 Member getter, setter;
369 370
370 SuperPropertyAccessor( 371 SuperPropertyAccessor(
371 BuilderHelper helper, this.name, this.getter, this.setter, Token token) 372 BuilderHelper helper, this.name, this.getter, this.setter, Token token)
372 : super(helper, token); 373 : super(helper, token);
373 374
374 Expression _makeRead(KernelComplexAssignment complexAssignment) { 375 Expression _makeRead(KernelComplexAssignment complexAssignment) {
375 if (getter == null) return makeInvalidRead(); 376 if (getter == null) return makeInvalidRead();
376 // TODO(ahe): Use [DirectPropertyGet] when possible. 377 // TODO(ahe): Use [DirectPropertyGet] when possible.
377 var read = new SuperPropertyGet(name, getter) 378 var read = new KernelSuperPropertyGet(name, getter)
378 ..fileOffset = offsetForToken(token); 379 ..fileOffset = offsetForToken(token);
379 complexAssignment?.read = read; 380 complexAssignment?.read = read;
380 return read; 381 return read;
381 } 382 }
382 383
383 Expression _makeWrite(Expression value, bool voidContext, 384 Expression _makeWrite(Expression value, bool voidContext,
384 KernelComplexAssignment complexAssignment) { 385 KernelComplexAssignment complexAssignment) {
385 if (setter == null) return makeInvalidWrite(value); 386 if (setter == null) return makeInvalidWrite(value);
386 // TODO(ahe): Use [DirectPropertySet] when possible. 387 // TODO(ahe): Use [DirectPropertySet] when possible.
387 var write = new SuperPropertySet(name, value, setter) 388 var write = new SuperPropertySet(name, value, setter)
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 724
724 Expression buildIsNull(Expression value, int offset) { 725 Expression buildIsNull(Expression value, int offset) {
725 return makeBinary(value, equalsName, null, new NullLiteral(), offset: offset); 726 return makeBinary(value, equalsName, null, new NullLiteral(), offset: offset);
726 } 727 }
727 728
728 VariableDeclaration makeOrReuseVariable(Expression value) { 729 VariableDeclaration makeOrReuseVariable(Expression value) {
729 // TODO: Devise a way to remember if a variable declaration was reused 730 // TODO: Devise a way to remember if a variable declaration was reused
730 // or is fresh (hence needs a let binding). 731 // or is fresh (hence needs a let binding).
731 return new VariableDeclaration.forValue(value); 732 return new VariableDeclaration.forValue(value);
732 } 733 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/body_builder.dart ('k') | pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698