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

Unified Diff: pkg/dev_compiler/lib/src/compiler/code_generator.dart

Issue 2545843002: Modify dev_compiler to use analyzer's new AstFactory class. (Closed)
Patch Set: Run dartfmt Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: pkg/dev_compiler/lib/src/compiler/code_generator.dart
diff --git a/pkg/dev_compiler/lib/src/compiler/code_generator.dart b/pkg/dev_compiler/lib/src/compiler/code_generator.dart
index 4b39975c66c49fe9309fcda37f04b2db61b0f018..e622041f0cfb706bbedff7101b4c3c67295f347b 100644
--- a/pkg/dev_compiler/lib/src/compiler/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/compiler/code_generator.dart
@@ -8,6 +8,7 @@ import 'dart:math' show min, max;
import 'package:analyzer/analyzer.dart' hide ConstantEvaluator;
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_ast_factory.dart';
import 'package:analyzer/dart/ast/token.dart' show Token, TokenType;
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
@@ -1314,7 +1315,7 @@ class CodeGenerator extends GeneralizingAstVisitor
jsMethods.add(new JS.Method(
_propertyName('constructor'),
js.call('function(...args) { return this.new.apply(this, args); }')
- as JS.Fun));
+ as JS.Fun));
} else if (ctors.isEmpty) {
jsMethods.add(_emitImplicitConstructor(node, fields, virtualFields));
}
@@ -3967,7 +3968,7 @@ class CodeGenerator extends GeneralizingAstVisitor
new JS.Method(
access,
js.call('function() { return #; }', _visitInitializer(node))
- as JS.Fun,
+ as JS.Fun,
isGetter: true),
node,
_findAccessor(element, getter: true)));
@@ -4453,8 +4454,8 @@ class CodeGenerator extends GeneralizingAstVisitor
// LocalVariableElementImpl, so we could repurpose to mean "temp".
// * add a new property to LocalVariableElementImpl.
// * create a new subtype of LocalVariableElementImpl to mark a temp.
- var id =
- new SimpleIdentifier(new StringToken(TokenType.IDENTIFIER, name, -1));
+ var id = astFactory
+ .simpleIdentifier(new StringToken(TokenType.IDENTIFIER, name, -1));
variable ??= new JS.TemporaryId(name);
@@ -4509,14 +4510,14 @@ class CodeGenerator extends GeneralizingAstVisitor
Expression result;
if (expr is IndexExpression) {
IndexExpression index = expr;
- result = new IndexExpression.forTarget(
+ result = astFactory.indexExpressionForTarget(
_bindValue(scope, 'o', index.target, context: context),
index.leftBracket,
_bindValue(scope, 'i', index.index, context: context),
index.rightBracket);
} else if (expr is PropertyAccess) {
PropertyAccess prop = expr;
- result = new PropertyAccess(
+ result = astFactory.propertyAccess(
_bindValue(scope, 'o', _getTarget(prop), context: context),
prop.operator,
prop.propertyName);
@@ -4525,9 +4526,9 @@ class CodeGenerator extends GeneralizingAstVisitor
if (isLibraryPrefix(ident.prefix)) {
return expr;
}
- result = new PrefixedIdentifier(
+ result = astFactory.prefixedIdentifier(
_bindValue(scope, 'o', ident.prefix, context: context)
- as SimpleIdentifier,
+ as SimpleIdentifier,
ident.period,
ident.identifier);
} else {
« no previous file with comments | « pkg/dev_compiler/lib/src/compiler/ast_builder.dart ('k') | pkg/dev_compiler/lib/src/compiler/reify_coercions.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698