| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.resolution.enum_creator; | 5 library dart2js.resolution.enum_creator; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common_elements.dart' show CommonElements; | 8 import '../common_elements.dart' show CommonElements; |
| 9 import '../elements/resolution_types.dart'; | 9 import '../elements/resolution_types.dart'; |
| 10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
| 11 import '../elements/modelx.dart'; | 11 import '../elements/modelx.dart'; |
| 12 import 'package:front_end/src/fasta/scanner.dart'; | 12 import 'package:front_end/src/fasta/scanner.dart'; |
| 13 import 'package:front_end/src/fasta/scanner/precedence.dart'; | |
| 14 import 'package:front_end/src/fasta/scanner/precedence.dart' as Precedence; | 13 import 'package:front_end/src/fasta/scanner/precedence.dart' as Precedence; |
| 14 import 'package:front_end/src/scanner/token.dart' show TokenType; |
| 15 import '../tree/tree.dart'; | 15 import '../tree/tree.dart'; |
| 16 import '../util/util.dart'; | 16 import '../util/util.dart'; |
| 17 | 17 |
| 18 // TODO(johnniwinther): Merge functionality with the `TreePrinter`. | 18 // TODO(johnniwinther): Merge functionality with the `TreePrinter`. |
| 19 class AstBuilder { | 19 class AstBuilder { |
| 20 final int charOffset; | 20 final int charOffset; |
| 21 | 21 |
| 22 AstBuilder(this.charOffset); | 22 AstBuilder(this.charOffset); |
| 23 | 23 |
| 24 Modifiers modifiers( | 24 Modifiers modifiers( |
| (...skipping 18 matching lines...) Expand all Loading... |
| 43 | 43 |
| 44 Token keywordToken(String text) { | 44 Token keywordToken(String text) { |
| 45 return new KeywordToken(Keyword.keywords[text], charOffset); | 45 return new KeywordToken(Keyword.keywords[text], charOffset); |
| 46 } | 46 } |
| 47 | 47 |
| 48 Token stringToken(String text) { | 48 Token stringToken(String text) { |
| 49 return new StringToken.fromString( | 49 return new StringToken.fromString( |
| 50 Precedence.IDENTIFIER_INFO, text, charOffset); | 50 Precedence.IDENTIFIER_INFO, text, charOffset); |
| 51 } | 51 } |
| 52 | 52 |
| 53 Token symbolToken(PrecedenceInfo info) { | 53 Token symbolToken(TokenType info) { |
| 54 return new SymbolToken(info, charOffset); | 54 return new SymbolToken(info, charOffset); |
| 55 } | 55 } |
| 56 | 56 |
| 57 Identifier identifier(String text) { | 57 Identifier identifier(String text) { |
| 58 Keyword keyword = Keyword.keywords[text]; | 58 Keyword keyword = Keyword.keywords[text]; |
| 59 Token token; | 59 Token token; |
| 60 if (keyword != null) { | 60 if (keyword != null) { |
| 61 token = new KeywordToken(keyword, charOffset); | 61 token = new KeywordToken(keyword, charOffset); |
| 62 } else { | 62 } else { |
| 63 token = stringToken(text); | 63 token = stringToken(text); |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 EnumMethodElementX toString = new EnumMethodElementX( | 313 EnumMethodElementX toString = new EnumMethodElementX( |
| 314 'toString', enumClass, Modifiers.EMPTY, toStringNode); | 314 'toString', enumClass, Modifiers.EMPTY, toStringNode); |
| 315 FunctionSignatureX toStringSignature = new FunctionSignatureX( | 315 FunctionSignatureX toStringSignature = new FunctionSignatureX( |
| 316 type: new ResolutionFunctionType(toString, stringType)); | 316 type: new ResolutionFunctionType(toString, stringType)); |
| 317 toString.functionSignature = toStringSignature; | 317 toString.functionSignature = toStringSignature; |
| 318 enumClass.addMember(toString, reporter); | 318 enumClass.addMember(toString, reporter); |
| 319 | 319 |
| 320 enumClass.enumValues = enumValues; | 320 enumClass.enumValues = enumValues; |
| 321 } | 321 } |
| 322 } | 322 } |
| OLD | NEW |