mirror of
https://github.com/dart-lang/sdk
synced 2024-09-20 01:28:21 +00:00
Handle built-in function identical correctly
The parser, rather than the backend, recognizes the built-in function identical and replaces is with the old token for the === operator. This fixes compile time constant handling of calls to identical. Review URL: https://codereview.chromium.org//14366007 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21753 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
7f1bc0d351
commit
9ae17640bf
|
@ -1929,30 +1929,6 @@ static intptr_t GetResultCidOfNative(const Function& function) {
|
|||
// <Expression> ::= StaticCall { function: Function
|
||||
// arguments: <ArgumentList> }
|
||||
void EffectGraphVisitor::VisitStaticCallNode(StaticCallNode* node) {
|
||||
if (node->function().name() == Symbols::Identical().raw()) {
|
||||
// Attempt to replace top level defined 'identical' from the core
|
||||
// library with strict equal early on.
|
||||
// TODO(hausner): Evaluate if this can happen at AST building time.
|
||||
const Class& cls = Class::Handle(node->function().Owner());
|
||||
if (cls.IsTopLevel()) {
|
||||
const Library& core_lib = Library::Handle(Library::CoreLibrary());
|
||||
if (cls.library() == core_lib.raw()) {
|
||||
ASSERT(node->arguments()->length() == 2);
|
||||
ValueGraphVisitor for_left_value(owner(), temp_index());
|
||||
node->arguments()->NodeAt(0)->Visit(&for_left_value);
|
||||
Append(for_left_value);
|
||||
ValueGraphVisitor for_right_value(owner(), temp_index());
|
||||
node->arguments()->NodeAt(1)->Visit(&for_right_value);
|
||||
Append(for_right_value);
|
||||
StrictCompareInstr* comp = new StrictCompareInstr(
|
||||
Token::kEQ_STRICT,
|
||||
for_left_value.value(),
|
||||
for_right_value.value());
|
||||
ReturnDefinition(comp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
ZoneGrowableArray<PushArgumentInstr*>* arguments =
|
||||
new ZoneGrowableArray<PushArgumentInstr*>(node->arguments()->length());
|
||||
BuildPushArguments(*node->arguments(), arguments);
|
||||
|
|
|
@ -7350,6 +7350,16 @@ AstNode* Parser::ParseStaticCall(const Class& cls,
|
|||
func_name,
|
||||
InvocationMirror::kStatic,
|
||||
InvocationMirror::kMethod);
|
||||
} else if (cls.IsTopLevel() &&
|
||||
(cls.library() == Library::CoreLibrary()) &&
|
||||
(func.name() == Symbols::Identical().raw())) {
|
||||
// This is the predefined toplevel function identical(a,b). Create
|
||||
// a comparison node instead.
|
||||
ASSERT(num_arguments == 2);
|
||||
return new ComparisonNode(ident_pos,
|
||||
Token::kEQ_STRICT,
|
||||
arguments->NodeAt(0),
|
||||
arguments->NodeAt(1));
|
||||
}
|
||||
return new StaticCallNode(call_pos, func, arguments);
|
||||
}
|
||||
|
|
|
@ -191,7 +191,6 @@ Language/07_Classes/6_Constructors_A01_t04: Fail # Inherited from dart2js
|
|||
Language/07_Classes/6_Constructors_A01_t05: Fail # Inherited from dart2js
|
||||
Language/07_Classes/6_Constructors_A01_t06: Fail # Inherited from dart2js
|
||||
Language/07_Classes/6_Constructors_A02_t01: Fail # http://dartbug.com/5519
|
||||
Language/11_Expressions/01_Constants_A03_t01: Fail # Inherited from dart2js
|
||||
Language/11_Expressions/01_Constants_A03_t02: Fail # http://dartbug.com/5519
|
||||
Language/11_Expressions/01_Constants_A03_t03: Fail # http://dartbug.com/5519
|
||||
Language/11_Expressions/01_Constants_A03_t04: Fail # http://dartbug.com/5519
|
||||
|
@ -199,7 +198,6 @@ Language/11_Expressions/01_Constants_A03_t05: Fail # http://dartbug.com/5519
|
|||
Language/11_Expressions/01_Constants_A05_t02: Fail # http://dartbug.com/5519
|
||||
Language/11_Expressions/01_Constants_A05_t03: Fail # http://dartbug.com/5810
|
||||
Language/11_Expressions/01_Constants_A05_t04: Fail # http://dartbug.com/5519
|
||||
Language/11_Expressions/01_Constants_A06_t01: Fail # inherited from VM
|
||||
Language/11_Expressions/01_Constants_A08_t02: Fail # http://dartbug.com/5519
|
||||
Language/11_Expressions/01_Constants_A09_t02: Fail # http://dartbug.com/5519
|
||||
Language/11_Expressions/01_Constants_A10_t02: Fail # http://dartbug.com/5519
|
||||
|
@ -213,8 +211,6 @@ Language/11_Expressions/01_Constants_A13_t02: Fail # http://dartbug.com/5519
|
|||
Language/11_Expressions/01_Constants_A13_t03: Fail # http://dartbug.com/5519
|
||||
Language/11_Expressions/01_Constants_A13_t04: Fail # http://dartbug.com/5519
|
||||
Language/11_Expressions/01_Constants_A13_t05: Fail # http://dartbug.com/5519
|
||||
Language/11_Expressions/01_Constants_A14_t01: Fail # inherited from VM
|
||||
Language/11_Expressions/01_Constants_A14_t01: Fail # inherited from dart2js
|
||||
Language/11_Expressions/01_Constants_A14_t02: Fail # http://dartbug.com/5810
|
||||
Language/11_Expressions/01_Constants_A15_t06: Fail # http://dartbug.com/5519
|
||||
Language/11_Expressions/01_Constants_A15_t07: Fail # http://dartbug.com/5519
|
||||
|
|
|
@ -110,9 +110,6 @@ Language/07_Classes/6_Constructors/3_Constant_Constructors_A04_t02: Fail # Dart
|
|||
Language/07_Classes/6_Constructors/3_Constant_Constructors_A04_t03: Fail # Dart issue 811
|
||||
Language/07_Classes/6_Constructors/3_Constant_Constructors_A05_t01: Fail # Dart issue 811
|
||||
Language/07_Classes/6_Constructors/3_Constant_Constructors_A05_t02: Fail # Dart issue 811
|
||||
Language/11_Expressions/01_Constants_A03_t01: Fail # Dart issue 5214
|
||||
Language/11_Expressions/01_Constants_A06_t01: Fail # Dart issue 5214
|
||||
Language/11_Expressions/01_Constants_A14_t01: Fail # Dart issue 5214
|
||||
Language/11_Expressions/05_Strings/1_String_Interpolation_A01_t04: Fail # Dart issue 7246
|
||||
Language/11_Expressions/05_Strings/1_String_Interpolation_A01_t05: Fail # Dart issue 7246
|
||||
Language/11_Expressions/05_Strings/1_String_Interpolation_A01_t06: Fail # Dart issue 7246
|
||||
|
|
Loading…
Reference in a new issue