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

Side by Side Diff: lib/compiler/implementation/compile_time_constants.dart

Issue 10891022: Update corelib/ and lib/ to use the new try-catch syntax. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | « lib/compiler/implementation/apiimpl.dart ('k') | lib/compiler/implementation/compiler.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 class Constant implements Hashable { 5 class Constant implements Hashable {
6 const Constant(); 6 const Constant();
7 7
8 bool isNull() => false; 8 bool isNull() => false;
9 bool isBool() => false; 9 bool isBool() => false;
10 bool isTrue() => false; 10 bool isTrue() => false;
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 } 605 }
606 606
607 /** Attempts to compile a constant expression. Returns null if not possible */ 607 /** Attempts to compile a constant expression. Returns null if not possible */
608 Constant tryCompileNodeWithDefinitions(Node node, TreeElements definitions) { 608 Constant tryCompileNodeWithDefinitions(Node node, TreeElements definitions) {
609 return measure(() { 609 return measure(() {
610 assert(node !== null); 610 assert(node !== null);
611 try { 611 try {
612 TryCompileTimeConstantEvaluator evaluator = 612 TryCompileTimeConstantEvaluator evaluator =
613 new TryCompileTimeConstantEvaluator(definitions, compiler); 613 new TryCompileTimeConstantEvaluator(definitions, compiler);
614 return evaluator.evaluate(node); 614 return evaluator.evaluate(node);
615 } catch (CompileTimeConstantError exn) { 615 } on CompileTimeConstantError catch (exn) {
616 return null; 616 return null;
617 } 617 }
618 }); 618 });
619 } 619 }
620 620
621 /** 621 /**
622 * Returns a [List] of static non final fields that need to be initialized. 622 * Returns a [List] of static non final fields that need to be initialized.
623 * The list must be evaluated in order since the fields might depend on each 623 * The list must be evaluated in order since the fields might depend on each
624 * other. 624 * other.
625 */ 625 */
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 Constant fieldValue = fieldValues[field]; 1210 Constant fieldValue = fieldValues[field];
1211 if (fieldValue === null) { 1211 if (fieldValue === null) {
1212 // Use the default value. 1212 // Use the default value.
1213 fieldValue = compiler.compileVariable(field); 1213 fieldValue = compiler.compileVariable(field);
1214 } 1214 }
1215 jsNewArguments.add(fieldValue); 1215 jsNewArguments.add(fieldValue);
1216 }); 1216 });
1217 return jsNewArguments; 1217 return jsNewArguments;
1218 } 1218 }
1219 } 1219 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/apiimpl.dart ('k') | lib/compiler/implementation/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698