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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/cps_ir/cps_ir_builder.dart

Issue 677663002: Support constructor invocation in analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add comment. Created 6 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 dart2js.ir_builder; 5 library dart2js.ir_builder;
6 6
7 import '../constants/expressions.dart'; 7 import '../constants/expressions.dart';
8 import '../constants/values.dart' show PrimitiveConstantValue; 8 import '../constants/values.dart' show PrimitiveConstantValue;
9 import '../dart_backend/dart_backend.dart' show DartBackend; 9 import '../dart_backend/dart_backend.dart' show DartBackend;
10 import '../dart_types.dart'; 10 import '../dart_types.dart';
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 /// Create a super invocation with method name and arguments structure defined 484 /// Create a super invocation with method name and arguments structure defined
485 /// by [selector] and argument values defined by [arguments]. 485 /// by [selector] and argument values defined by [arguments].
486 ir.Primitive buildSuperInvocation(Selector selector, 486 ir.Primitive buildSuperInvocation(Selector selector,
487 List<ir.Definition> arguments) { 487 List<ir.Definition> arguments) {
488 assert(isOpen); 488 assert(isOpen);
489 return continueWithExpression( 489 return continueWithExpression(
490 (k) => new ir.InvokeSuperMethod(selector, k, arguments)); 490 (k) => new ir.InvokeSuperMethod(selector, k, arguments));
491 491
492 } 492 }
493 493
494 /// Create a dynamic invocation on [receiver] with method name and arguments 494 /// Create a dynamic invocation on [receiver] with method name and argument
495 /// structure defined by [selector] and argument values defined by 495 /// structure defined by [selector] and argument values defined by
496 /// [arguments]. 496 /// [arguments].
497 ir.Primitive buildDynamicInvocation(ir.Definition receiver, 497 ir.Primitive buildDynamicInvocation(ir.Definition receiver,
498 Selector selector, 498 Selector selector,
499 List<ir.Definition> arguments) { 499 List<ir.Definition> arguments) {
500 assert(isOpen); 500 assert(isOpen);
501 return continueWithExpression( 501 return continueWithExpression(
502 (k) => new ir.InvokeMethod(receiver, selector, k, arguments)); 502 (k) => new ir.InvokeMethod(receiver, selector, k, arguments));
503 } 503 }
504 504
505 /// Create a static invocation of [element] with arguments structure defined 505 /// Create a static invocation of [element] with argument structure defined
506 /// by [selector] and argument values defined by [arguments]. 506 /// by [selector] and argument values defined by [arguments].
507 ir.Primitive buildStaticInvocation(Element element, 507 ir.Primitive buildStaticInvocation(Element element,
508 Selector selector, 508 Selector selector,
509 List<ir.Definition> arguments) { 509 List<ir.Definition> arguments) {
510 return continueWithExpression( 510 return continueWithExpression(
511 (k) => new ir.InvokeStatic(element, selector, k, arguments)); 511 (k) => new ir.InvokeStatic(element, selector, k, arguments));
512 } 512 }
513 513
514 /// Create a constructor invocation of [element] on [type] with argument
515 /// structure defined by [selector] and argument values defined by
516 /// [arguments].
517 ir.Primitive buildConstructorInvocation(FunctionElement element,
518 Selector selector,
519 DartType type,
520 List<ir.Definition> arguments) {
521 assert(isOpen);
522 return continueWithExpression(
523 (k) => new ir.InvokeConstructor(type, element, selector, k, arguments));
524 }
525
514 /// Creates an if-then-else statement with the provided [condition] where the 526 /// Creates an if-then-else statement with the provided [condition] where the
515 /// then and else branches are created through the [buildThenPart] and 527 /// then and else branches are created through the [buildThenPart] and
516 /// [buildElsePart] functions, respectively. 528 /// [buildElsePart] functions, respectively.
517 /// 529 ///
518 /// An if-then statement is created if [buildElsePart] is a no-op. 530 /// An if-then statement is created if [buildElsePart] is a no-op.
519 // TODO(johnniwinther): Unify implementation with [buildConditional] and 531 // TODO(johnniwinther): Unify implementation with [buildConditional] and
520 // [_buildLogicalOperator]. 532 // [_buildLogicalOperator].
521 void buildIf(ir.Primitive condition, 533 void buildIf(ir.Primitive condition,
522 void buildThenPart(IrBuilder builder), 534 void buildThenPart(IrBuilder builder),
523 void buildElsePart(IrBuilder builder)) { 535 void buildElsePart(IrBuilder builder)) {
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 index = 0; 868 index = 0;
857 for (int i = 0; i < environment.length; ++i) { 869 for (int i = 0; i < environment.length; ++i) {
858 if (common[i] == null) { 870 if (common[i] == null) {
859 environment.index2value[i] = parameters[index++]; 871 environment.index2value[i] = parameters[index++];
860 } 872 }
861 } 873 }
862 874
863 return join; 875 return join;
864 } 876 }
865 } 877 }
OLDNEW
« no previous file with comments | « pkg/analyzer2dart/test/sexpr_data.dart ('k') | sdk/lib/_internal/compiler/implementation/cps_ir/cps_ir_builder_visitor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698