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

Side by Side Diff: pkg/analyzer2dart/lib/src/cps_generator.dart

Issue 1075923002: Refactor the try statement analysis results. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 analyzer2dart.cps_generator; 5 library analyzer2dart.cps_generator;
6 6
7 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 8
9 import 'package:compiler/src/dart_types.dart' as dart2js; 9 import 'package:compiler/src/dart_types.dart' as dart2js;
10 import 'package:compiler/src/elements/elements.dart' as dart2js; 10 import 'package:compiler/src/elements/elements.dart' as dart2js;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 analyzer.LibraryElement get currentLibrary => element.library; 88 analyzer.LibraryElement get currentLibrary => element.library;
89 89
90 ir.Node visit(AstNode node) => node.accept(this); 90 ir.Node visit(AstNode node) => node.accept(this);
91 91
92 ir.ConstructorDefinition handleConstructorDeclaration( 92 ir.ConstructorDefinition handleConstructorDeclaration(
93 analyzer.ConstructorElement constructor, FunctionBody body) { 93 analyzer.ConstructorElement constructor, FunctionBody body) {
94 dart2js.ConstructorElement element = converter.convertElement(constructor); 94 dart2js.ConstructorElement element = converter.convertElement(constructor);
95 return withBuilder( 95 return withBuilder(
96 new DartIrBuilder(DART_CONSTANT_SYSTEM, 96 new DartIrBuilder(DART_CONSTANT_SYSTEM,
97 element, 97 element,
98 // TODO(johnniwinther): Supported closure variables. 98 // TODO(johnniwinther): Support closure variables.
99 new NullCapturedVariables()), 99 new Set<dart2js.Local>()),
100 () { 100 () {
101 irBuilder.buildFunctionHeader( 101 irBuilder.buildFunctionHeader(
102 constructor.parameters.map(converter.convertElement)); 102 constructor.parameters.map(converter.convertElement));
103 // Visit the body directly to avoid processing the signature as 103 // Visit the body directly to avoid processing the signature as
104 // expressions. 104 // expressions.
105 // Call to allow for `body == null` in case of synthesized constructors. 105 // Call to allow for `body == null` in case of synthesized constructors.
106 build(body); 106 build(body);
107 return irBuilder.makeConstructorDefinition(const [], const []); 107 return irBuilder.makeConstructorDefinition(const [], const []);
108 }); 108 });
109 } 109 }
110 110
111 ir.FieldDefinition handleFieldDeclaration( 111 ir.FieldDefinition handleFieldDeclaration(
112 analyzer.PropertyInducingElement field, VariableDeclaration node) { 112 analyzer.PropertyInducingElement field, VariableDeclaration node) {
113 dart2js.FieldElement element = converter.convertElement(field); 113 dart2js.FieldElement element = converter.convertElement(field);
114 return withBuilder( 114 return withBuilder(
115 new DartIrBuilder(DART_CONSTANT_SYSTEM, 115 new DartIrBuilder(DART_CONSTANT_SYSTEM,
116 element, 116 element,
117 // TODO(johnniwinther): Supported closure variables. 117 // TODO(johnniwinther): Support closure variables.
118 new NullCapturedVariables()), 118 new Set<dart2js.Local>()),
119 () { 119 () {
120 irBuilder.buildFieldInitializerHeader(); 120 irBuilder.buildFieldInitializerHeader();
121 ir.Primitive initializer = build(node.initializer); 121 ir.Primitive initializer = build(node.initializer);
122 return irBuilder.makeFieldDefinition(initializer); 122 return irBuilder.makeFieldDefinition(initializer);
123 }); 123 });
124 } 124 }
125 125
126 ir.FunctionDefinition handleFunctionDeclaration( 126 ir.FunctionDefinition handleFunctionDeclaration(
127 analyzer.ExecutableElement function, FunctionBody body) { 127 analyzer.ExecutableElement function, FunctionBody body) {
128 dart2js.FunctionElement element = converter.convertElement(function); 128 dart2js.FunctionElement element = converter.convertElement(function);
129 return withBuilder( 129 return withBuilder(
130 new DartIrBuilder(DART_CONSTANT_SYSTEM, 130 new DartIrBuilder(DART_CONSTANT_SYSTEM,
131 element, 131 element,
132 // TODO(johnniwinther): Supported closure variables. 132 // TODO(johnniwinther): Support closure variables.
133 new NullCapturedVariables()), 133 new Set<dart2js.Local>()),
134 () { 134 () {
135 irBuilder.buildFunctionHeader( 135 irBuilder.buildFunctionHeader(
136 function.parameters.map(converter.convertElement)); 136 function.parameters.map(converter.convertElement));
137 // Visit the body directly to avoid processing the signature as 137 // Visit the body directly to avoid processing the signature as
138 // expressions. 138 // expressions.
139 visit(body); 139 visit(body);
140 return irBuilder.makeFunctionDefinition(const []); 140 return irBuilder.makeFunctionDefinition(const []);
141 }); 141 });
142 } 142 }
143 143
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 catchClause.exceptionParameter.staticElement), 578 catchClause.exceptionParameter.staticElement),
579 buildCatchBlock: subbuild(catchClause.body))); 579 buildCatchBlock: subbuild(catchClause.body)));
580 580
581 } 581 }
582 irBuilder.buildTry( 582 irBuilder.buildTry(
583 tryStatementInfo: new TryStatementInfo(), 583 tryStatementInfo: new TryStatementInfo(),
584 buildTryBlock: subbuild(node.body), 584 buildTryBlock: subbuild(node.body),
585 catchClauseInfos: catchClauseInfos); 585 catchClauseInfos: catchClauseInfos);
586 } 586 }
587 } 587 }
588
589 class NullCapturedVariables extends DartCapturedVariables {
590 NullCapturedVariables() : super(null);
591 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698