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

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

Issue 10942028: Support class and typedef literals as expressions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix two long lines. Created 8 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) 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 /** 5 /**
6 * The [ConstantHandler] keeps track of compile-time constants, 6 * The [ConstantHandler] keeps track of compile-time constants,
7 * initializations of global and static fields, and default values of 7 * initializations of global and static fields, and default values of
8 * optional parameters. 8 * optional parameters.
9 */ 9 */
10 class ConstantHandler extends CompilerTask { 10 class ConstantHandler extends CompilerTask {
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 StringConstant partString = evaluate(part.string); 382 StringConstant partString = evaluate(part.string);
383 if (partString == null) return null; 383 if (partString == null) return null;
384 accumulator = new DartString.concat(accumulator, partString.value); 384 accumulator = new DartString.concat(accumulator, partString.value);
385 }; 385 };
386 return constantSystem.createString(accumulator, node); 386 return constantSystem.createString(accumulator, node);
387 } 387 }
388 388
389 // TODO(floitsch): provide better error-messages. 389 // TODO(floitsch): provide better error-messages.
390 Constant visitSend(Send send) { 390 Constant visitSend(Send send) {
391 Element element = elements[send]; 391 Element element = elements[send];
392 if (send.isPropertyAccess) { 392 if (send.isPropertyAccessOrTypeReference) {
393 if (Elements.isStaticOrTopLevelFunction(element)) { 393 if (Elements.isStaticOrTopLevelFunction(element)) {
394 compiler.codegenWorld.staticFunctionsNeedingGetter.add(element); 394 compiler.codegenWorld.staticFunctionsNeedingGetter.add(element);
395 Constant constant = new FunctionConstant(element); 395 Constant constant = new FunctionConstant(element);
396 compiler.constantHandler.registerCompileTimeConstant(constant); 396 compiler.constantHandler.registerCompileTimeConstant(constant);
397 compiler.enqueuer.codegen.registerStaticUse(element); 397 compiler.enqueuer.codegen.registerStaticUse(element);
398 return constant; 398 return constant;
399 } else if (Elements.isStaticOrTopLevelField(element)) { 399 } else if (Elements.isStaticOrTopLevelField(element)) {
400 Constant result; 400 Constant result;
401 if (element.modifiers.isConst()) { 401 if (element.modifiers.isConst()) {
402 result = compiler.compileConstant(element); 402 result = compiler.compileConstant(element);
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 Constant fieldValue = fieldValues[field]; 806 Constant fieldValue = fieldValues[field];
807 if (fieldValue === null) { 807 if (fieldValue === null) {
808 // Use the default value. 808 // Use the default value.
809 fieldValue = compiler.compileConstant(field); 809 fieldValue = compiler.compileConstant(field);
810 } 810 }
811 jsNewArguments.add(fieldValue); 811 jsNewArguments.add(fieldValue);
812 }); 812 });
813 return jsNewArguments; 813 return jsNewArguments;
814 } 814 }
815 } 815 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/compiler.dart » ('j') | lib/compiler/implementation/lib/js_helper.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698