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

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

Issue 24282005: Move compile-time constant registrations to the backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status Created 7 years, 2 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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.util; 5 library dart2js.util;
6 6
7 import "dart:collection"; 7 import "dart:collection";
8 import 'util_implementation.dart'; 8 import 'util_implementation.dart';
9 import 'characters.dart'; 9 import 'characters.dart';
10 10
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 /// Helper class for the processing of stack traces in [prettifyStackTrace]. 70 /// Helper class for the processing of stack traces in [prettifyStackTrace].
71 class _StackTraceLine { 71 class _StackTraceLine {
72 final int index; 72 final int index;
73 final String file; 73 final String file;
74 final String lineNo; 74 final String lineNo;
75 final String columnNo; 75 final String columnNo;
76 final String method; 76 final String method;
77 77
78 _StackTraceLine(this.index, this.file, this.lineNo, 78 _StackTraceLine(this.index, this.file, this.lineNo,
79 this.columnNo, this.method); 79 this.columnNo, this.method);
80
81 String toString() {
82 return 'index=$index, file=$file, '
83 'lineNo=$lineNo, columnNo=$columnNo, method=$method';
84 }
80 } 85 }
81 86
82 // TODO(johnniwinther): Use this format for --throw-on-error. 87 // TODO(johnniwinther): Use this format for --throw-on-error.
83 /** 88 /**
84 * Converts the normal VM stack trace into a more compact and readable format. 89 * Converts the normal VM stack trace into a more compact and readable format.
85 * 90 *
86 * The output format is [: <file> . . . <lineNo>:<columnNo> <method> :] where 91 * The output format is [: <file> . . . <lineNo>:<columnNo> <method> :] where
87 * [: <file> :] is file name, [: <lineNo> :] is the line number, 92 * [: <file> :] is file name, [: <lineNo> :] is the line number,
88 * [: <columnNo> :] is the column number, and [: <method> :] is the method name. 93 * [: <columnNo> :] is the column number, and [: <method> :] is the method name.
89 * 94 *
(...skipping 26 matching lines...) Expand all
116 if (line.isEmpty) continue; 121 if (line.isEmpty) continue;
117 122
118 // Strip index. 123 // Strip index.
119 line = line.replaceFirst(new RegExp(r'#\d+\s*'), ''); 124 line = line.replaceFirst(new RegExp(r'#\d+\s*'), '');
120 125
121 int leftParenPos = line.indexOf('('); 126 int leftParenPos = line.indexOf('(');
122 int rightParenPos = line.indexOf(')', leftParenPos); 127 int rightParenPos = line.indexOf(')', leftParenPos);
123 int lastColon = line.lastIndexOf(':', rightParenPos); 128 int lastColon = line.lastIndexOf(':', rightParenPos);
124 int nextToLastColon = line.lastIndexOf(':', lastColon-1); 129 int nextToLastColon = line.lastIndexOf(':', lastColon-1);
125 130
126 String lineNo = line.substring(nextToLastColon+1, lastColon); 131 String lineNo;
132 String columnNo;
133 if (nextToLastColon != -1) {
134 lineNo = line.substring(nextToLastColon+1, lastColon);
135 columnNo = line.substring(lastColon+1, rightParenPos);
136 try {
137 int.parse(lineNo);
138 } on FormatException catch (e) {
139 lineNo = columnNo;
140 columnNo = '';
141 nextToLastColon = lastColon;
142 }
143 } else {
144 lineNo = line.substring(lastColon+1, rightParenPos);
145 columnNo = '';
146 nextToLastColon = lastColon;
147 }
148
127 if (lineNo.length > maxLineNoLength) { 149 if (lineNo.length > maxLineNoLength) {
128 maxLineNoLength = lineNo.length; 150 maxLineNoLength = lineNo.length;
129 } 151 }
130 String columnNo = line.substring(lastColon+1, rightParenPos);
131 if (columnNo.length > maxColumnNoLength) { 152 if (columnNo.length > maxColumnNoLength) {
132 maxColumnNoLength = columnNo.length; 153 maxColumnNoLength = columnNo.length;
133 } 154 }
155
134 String file = line.substring(leftParenPos+1, nextToLastColon); 156 String file = line.substring(leftParenPos+1, nextToLastColon);
135 if (filePrefix != null && file.startsWith(filePrefix)) { 157 if (filePrefix != null && file.startsWith(filePrefix)) {
136 file = file.substring(filePrefix.length); 158 file = file.substring(filePrefix.length);
137 } 159 }
138 if (file.length > maxFileLength) { 160 if (file.length > maxFileLength) {
139 maxFileLength = file.length; 161 maxFileLength = file.length;
140 } 162 }
141 String method = line.substring(0, leftParenPos-1); 163 String method = line.substring(0, leftParenPos-1);
142 if (lambda != null) { 164 if (lambda != null) {
143 method = method.replaceAll('<anonymous closure>', lambda); 165 method = method.replaceAll('<anonymous closure>', lambda);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 } 281 }
260 buffer.write(string); 282 buffer.write(string);
261 } 283 }
262 284
263 int computeHashCode(part1, [part2, part3, part4]) { 285 int computeHashCode(part1, [part2, part3, part4]) {
264 return (part1.hashCode 286 return (part1.hashCode
265 ^ part2.hashCode 287 ^ part2.hashCode
266 ^ part3.hashCode 288 ^ part3.hashCode
267 ^ part4.hashCode) & 0x3fffffff; 289 ^ part4.hashCode) & 0x3fffffff;
268 } 290 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/typechecker.dart ('k') | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698