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

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

Issue 2953503002: Only set types of conditional expressions in strong mode. (Closed)
Patch Set: Created 3 years, 6 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,
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 var write = new PropertySet(receiverAccess(), name, value, setter) 341 var write = new PropertySet(receiverAccess(), name, value, setter)
342 ..fileOffset = offsetForToken(token); 342 ..fileOffset = offsetForToken(token);
343 complexAssignment?.write = write; 343 complexAssignment?.write = write;
344 return write; 344 return write;
345 } 345 }
346 346
347 Expression _finish( 347 Expression _finish(
348 Expression body, KernelComplexAssignment complexAssignment) { 348 Expression body, KernelComplexAssignment complexAssignment) {
349 var offset = offsetForToken(token); 349 var offset = offsetForToken(token);
350 var nullAwareGuard = new ConditionalExpression( 350 var nullAwareGuard = new ConditionalExpression(
351 buildIsNull(receiverAccess(), offset), 351 buildIsNull(receiverAccess(), offset), new NullLiteral(), body, null)
352 new NullLiteral(),
353 body,
354 const DynamicType())
355 ..fileOffset = offset; 352 ..fileOffset = offset;
356 if (complexAssignment != null) { 353 if (complexAssignment != null) {
357 body = makeLet(receiver, nullAwareGuard); 354 body = makeLet(receiver, nullAwareGuard);
358 KernelPropertyAssign kernelPropertyAssign = complexAssignment; 355 KernelPropertyAssign kernelPropertyAssign = complexAssignment;
359 kernelPropertyAssign.nullAwareGuard = nullAwareGuard; 356 kernelPropertyAssign.nullAwareGuard = nullAwareGuard;
360 kernelPropertyAssign.desugared = body; 357 kernelPropertyAssign.desugared = body;
361 return kernelPropertyAssign; 358 return kernelPropertyAssign;
362 } else { 359 } else {
363 return new KernelNullAwarePropertyGet(receiver, nullAwareGuard) 360 return new KernelNullAwarePropertyGet(receiver, nullAwareGuard)
364 ..fileOffset = offset; 361 ..fileOffset = offset;
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 723
727 Expression buildIsNull(Expression value, int offset) { 724 Expression buildIsNull(Expression value, int offset) {
728 return makeBinary(value, equalsName, null, new NullLiteral(), offset: offset); 725 return makeBinary(value, equalsName, null, new NullLiteral(), offset: offset);
729 } 726 }
730 727
731 VariableDeclaration makeOrReuseVariable(Expression value) { 728 VariableDeclaration makeOrReuseVariable(Expression value) {
732 // TODO: Devise a way to remember if a variable declaration was reused 729 // TODO: Devise a way to remember if a variable declaration was reused
733 // or is fresh (hence needs a let binding). 730 // or is fresh (hence needs a let binding).
734 return new VariableDeclaration.forValue(value); 731 return new VariableDeclaration.forValue(value);
735 } 732 }
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