OLD | NEW |
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 #include "vm/parser.h" | 5 #include "vm/parser.h" |
6 | 6 |
7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
8 #include "vm/bigint_operations.h" | 8 #include "vm/bigint_operations.h" |
9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 7332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7343 EnsureSavedCurrentContext(); | 7343 EnsureSavedCurrentContext(); |
7344 closure = GenerateStaticFieldLookup(field, call_pos); | 7344 closure = GenerateStaticFieldLookup(field, call_pos); |
7345 return new ClosureCallNode(call_pos, closure, arguments); | 7345 return new ClosureCallNode(call_pos, closure, arguments); |
7346 } | 7346 } |
7347 // Could not resolve static method: throw a NoSuchMethodError. | 7347 // Could not resolve static method: throw a NoSuchMethodError. |
7348 return ThrowNoSuchMethodError(ident_pos, | 7348 return ThrowNoSuchMethodError(ident_pos, |
7349 cls, | 7349 cls, |
7350 func_name, | 7350 func_name, |
7351 InvocationMirror::kStatic, | 7351 InvocationMirror::kStatic, |
7352 InvocationMirror::kMethod); | 7352 InvocationMirror::kMethod); |
| 7353 } else if (cls.IsTopLevel() && |
| 7354 (cls.library() == Library::CoreLibrary()) && |
| 7355 (func.name() == Symbols::Identical().raw())) { |
| 7356 // This is the predefined toplevel function identical(a,b). Create |
| 7357 // a comparison node instead. |
| 7358 ASSERT(num_arguments == 2); |
| 7359 return new ComparisonNode(ident_pos, |
| 7360 Token::kEQ_STRICT, |
| 7361 arguments->NodeAt(0), |
| 7362 arguments->NodeAt(1)); |
7353 } | 7363 } |
7354 return new StaticCallNode(call_pos, func, arguments); | 7364 return new StaticCallNode(call_pos, func, arguments); |
7355 } | 7365 } |
7356 | 7366 |
7357 | 7367 |
7358 AstNode* Parser::ParseInstanceCall(AstNode* receiver, const String& func_name) { | 7368 AstNode* Parser::ParseInstanceCall(AstNode* receiver, const String& func_name) { |
7359 TRACE_PARSER("ParseInstanceCall"); | 7369 TRACE_PARSER("ParseInstanceCall"); |
7360 const intptr_t call_pos = TokenPos(); | 7370 const intptr_t call_pos = TokenPos(); |
7361 if (CurrentToken() != Token::kLPAREN) { | 7371 if (CurrentToken() != Token::kLPAREN) { |
7362 ErrorMsg(call_pos, "left parenthesis expected"); | 7372 ErrorMsg(call_pos, "left parenthesis expected"); |
(...skipping 2566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9929 void Parser::SkipQualIdent() { | 9939 void Parser::SkipQualIdent() { |
9930 ASSERT(IsIdentifier()); | 9940 ASSERT(IsIdentifier()); |
9931 ConsumeToken(); | 9941 ConsumeToken(); |
9932 if (CurrentToken() == Token::kPERIOD) { | 9942 if (CurrentToken() == Token::kPERIOD) { |
9933 ConsumeToken(); // Consume the kPERIOD token. | 9943 ConsumeToken(); // Consume the kPERIOD token. |
9934 ExpectIdentifier("identifier expected after '.'"); | 9944 ExpectIdentifier("identifier expected after '.'"); |
9935 } | 9945 } |
9936 } | 9946 } |
9937 | 9947 |
9938 } // namespace dart | 9948 } // namespace dart |
OLD | NEW |