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

Side by Side Diff: pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart

Issue 1173403002: dart2js: Fix hints in code base. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Updated to latest revision Created 5 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 tree_ir_builder; 5 library tree_ir_builder;
6 6
7 import '../dart2jslib.dart' as dart2js; 7 import '../dart2jslib.dart' as dart2js;
8 import '../dart_types.dart';
9 import '../elements/elements.dart'; 8 import '../elements/elements.dart';
10 import '../cps_ir/cps_ir_nodes.dart' as cps_ir; 9 import '../cps_ir/cps_ir_nodes.dart' as cps_ir;
11 import '../util/util.dart' show CURRENT_ELEMENT_SPANNABLE; 10 import '../util/util.dart' show CURRENT_ELEMENT_SPANNABLE;
12 import 'tree_ir_nodes.dart'; 11 import 'tree_ir_nodes.dart';
13 12
14 /** 13 /**
15 * Builder translates from CPS-based IR to direct-style Tree. 14 * Builder translates from CPS-based IR to direct-style Tree.
16 * 15 *
17 * A call `Invoke(fun, cont, args)`, where cont is a singly-referenced 16 * A call `Invoke(fun, cont, args)`, where cont is a singly-referenced
18 * non-exit continuation `Cont(v, body)` is translated into a direct-style call 17 * non-exit continuation `Cont(v, body)` is translated into a direct-style call
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 377
379 Statement visitRethrow(cps_ir.Rethrow node) { 378 Statement visitRethrow(cps_ir.Rethrow node) {
380 return new Rethrow(); 379 return new Rethrow();
381 } 380 }
382 381
383 Statement visitUnreachable(cps_ir.Unreachable node) { 382 Statement visitUnreachable(cps_ir.Unreachable node) {
384 return new Unreachable(); 383 return new Unreachable();
385 } 384 }
386 385
387 Expression visitNonTailThrow(cps_ir.NonTailThrow node) { 386 Expression visitNonTailThrow(cps_ir.NonTailThrow node) {
388 unexpectedNode(node); 387 return unexpectedNode(node);
389 } 388 }
390 389
391 Statement continueWithExpression(cps_ir.Reference continuation, 390 Statement continueWithExpression(cps_ir.Reference continuation,
392 Expression expression) { 391 Expression expression) {
393 cps_ir.Continuation cont = continuation.definition; 392 cps_ir.Continuation cont = continuation.definition;
394 if (cont == returnContinuation) { 393 if (cont == returnContinuation) {
395 return new Return(expression); 394 return new Return(expression);
396 } else { 395 } else {
397 assert(cont.parameters.length == 1); 396 assert(cont.parameters.length == 1);
398 Function nextBuilder = cont.hasExactlyOneUse ? 397 Function nextBuilder = cont.hasExactlyOneUse ?
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 }) 518 })
520 ); 519 );
521 } 520 }
522 521
523 FunctionDefinition makeSubFunction(cps_ir.FunctionDefinition function) { 522 FunctionDefinition makeSubFunction(cps_ir.FunctionDefinition function) {
524 return createInnerBuilder().buildFunction(function); 523 return createInnerBuilder().buildFunction(function);
525 } 524 }
526 525
527 Expression visitCreateFunction(cps_ir.CreateFunction node) { 526 Expression visitCreateFunction(cps_ir.CreateFunction node) {
528 FunctionDefinition def = makeSubFunction(node.definition); 527 FunctionDefinition def = makeSubFunction(node.definition);
529 FunctionType type = node.definition.element.type;
530 bool hasReturnType = !type.returnType.treatAsDynamic;
531 return new FunctionExpression(def); 528 return new FunctionExpression(def);
532 } 529 }
533 530
534 visitParameter(cps_ir.Parameter node) { 531 visitParameter(cps_ir.Parameter node) {
535 // Continuation parameters are not visited (continuations themselves are 532 // Continuation parameters are not visited (continuations themselves are
536 // not visited yet). 533 // not visited yet).
537 unexpectedNode(node); 534 unexpectedNode(node);
538 } 535 }
539 536
540 visitContinuation(cps_ir.Continuation node) { 537 visitContinuation(cps_ir.Continuation node) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 578
582 Statement visitSetStatic(cps_ir.SetStatic node) { 579 Statement visitSetStatic(cps_ir.SetStatic node) {
583 SetStatic setStatic = new SetStatic( 580 SetStatic setStatic = new SetStatic(
584 node.element, 581 node.element,
585 getVariableUse(node.value), 582 getVariableUse(node.value),
586 node.sourceInformation); 583 node.sourceInformation);
587 return new ExpressionStatement(setStatic, visit(node.body)); 584 return new ExpressionStatement(setStatic, visit(node.body));
588 } 585 }
589 } 586 }
590 587
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698