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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart

Issue 1772703002: Add source information to variable declarations in CPS. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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) 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 library dart2js.ir_nodes; 4 library dart2js.ir_nodes;
5 5
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'cps_fragment.dart' show CpsFragment; 7 import 'cps_fragment.dart' show CpsFragment;
8 import 'cps_ir_nodes_sexpr.dart'; 8 import 'cps_ir_nodes_sexpr.dart';
9 import '../constants/values.dart' as values; 9 import '../constants/values.dart' as values;
10 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; 10 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType;
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 412
413 /// A function definition, consisting of parameters and a body. 413 /// A function definition, consisting of parameters and a body.
414 /// 414 ///
415 /// There is an explicit parameter for the `this` argument, and a return 415 /// There is an explicit parameter for the `this` argument, and a return
416 /// continuation to invoke when returning from the function. 416 /// continuation to invoke when returning from the function.
417 class FunctionDefinition extends InteriorNode { 417 class FunctionDefinition extends InteriorNode {
418 final ExecutableElement element; 418 final ExecutableElement element;
419 final Parameter thisParameter; 419 final Parameter thisParameter;
420 final List<Parameter> parameters; 420 final List<Parameter> parameters;
421 final Continuation returnContinuation; 421 final Continuation returnContinuation;
422 final SourceInformation sourceInformation;
422 Expression body; 423 Expression body;
423 424
424 FunctionDefinition(this.element, this.thisParameter, this.parameters, 425 FunctionDefinition(
425 this.returnContinuation, this.body); 426 this.element,
427 this.thisParameter,
428 this.parameters,
429 this.returnContinuation,
430 this.body,
431 {this.sourceInformation});
426 432
427 accept(BlockVisitor visitor) => visitor.visitFunctionDefinition(this); 433 accept(BlockVisitor visitor) => visitor.visitFunctionDefinition(this);
428 434
429 void setParentPointers() { 435 void setParentPointers() {
430 if (thisParameter != null) thisParameter.parent = this; 436 if (thisParameter != null) thisParameter.parent = this;
431 _setParentsOnNodes(parameters, this); 437 _setParentsOnNodes(parameters, this);
432 returnContinuation.parent = this; 438 returnContinuation.parent = this;
433 if (body != null) body.parent = this; 439 if (body != null) body.parent = this;
434 } 440 }
435 } 441 }
(...skipping 2579 matching lines...) Expand 10 before | Expand all | Expand 10 after
3015 // Though the return continuation's parameter does not have any uses, 3021 // Though the return continuation's parameter does not have any uses,
3016 // we still make a proper copy to ensure that hints, type, etc. are 3022 // we still make a proper copy to ensure that hints, type, etc. are
3017 // copied. 3023 // copied.
3018 Parameter returnParameter = 3024 Parameter returnParameter =
3019 _definitions.copy(node.returnContinuation.parameters.first); 3025 _definitions.copy(node.returnContinuation.parameters.first);
3020 Continuation returnContinuation = 3026 Continuation returnContinuation =
3021 _copies[node.returnContinuation] = new Continuation([returnParameter]); 3027 _copies[node.returnContinuation] = new Continuation([returnParameter]);
3022 3028
3023 visit(node.body); 3029 visit(node.body);
3024 FunctionDefinition copy = new FunctionDefinition( 3030 FunctionDefinition copy = new FunctionDefinition(
3025 node.element, thisParameter, parameters, returnContinuation, _first); 3031 node.element, thisParameter, parameters, returnContinuation, _first,
3032 sourceInformation: node.sourceInformation);
3026 _first = _current = null; 3033 _first = _current = null;
3027 return copy; 3034 return copy;
3028 } 3035 }
3029 3036
3030 Node visit(Node node) => node.accept(this); 3037 Node visit(Node node) => node.accept(this);
3031 3038
3032 Expression traverseLetCont(LetCont node) { 3039 Expression traverseLetCont(LetCont node) {
3033 // Continuations are copied where they are bound, before processing 3040 // Continuations are copied where they are bound, before processing
3034 // expressions in the scope of their binding. 3041 // expressions in the scope of their binding.
3035 List<Continuation> continuations = node.continuations.map((Continuation c) { 3042 List<Continuation> continuations = node.continuations.map((Continuation c) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
3084 plug(new Branch.loose( 3091 plug(new Branch.loose(
3085 _definitions.getCopy(node.conditionRef), 3092 _definitions.getCopy(node.conditionRef),
3086 _copies[node.trueContinuation], 3093 _copies[node.trueContinuation],
3087 _copies[node.falseContinuation])..isStrictCheck = node.isStrictCheck); 3094 _copies[node.falseContinuation])..isStrictCheck = node.isStrictCheck);
3088 } 3095 }
3089 3096
3090 visitUnreachable(Unreachable node) { 3097 visitUnreachable(Unreachable node) {
3091 plug(new Unreachable()); 3098 plug(new Unreachable());
3092 } 3099 }
3093 } 3100 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698