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

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

Issue 2828253003: Add top level type inference logic for integer literals. (Closed)
Patch Set: Clean up, bug fix, and remove unintentional expectations changes 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 /// 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/fasta_accessors.dart'
9 show BuilderHelper;
10
8 import 'package:kernel/ast.dart'; 11 import 'package:kernel/ast.dart';
9 12
10 final Name indexGetName = new Name("[]"); 13 final Name indexGetName = new Name("[]");
11 14
12 final Name indexSetName = new Name("[]="); 15 final Name indexSetName = new Name("[]=");
13 16
14 /// An [Accessor] represents a subexpression for which we can't yet build a 17 /// An [Accessor] represents a subexpression for which we can't yet build a
15 /// kernel [Expression] because we don't yet know the context in which it is 18 /// kernel [Expression] because we don't yet know the context in which it is
16 /// used. 19 /// used.
17 /// 20 ///
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 return makeLet( 444 return makeLet(
442 valueVariable, makeLet(dummy, new VariableGet(valueVariable))); 445 valueVariable, makeLet(dummy, new VariableGet(valueVariable)));
443 } 446 }
444 447
445 Expression _finish(Expression body) { 448 Expression _finish(Expression body) {
446 return makeLet(indexVariable, body); 449 return makeLet(indexVariable, body);
447 } 450 }
448 } 451 }
449 452
450 class StaticAccessor extends Accessor { 453 class StaticAccessor extends Accessor {
454 final BuilderHelper helper;
451 Member readTarget; 455 Member readTarget;
452 Member writeTarget; 456 Member writeTarget;
453 457
454 StaticAccessor(this.readTarget, this.writeTarget, int offset) : super(offset); 458 StaticAccessor(this.helper, this.readTarget, this.writeTarget, int offset)
459 : super(offset);
455 460
456 Expression _makeRead() => builtGetter = 461 Expression _makeRead() => builtGetter = readTarget == null
457 readTarget == null ? makeInvalidRead() : new StaticGet(readTarget) 462 ? makeInvalidRead()
458 ..fileOffset = offset; 463 : helper.makeStaticGet(readTarget, offset);
459 464
460 Expression _makeWrite(Expression value, bool voidContext) { 465 Expression _makeWrite(Expression value, bool voidContext) {
461 return writeTarget == null 466 return writeTarget == null
462 ? makeInvalidWrite(value) 467 ? makeInvalidWrite(value)
463 : new StaticSet(writeTarget, value) 468 : new StaticSet(writeTarget, value)
464 ..fileOffset = offset; 469 ..fileOffset = offset;
465 } 470 }
466 } 471 }
467 472
468 class ReadOnlyAccessor extends Accessor { 473 class ReadOnlyAccessor extends Accessor {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 511
507 VariableDeclaration makeOrReuseVariable(Expression value) { 512 VariableDeclaration makeOrReuseVariable(Expression value) {
508 // TODO: Devise a way to remember if a variable declaration was reused 513 // TODO: Devise a way to remember if a variable declaration was reused
509 // or is fresh (hence needs a let binding). 514 // or is fresh (hence needs a let binding).
510 return new VariableDeclaration.forValue(value); 515 return new VariableDeclaration.forValue(value);
511 } 516 }
512 517
513 Expression wrapInvalid(Expression e) { 518 Expression wrapInvalid(Expression e) {
514 return new Let(new VariableDeclaration.forValue(e), new InvalidExpression()); 519 return new Let(new VariableDeclaration.forValue(e), new InvalidExpression());
515 } 520 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698