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

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

Issue 954253002: dart2js: add compiler builtins to the core-runtime. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move more foreigns to builtins. 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
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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 Template template = templateManager.lookupStatementTemplate(source); 250 Template template = templateManager.lookupStatementTemplate(source);
251 if (template == null) { 251 if (template == null) {
252 MiniJsParser parser = new MiniJsParser(source); 252 MiniJsParser parser = new MiniJsParser(source);
253 Statement statement = parser.statement(); 253 Statement statement = parser.statement();
254 template = templateManager.defineStatementTemplate(source, statement); 254 template = templateManager.defineStatementTemplate(source, statement);
255 } 255 }
256 return template; 256 return template;
257 } 257 }
258 258
259 /** 259 /**
260 * Creates an Expression template for the given [source].
261 *
262 * The returned template is cached.
263 */
264 Template expressionTemplateFor(String source) {
265 return _findExpressionTemplate(source);
266 }
267
268 /**
260 * Creates an Expression template without caching the result. 269 * Creates an Expression template without caching the result.
261 */ 270 */
262 Template uncachedExpressionTemplate(String source) { 271 Template uncachedExpressionTemplate(String source) {
263 MiniJsParser parser = new MiniJsParser(source); 272 MiniJsParser parser = new MiniJsParser(source);
264 Expression expression = parser.expression(); 273 Expression expression = parser.expression();
265 return new Template( 274 return new Template(
266 source, expression, isExpression: true, forceCopy: false); 275 source, expression, isExpression: true, forceCopy: false);
267 } 276 }
268 277
269 /** 278 /**
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 1341
1333 Catch parseCatch() { 1342 Catch parseCatch() {
1334 expectCategory(LPAREN); 1343 expectCategory(LPAREN);
1335 Declaration errorName = parseVariableDeclaration(); 1344 Declaration errorName = parseVariableDeclaration();
1336 expectCategory(RPAREN); 1345 expectCategory(RPAREN);
1337 expectCategory(LBRACE); 1346 expectCategory(LBRACE);
1338 Block body = parseBlock(); 1347 Block body = parseBlock();
1339 return new Catch(errorName, body); 1348 return new Catch(errorName, body);
1340 } 1349 }
1341 } 1350 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698