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

Side by Side Diff: pkg/js_ast/lib/src/builder.dart

Issue 1074043003: Compute default throws behavior from JavaScript. (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 | « pkg/compiler/lib/src/ssa/nodes.dart ('k') | tests/compiler/dart2js/js_throw_behavior_test.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) 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 4
5 // Utilities for building JS ASTs at runtime. Contains a builder class 5 // Utilities for building JS ASTs at runtime. Contains a builder class
6 // and a parser that parses part of the language. 6 // and a parser that parses part of the language.
7 7
8 part of js_ast; 8 part of js_ast;
9 9
10 10
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 } 604 }
605 lastToken = src.substring(lastPosition, position); 605 lastToken = src.substring(lastPosition, position);
606 } else { 606 } else {
607 // All other tokens handled here. 607 // All other tokens handled here.
608 int cat = category(src.codeUnitAt(position)); 608 int cat = category(src.codeUnitAt(position));
609 int newCat; 609 int newCat;
610 do { 610 do {
611 position++; 611 position++;
612 if (position == src.length) break; 612 if (position == src.length) break;
613 int code = src.codeUnitAt(position); 613 int code = src.codeUnitAt(position);
614 // Special code to disallow ! and / in non-first position in token, so 614 // Special code to disallow !, ~ and / in non-first position in token,
615 // that !! parses as two tokens and != parses as one, while =/ parses 615 // so that !! and ~~ parse as two tokens and != parses as one, while =/
616 // as a an equals token followed by a regexp literal start. 616 // parses as a an equals token followed by a regexp literal start.
617 newCat = (code == charCodes.$BANG || code == charCodes.$SLASH) 617 newCat =
618 ? NONE 618 (code == charCodes.$BANG ||
619 code == charCodes.$SLASH ||
620 code == charCodes.$TILDE)
621 ? NONE
619 : category(code); 622 : category(code);
620 } while (!singleCharCategory(cat) && 623 } while (!singleCharCategory(cat) &&
621 (cat == newCat || 624 (cat == newCat ||
622 (cat == ALPHA && newCat == NUMERIC) || // eg. level42. 625 (cat == ALPHA && newCat == NUMERIC) || // eg. level42.
623 (cat == NUMERIC && newCat == DOT))); // eg. 3.1415 626 (cat == NUMERIC && newCat == DOT))); // eg. 3.1415
624 lastCategory = cat; 627 lastCategory = cat;
625 lastToken = src.substring(lastPosition, position); 628 lastToken = src.substring(lastPosition, position);
626 if (cat == NUMERIC) { 629 if (cat == NUMERIC) {
627 double.parse(lastToken, (_) { 630 double.parse(lastToken, (_) {
628 error("Unparseable number"); 631 error("Unparseable number");
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 1332
1330 Catch parseCatch() { 1333 Catch parseCatch() {
1331 expectCategory(LPAREN); 1334 expectCategory(LPAREN);
1332 Declaration errorName = parseVariableDeclaration(); 1335 Declaration errorName = parseVariableDeclaration();
1333 expectCategory(RPAREN); 1336 expectCategory(RPAREN);
1334 expectCategory(LBRACE); 1337 expectCategory(LBRACE);
1335 Block body = parseBlock(); 1338 Block body = parseBlock();
1336 return new Catch(errorName, body); 1339 return new Catch(errorName, body);
1337 } 1340 }
1338 } 1341 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/nodes.dart ('k') | tests/compiler/dart2js/js_throw_behavior_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698